Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com> --- Changes in v3: - Remove the implicit .service suffix on leaf control groups. - Make cgroup-setup acts as an s6 finish script when called as "finish". - Put the VMMs in the same cgroups as the per-VM services. - Add common helper script for the per-VM services. - Significantly refactor the Rust code. - Link to v2: https://spectrum-os.org/lists/archives/spectrum-devel/20260620-cgroups-v2-1-... Changes in v2: - Omit resource control support. It was completely broken, and the way Spectrum run scripts work means that it is better to setup resource controls just before the execve() into the final service process. This will be done by a separate tool. - Link to v1: https://spectrum-os.org/lists/archives/spectrum-devel/20260620-cgroups-v1-1-... --- Demi Marie Obenour (22): host/rootfs: Mount filesystems before s6-rc-init scripts: Support symlinks in s6-rc-compile inputs tools: Add control group manager Documentation: Mention control groups Mount cgroup2 filesystem at /sys/fs/cgroup host/rootfs: Add helper program for per-VM services host/rootfs: Enable controllers in sub-cgroups host/rootfs: Add comments where cgroups are intentionally not used host/rootfs: serial-getty-generator: Use cgroups host/rootfs: Set up parent cgroup for all per-VM services host/rootfs: Create per-VM cgroup for all of the VM's services host/rootfs: run-vmm: Create per-VM cgroup host/rootfs: run-appimage: Purge the per-VM cgroup host/rootfs: run-flatpak: Purge the per-VM cgroup host/rootfs: dbus: Run in cgroup host/rootfs: vhost-user-fs: Run in cgroup host/rootfs: vhost-user-gpu: Run in cgroup host/rootfs: xdg-desktop-portal-spectrum-host: Run in cgroup host/rootfs: systemd-udevd: Run in cgroup host/rootfs: weston: Run in cgroup host/rootfs: spectrum-router: Run in cgroup host/rootfs: vm-import: Use elglob -w .codespellrc | 2 +- Documentation/doc/development/control-groups.adoc | 82 +++++ host/rootfs/Makefile | 32 +- host/rootfs/default.nix | 7 +- host/rootfs/file-list.mk | 12 + host/rootfs/image/etc/fstab | 1 + host/rootfs/image/etc/init | 15 +- .../s6-linux-init/run-image/service/getty-tty2/run | 1 + .../s6-linux-init/run-image/service/getty-tty3/run | 1 + .../s6-linux-init/run-image/service/getty-tty4/run | 1 + .../run-image/service/root-terminal/run | 1 + .../run-image/service/s6-linux-init-shutdownd/run | 1 + .../run-image/service/s6-svscan-log/run | 1 + .../service/serial-getty-generator/finish | 1 + .../run-image/service/serial-getty-generator/run | 4 +- .../run-image/service/serial-getty/run | 1 + .../run-image/service/serial-getty/template/run | 1 + .../run-image/service/vm-services/run | 3 + .../vm-services/template/data/service/dbus/finish | 1 + .../vm-services/template/data/service/dbus/run | 4 +- .../template/data/service/spectrum-router/finish | 1 + .../template/data/service/spectrum-router/run | 4 +- .../template/data/service/vhost-user-fs/finish | 1 + .../template/data/service/vhost-user-fs/run | 5 +- .../template/data/service/vhost-user-gpu/finish | 1 + .../template/data/service/vhost-user-gpu/run | 9 +- .../xdg-desktop-portal-spectrum-host/finish | 1 + .../service/xdg-desktop-portal-spectrum-host/run | 4 +- .../run-image/service/vm-services/template/finish | 1 + .../run-image/service/vm-services/template/run | 4 + .../rootfs/image/etc/s6-linux-init/scripts/rc.init | 9 +- host/rootfs/image/etc/s6-rc/systemd-udevd/finish | 1 + host/rootfs/image/etc/s6-rc/systemd-udevd/run | 5 +- host/rootfs/image/etc/s6-rc/weston/finish | 1 + host/rootfs/image/etc/s6-rc/weston/run | 9 +- host/rootfs/image/usr/bin/run-appimage | 5 +- host/rootfs/image/usr/bin/run-flatpak | 4 +- host/rootfs/image/usr/bin/run-vmm | 2 + host/rootfs/image/usr/bin/vm-import | 2 +- host/rootfs/image/usr/bin/vm-service-run | 34 ++ img/app/Makefile | 23 +- img/app/default.nix | 1 + img/app/file-list.mk | 2 + lib/targets.mk | 30 ++ pkgs/default.nix | 1 + release/live/Makefile | 12 +- release/live/default.nix | 1 + scripts/genfiles.awk | 13 +- tools/cgroup-setup/Cargo.lock | 67 ++++ tools/cgroup-setup/Cargo.lock.license | 2 + tools/cgroup-setup/Cargo.toml | 11 + tools/cgroup-setup/default.nix | 18 + tools/cgroup-setup/src/cgroup.rs | 203 +++++++++++ tools/cgroup-setup/src/main.rs | 406 +++++++++++++++++++++ vm/sys/net/Makefile | 19 +- vm/sys/net/default.nix | 1 + vm/sys/net/file-list.mk | 2 + 57 files changed, 979 insertions(+), 108 deletions(-) --- base-commit: 89f8c9238616b43e48b21e2eade41e061b006cd8 change-id: 20260528-cgroups-d609e270e649 -- Sincerely, Demi Marie Obenour (she/her/hers)