cpu affinity reset by libvirt / cgroups

When starting my VM, the CPU core affinity of all processes on my archlinux host is reset to all cores. The same happens when the VM stops.

My VM uses cpu pinning, but this didn't happen until a few months ago. I tried to start it with virt-manager and with virsh, both do it this way.

I've been reading about cgroups but it does not tell me that it would ever touch affinity settings.

current libvirt version: 1:7.5.0-1

There is a lot of topics about cpu isolations, core shielding and more for gaming-VMs, but i don't see why normal core affinity should ever reset. Is there a way to find out what causes this? I usually set affinity using taskset. Maybe this is supposed to be a new feature, but i can't find one.


Indeed it was cgroups!

cgroups2 to be more exact. The "bug" was probably introduced, when my distro, Arch Linux, changed cgroups.

"It is possible to explicitly turn off use of a controller, even when mounted, via the /etc/libvirt/qemu.conf configuration file." according to https://libvirt.org/cgroups.html#legacyLayout . But this didn't work at all for me. It just created cpusets using cgroups anyway (i wonder why).

however, the issue is fixed for me, as we can just build kernels without cpusets (or even cgroups at all). sidenote: you can safely do this, all configured core pinnings will persist just fine.

if you have better solutions or insights on how the configuration in libvirt would work, you are still welcome!