Virt-manager / qemu performance issues

Hello, I recently bought a PC meant for regular work (linux) and vm gaming (linux uses the igpu).
The specs are the following:
MB: X670E AORUS PRO X
cpu: AMD Ryzen 9 7950X
gpu: nvidia rtx 4070 ti

I got my iommu groups, I got my windows 10 machine to recognize the card and use it, got rid of the error 43, installed looking glass, tried stable and am now on bleeding. It works, but for some reason quite poorly. Usually, after a fresh host reboot, everything works fine, but quickly the performance degrades, I get worse framerates and stutters.

Any help would be appreciated, I am specially not sure about my cpu config.
qemu xml: <domain type="kvm"> <name>win10</name> <uuid>e225cc3f-863a-4bba-a42f-28bed - Pastebin.com
lscpu output: Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Addr - Pastebin.com
virsh capabilities: <capabilities> <host> <uuid>54825bb4-76ae-490f-a0af-76fcb413d09f</uuid - Pastebin.com
lstopo: https://i.imgur.com/zEG4zUL.png

Perhaps this block is the issue:

  <memoryBacking>
    <source type="memfd"/>
    <access mode="shared"/>
  </memoryBacking>

I’m not sure how memfd works, but shared memory could be a performance issue since the guest’s memory is not reserved and might need to contend with the host system.

I’d try removing that block (or at least not using shared memory) and see if that helps?

How much memory do you have and how much is allocated?

Also, could you try if you have the same issues when plugging the monitor into the guest GPU and not using looking glass. Since you have an iGPU looking glass will also write the frames to RAM, contending for bandwith with other processes.

I recall several years ago it was a known bug that if you had the “ballooning RAM” option enabled for a Windows 10 guest it would cause a memory leak that would degrade and eventually crash the guest OS. I would’ve thought that issue would’ve been fixed by now but maybe not.

Hello, I had a busy couple days but could hop on my pc today.
I can’t remove the memoryBacking section, qemu says Error changing VM configuration: unsupported configuration: virtiofs’ requires shared memory`.
I have 64 gigs and 32 allocated to the VM.
Maybe I should do cpu isolation?

2 things fixed everything:

  1. enabling 16 gigs of permanenr hugepages, no more ingame spikes (checked without looking glass)
  2. disabling picom when running the vm. for some reason the compositor messes with looking glass. once disabled, it’s butter smooth
2 Likes