VM input lag driving me batty


Recommended Posts

 Hey all! I have an issue with input lag. I have what I'd guesstimate is about 200 - 300 ms of input lag - enough where if I zip my mouse left to right, when the mouse hits the right side of the mousepad, the cursor is still only halfway from its starting point. I understand a certain amount of input lag is normal in any system but this is just nuts. I've compared it to my laptop, while using the same hardware, and the lag isn't even noticeable. This goes for any input type: keyboard, mouse, or controller, wireless or wired.

 

So far, I've tried:

 

Unpinning CPU 0 as a tribute to Unraid's processing needs.

Moving input devices to different USB controllers

Booting my VM with and without its vBIOS

Changing the USB controller setting from qemu to nec

Challenging the input lag to a duel - it did not deign to respond

 

Any help would be appreciated!

 

I'm running 6.8.0. Here's my system hardware and VM XML:

 

M/B: ASUSTeK COMPUTER INC. MAXIMUS VIII HERO Version Rev 1.xx - s/n: 151158051401424

BIOS: American Megatrends Inc. Version 3802. Dated: 03/15/2018

CPU: Intel® Core™ i5-6600K CPU @ 3.50GHz

GPU: Nvidia GeForce 1660 Ti

Memory: 16 GiB DDR4

 

 

<?xml version='1.0' encoding='UTF-8'?>
<domain type='kvm'>
  <name>Living_Room</name>
  <uuid>be85e0a5-387f-b6a8-6b12-3487a11bd7f9</uuid>
  <metadata>
    <vmtemplate xmlns="unraid" name="Windows 10" icon="windows.png" os="windows10"/>
  </metadata>
  <memory unit='KiB'>13107200</memory>
  <currentMemory unit='KiB'>13107200</currentMemory>
  <memoryBacking>
    <nosharepages/>
  </memoryBacking>
  <vcpu placement='static'>4</vcpu>
  <cputune>
    <vcpupin vcpu='0' cpuset='0'/>
    <vcpupin vcpu='1' cpuset='1'/>
    <vcpupin vcpu='2' cpuset='2'/>
    <vcpupin vcpu='3' cpuset='3'/>
  </cputune>
  <os>
    <type arch='x86_64' machine='pc-i440fx-4.1'>hvm</type>
    <loader readonly='yes' type='pflash'>/usr/share/qemu/ovmf-x64/OVMF_CODE-pure-efi.fd</loader>
    <nvram>/etc/libvirt/qemu/nvram/be85e0a5-387f-b6a8-6b12-3487a11bd7f9_VARS-pure-efi.fd</nvram>
  </os>
  <features>
    <acpi/>
    <apic/>
    <hyperv>
      <relaxed state='on'/>
      <vapic state='on'/>
      <spinlocks state='on' retries='8191'/>
      <vendor_id state='on' value='none'/>
    </hyperv>
  </features>
  <cpu mode='host-passthrough' check='none'>
    <topology sockets='1' cores='4' threads='1'/>
  </cpu>
  <clock offset='localtime'>
    <timer name='hypervclock' present='yes'/>
    <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='disk'>
      <driver name='qemu' type='raw' cache='writeback'/>
      <source file='/mnt/user/domains/Living_Room/vdisk1.img'/>
      <target dev='hdc' bus='virtio'/>
      <boot order='1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </disk>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='writeback'/>
      <source file='/mnt/user/domains/Living_Room/vdisk2.img'/>
      <target dev='hdd' bus='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </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='0x00' slot='0x03' function='0x0'/>
    </controller>
    <controller type='pci' index='0' model='pci-root'/>
    <interface type='bridge'>
      <mac address='52:54:00:21:54:3d'/>
      <source bridge='br0'/>
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' 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='1'/>
    </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='0x01' slot='0x00' function='0x0'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x01' slot='0x00' function='0x1'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
    </hostdev>
    <memballoon model='none'/>
  </devices>
</domain>

 

catpanzer-diagnostics-20200117-1617.zip

Edited by SoleInvictus
Attached diagnostic info
Link to comment
1 hour ago, SoleInvictus said:

I'm kind of disappointed, I heard unRAID had a stellar support community. 

Be patient. Your question is about specific hardware, hopefully somebody else is using the same and can give advice.

 

Remember: everybody here on the forum are users, like you, helping each other.

 

Link to comment
23 hours ago, bonienl said:

Be patient. Your question is about specific hardware, hopefully somebody else is using the same and can give advice.

 

Remember: everybody here on the forum are users, like you, helping each other.

 

I apologize. I had a rough day, was a little frustrated coming home and seeing that my second question to the forum would also likely yield no responses, and had a tongue loosened from a little too much whiskey. As you said, it's users helping users. No one is paid to do any of this, there are no expectations of participation. If I'm frustrated with so many forum questions remaining similarly unanswered, the best thing I can do is become an expert myself and start answering questions for others.

 

I spent most of last night and a chunk of this morning figuring out my problem. For anyone having similar issues, the only way I can fix the input latency issue is:

 

  • Use SeaBIOS and Q35 for my VM. For some reason, my VMs will only boot with OVMF if I use i440fx.
  • I absolutely, positively cannot run anything at 3840x2160 (at any refresh rate), only 1920x1080 at most. I had originally set the desktop resolution to 3840x2160@60hz and games set similarly. I tried setting games alone at 1920x1080 but still experienced input latency. For whatever reason, if the desktop is set to 3840x2160, any programs, no matter their set resolution or refresh rate, will also experience input lag. This issue wasn't present before unRAID, so it appears to be related to using a VM.

I hope someone else finds this to be of use!

Edited by SoleInvictus
Words are hard.
Link to comment
  • 7 months later...
2 minutes ago, BoltActionBacon said:

FML....

It takes about a minute or two, then you're up and running again with your existing OS install and no data lost.

 

If that's "FML" worthy, Unraid probably isn't for you. It's not Windows 10, it requires occasional maintenance and troubleshooting.

Edited by SoleInvictus
Link to comment
  • 2 weeks later...

I too have a 6600k and bought a used 1050TI for GPU passthrough, connected to a 4K Qled through my AV receiver. I faced this issue as well, and at first would just enable MSI using MSI Util V3 for both GPU and Audio, and the extreme lag would get fixed. I noticed GPU usage was 90%+ before I enabled MSI.

 

I knew it was an OS issue because it all ran smoothly when I tried an Ubuntu VM.

 

Today I tried setting up the GPU and it's Audio in the same slot and the stutter was gone even without setting MSI mode, though I still set it up. Looking at your XML, I think your GPU is in bus 1. So to set the audio and graphics in the same bus you would have to edit your XML to this:

    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0' multifunction='on'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x01' slot='0x00' function='0x1'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x1'/>
    </hostdev>

Note the changes - multifunction is set, and both GPU and audio (assuming they were in bus 1 in the host) are now in slot 06 in the guest OS.

 

I saw this post while searching for correct binning settings since I get lags during media play while transferring huge files to my server. I even purchased an NVME to dedicate to the OS since I was noticing huge storage latency. That helped a lot, but now I still have stutters during huge file transfers

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.