Severe stuttering/lag in games (Win10 VM)


Go to solution Solved by david279,

Recommended Posts

I just swapped out my GPU (2080 upgraded to a 6900XT) and I'm getting severe stuttering/lagging in games and microstuttering in Win10 (i.e. slight jumpiness moving windows around, etc). I believe I've properly pinned my 2920X TR2 CPU and adjusted my XML for the GPU/HDMI audio properly, but could use some expert feedback. I've scoured the forum for answers, but nothing has seemed to correct the stuttering. I'm a noob with VM's and XML editing - I'd greatly appreciate if someone could take a quick peek and let me know if they see anything obvious that could be causing a conflict.

 

Here's my full XML:

 

<?xml version='1.0' encoding='UTF-8'?>
<domain type='kvm'>
  <name>Windows 10</name>
  <uuid>b9a3b51e-52b7-ad1e-2fd5-0aca043e6897</uuid>
  <metadata>
    <vmtemplate xmlns="unraid" name="Windows 10" icon="windows.png" os="windows10"/>
  </metadata>
  <memory unit='KiB'>20971520</memory>
  <currentMemory unit='KiB'>20971520</currentMemory>
  <memoryBacking>
    <nosharepages/>
  </memoryBacking>
  <vcpu placement='static'>12</vcpu>
  <cputune>
    <vcpupin vcpu='0' cpuset='6'/>
    <vcpupin vcpu='1' cpuset='18'/>
    <vcpupin vcpu='2' cpuset='7'/>
    <vcpupin vcpu='3' cpuset='19'/>
    <vcpupin vcpu='4' cpuset='8'/>
    <vcpupin vcpu='5' cpuset='20'/>
    <vcpupin vcpu='6' cpuset='9'/>
    <vcpupin vcpu='7' cpuset='21'/>
    <vcpupin vcpu='8' cpuset='10'/>
    <vcpupin vcpu='9' cpuset='22'/>
    <vcpupin vcpu='10' cpuset='11'/>
    <vcpupin vcpu='11' cpuset='23'/>
    <emulatorpin cpuset='0,12'/>
  </cputune>
  <os>
    <type arch='x86_64' machine='pc-q35-5.1'>hvm</type>
    <loader readonly='yes' type='pflash'>/usr/share/qemu/ovmf-x64/OVMF_CODE-pure-efi.fd</loader>
    <nvram>/etc/libvirt/qemu/nvram/b9a3b51e-52b7-ad1e-2fd5-0aca043e6897_VARS-pure-efi.fd</nvram>
  </os>
  <features>
    <acpi/>
    <apic/>
  </features>
  <cpu mode='host-passthrough' check='none' migratable='on'>
    <topology sockets='1' dies='1' cores='6' threads='2'/>
    <cache mode='passthrough'/>
    <feature policy='require' name='topoext'/>
  </cpu>
  <clock offset='localtime'>
    <timer name='rtc' tickpolicy='catchup'/>
    <timer name='pit' tickpolicy='delay'/>
    <timer name='hpet' present='no'/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/local/sbin/qemu</emulator>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/mnt/user/isos/virtio-win-0.1.215.iso'/>
      <target dev='hdb' bus='sata'/>
      <readonly/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>
    <disk type='block' device='disk'>
      <driver name='qemu' type='raw' cache='writeback'/>
      <source dev='/dev/disk/by-id/nvme-Samsung_SSD_970_EVO_1TB_S467NX0KB29066F'/>
      <target dev='hdc' bus='sata'/>
      <boot order='1'/>
      <address type='drive' controller='0' bus='0' target='0' unit='2'/>
    </disk>
    <controller type='usb' index='0' model='qemu-xhci' ports='15'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </controller>
    <controller type='virtio-serial' index='0'>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x00' function='0x0'/>
    </controller>
    <controller type='sata' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
    </controller>
    <controller type='pci' index='0' model='pcie-root'/>
    <controller type='pci' index='1' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='1' port='0x10'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0' multifunction='on'/>
    </controller>
    <controller type='pci' index='2' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='2' port='0x11'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x1'/>
    </controller>
    <controller type='pci' index='3' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='3' port='0x12'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x2'/>
    </controller>
    <controller type='pci' index='4' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='4' port='0x13'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x3'/>
    </controller>
    <controller type='pci' index='5' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='5' port='0xc'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x4'/>
    </controller>
    <interface type='bridge'>
      <mac address='52:54:00:91:2b:1a'/>
      <source bridge='br0'/>
      <model type='virtio-net'/>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
    </interface>
    <serial type='pty'>
      <target type='isa-serial' port='0'>
        <model name='isa-serial'/>
      </target>
    </serial>
    <console type='pty'>
      <target type='serial' port='0'/>
    </console>
    <channel type='unix'>
      <target type='virtio' name='org.qemu.guest_agent.0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
    <input type='tablet' bus='usb'>
      <address type='usb' bus='0' port='3'/>
    </input>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x44' slot='0x00' function='0x0'/>
      </source>
      <rom file='/mnt/user/isos/Sapphire.Nitro.SE.6900XT.rom'/>
      <address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0' multifunction='on'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x44' slot='0x00' function='0x1'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x1'/>
    </hostdev>
    <hostdev mode='subsystem' type='usb' managed='no'>
      <source>
        <vendor id='0x046d'/>
        <product id='0xc539'/>
      </source>
      <address type='usb' bus='0' port='1'/>
    </hostdev>
    <hostdev mode='subsystem' type='usb' managed='no'>
      <source>
        <vendor id='0x1b1c'/>
        <product id='0x1b8f'/>
      </source>
      <address type='usb' bus='0' port='2'/>
    </hostdev>
    <memballoon model='none'/>
  </devices>
</domain>

 

Link to comment
1 hour ago, david279 said:

I had a strange issue like this when i ran a gaming VM. It was my mouse and the high polling rate that caused it. 

Interesting... I haven't yet passed through my USB 3 PCI card, but maybe I should try that along with tweaking the mouse settings to see if that fixes the issue.

Link to comment
On 1/17/2022 at 6:18 PM, david279 said:

I had a strange issue like this when i ran a gaming VM. It was my mouse and the high polling rate that caused it. 

Surprisingly, reducing the mouse's polling (report) rate from 1000Hz to 125Hz made the game's fps actually playable (I'm using a Logitech G502 wireless gaming mouse). It still has a noticeable blip/stutter when I move the mouse to look around in-game, but at least we're narrowing down the issue. The weirdest part to me is that I had no issue with this with my prior VM setup with the Nvidia 2080.... I'm scouring the web trying to find a permanent fix for this to do away with as much latency as possible - stumbled onto something about replacing virtio drivers for PS2/USB devices, but more research and tinkering to do.

Edited by BBLV
  • Like 1
Link to comment
21 hours ago, CeeJaySWE said:

I've solved these issues with my GTX970 by enabling MSI(Message signal interrupt) in the register for both video and audio. 

Tried this - no improvement for me, but thank you for the recommendation.

Link to comment
3 hours ago, david279 said:

You may have to pass through a usb controller so you can directly connect the mouse. Something about high polling seems to throw the VMs latency way up. I had it happen with logitech and a roccat mouse. 

Thankfully I have the same Inatek PCIE USB 3 controller that SpaceInvader used in his pass-through YT video, so that's my next step in troubleshooting (just need to find the extra time in the day!). FWIW I'm currently passing the mouse and keyboard through individually by just checking the boxes in the VM Advanced View...

 

Thanks again for the tip that got me moving in the right direction!

Link to comment

So I passed through my PCIE USB controller and am still getting the mouse lag/stuttering that scales with the mouse polling rate on my Logitech G502. Not sure what to tweak next, but this is starting to piss me off..

Link to comment

I swapped my Nvidia 2080 card back in and the mouse polling rate stutter/lag issue disappeared! I just took the AMD 6900XT card back to Microcenter, then bit the bullet and ordered a 3090 card. I'll report back here if the issue is isolated to the AMD card in MY system. Seriously weird issue.....

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.