QEMU doesn’t understand XML. I’m guessing your XML is in libvirt’s Domain XML. Porting it isn’t trivial, but you may want to have a look at the hpet bool of the machine definition, the hv-time of the cpu definition and other so-called Hyper-V enlightenments. This is outside of my expertise, but that’s the rough mapping I found.
Although I’m wondering why you want that, as we already have clock logic dedicated to Windows guests in our QEMU driver logic.
I found the second culprit: incus uses virtio-scsi instead of virtio-blk which causes the guest to constantly poll. This is the remaining 2-4% of CPU usage. I managed to force it by patching incus and it did fall to 0% (like proxmox/cockpit and libvirt do) instead of the 2-4% that we get after disabling hpet.
Unfortunately in another thread @stgraber mentioned that incus would stick with scsi because it is better supported by guests.
This is unfortunate but understandable. Though a way to override it would be nice (I couldn’t find one without patching incus itself).
In summary:
Default incus: 20% idle CPU usage
Default incus with raw.qemu override for machine hpet=off: 2-4% idle CPU usage
Patched incus with hpet by default, and virtio-blk: 0% idle CPU usage
Thank you that will definitely be useful to me! Also this is embarrassing and I’m sorry for invoking you unnecessarily: I was coming back to stealth edit my previous comment because I was wrong. I had changed two things at once, stupidly.
Removing ‘[device “qemu_gpu”]’ through raw.qemu.conf is what actually brought idle CPU usage down to zero. Libvirt has the exact same device definition of virtio-vga and yet achieves 0% idle so it might be something related to the gpu but not the gpu itself.
SPICE, perhaps? Libvirt uses VNC by default instead. That’s about all I can see. Or perhaps it’s a kernel config difference (in the guest).
I couldn’t find a way to disable SPICE to test, so I will patch it out of incus and try tomorrow. I’ve seen that 7.1 added feature detection for it so possibly I could remove support from my system and incus would simply not try to use it?
Edit:
This is the magic line for nearly 0% idling of guest, it has to be done for each vm container: incus config set <vm-name> raw.qemu='-machine hpet=off' raw.qemu.conf='[device "qemu_gpu"]'