Audio Lag and Stutter


Recommended Posts

HI All,

I do have audio lag when I log in to windows, it will recolonize the usbs and the audio then stutters.
Also when i am playing a YT video it will start to get out of sync with the video after like 10 15 minutes. After page refresh its in syn again.
Im using my gtx 980 ti audio chip with HDMI to forward the sound to my monitor, from there a 3.5 mm jack goes into the audio speakers (my system is unable to separate the on board audio to get it running in a vm)

 

What i tried:
Enabling MSI, both GPU and Sound Chip are MSI + Enabled after some registry hacks.

Playing around with cpuset pins.

 

XML:
 

<domain type='kvm' id='2'>
  <name>Windows 10 x64</name>
  <uuid>b2e40086-3bfc-2e1d-63c2-e02b2561f767</uuid>
  <metadata>
    <vmtemplate xmlns="unraid" name="Windows 10" icon="windows.png" os="windows10"/>
  </metadata>
  <memory unit='KiB'>16777216</memory>
  <currentMemory unit='KiB'>16777216</currentMemory>
  <memoryBacking>
    <nosharepages/>
  </memoryBacking>
  <vcpu placement='static'>6</vcpu>
  <cputune>
    <vcpupin vcpu='0' cpuset='1'/>
    <vcpupin vcpu='1' cpuset='2'/>
    <vcpupin vcpu='2' cpuset='3'/>
    <vcpupin vcpu='3' cpuset='5'/>
    <vcpupin vcpu='4' cpuset='6'/>
    <vcpupin vcpu='5' cpuset='7'/>
    <emulatorpin cpuset='0,4'/>
  </cputune>
  <resource>
    <partition>/machine</partition>
  </resource>
  <os>
    <type arch='x86_64' machine='pc-i440fx-2.7'>hvm</type>
    <loader readonly='yes' type='pflash'>/usr/share/qemu/ovmf-x64/OVMF_CODE-pure-efi.fd</loader>
    <nvram>/etc/libvirt/qemu/nvram/b2e40086-3bfc-2e1d-63c2-e02b2561f767_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'>
    <topology sockets='1' cores='3' threads='2'/>
  </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/Windows 10 x64/vdisk1.img'/>
      <backingStore/>
      <target dev='hdc' bus='virtio'/>
      <boot order='1'/>
      <alias name='virtio-disk2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </disk>
    <controller type='usb' index='0' model='nec-xhci'>
      <alias name='usb'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </controller>
    <controller type='pci' index='0' model='pci-root'>
      <alias name='pci.0'/>
    </controller>
    <controller type='virtio-serial' index='0'>
      <alias name='virtio-serial0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </controller>
    <interface type='bridge'>
      <mac address='52:54:00:f3:6b:28'/>
      <source bridge='br0'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </interface>
    <serial type='pty'>
      <source path='/dev/pts/0'/>
      <target port='0'/>
      <alias name='serial0'/>
    </serial>
    <console type='pty' tty='/dev/pts/0'>
      <source path='/dev/pts/0'/>
      <target type='serial' port='0'/>
      <alias name='serial0'/>
    </console>
    <channel type='unix'>
      <source mode='bind' path='/var/lib/libvirt/qemu/channel/target/domain-2-Windows 10 x64/org.qemu.guest_agent.0'/>
      <target type='virtio' name='org.qemu.guest_agent.0' state='connected'/>
      <alias name='channel0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
    <input type='mouse' bus='ps2'>
      <alias name='input0'/>
    </input>
    <input type='keyboard' bus='ps2'>
      <alias name='input1'/>
    </input>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
      </source>
      <alias name='hostdev0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x01' slot='0x00' function='0x1'/>
      </source>
      <alias name='hostdev1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </hostdev>
    <hostdev mode='subsystem' type='usb' managed='no'>
      <source>
        <vendor id='0x046d'/>
        <product id='0x08c5'/>
        <address bus='5' device='7'/>
      </source>
      <alias name='hostdev2'/>
      <address type='usb' bus='0' port='2'/>
    </hostdev>
    <hostdev mode='subsystem' type='usb' managed='no'>
      <source>
        <vendor id='0x046d'/>
        <product id='0xc332'/>
        <address bus='1' device='3'/>
      </source>
      <alias name='hostdev3'/>
      <address type='usb' bus='0' port='3'/>
    </hostdev>
    <hostdev mode='subsystem' type='usb' managed='no'>
      <source>
        <vendor id='0x0b05'/>
        <product id='0x17cb'/>
        <address bus='5' device='2'/>
      </source>
      <alias name='hostdev4'/>
      <address type='usb' bus='0' port='4'/>
    </hostdev>
    <hostdev mode='subsystem' type='usb' managed='no'>
      <source>
        <vendor id='0x10f5'/>
        <product id='0x0293'/>
        <address bus='5' device='5'/>
      </source>
      <alias name='hostdev5'/>
      <address type='usb' bus='0' port='1.1'/>
    </hostdev>
    <hostdev mode='subsystem' type='usb' managed='no'>
      <source>
        <vendor id='0x147e'/>
        <product id='0x2016'/>
        <address bus='5' device='6'/>
      </source>
      <alias name='hostdev6'/>
      <address type='usb' bus='0' port='1.2'/>
    </hostdev>
    <hostdev mode='subsystem' type='usb' managed='no'>
      <source>
        <vendor id='0x1770'/>
        <product id='0xef35'/>
        <address bus='1' device='4'/>
      </source>
      <alias name='hostdev7'/>
      <address type='usb' bus='0' port='1.3'/>
    </hostdev>
    <hostdev mode='subsystem' type='usb' managed='no'>
      <source>
        <vendor id='0x1b1c'/>
        <product id='0x1b20'/>
        <address bus='5' device='4'/>
      </source>
      <alias name='hostdev8'/>
      <address type='usb' bus='0' port='1.4'/>
    </hostdev>
    <hub type='usb'>
      <alias name='hub0'/>
      <address type='usb' bus='0' port='1'/>
    </hub>
    <memballoon model='virtio'>
      <alias name='balloon0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </memballoon>
  </devices>
  <seclabel type='none' model='none'/>
  <seclabel type='dynamic' model='dac' relabel='yes'>
    <label>+0:+100</label>
    <imagelabel>+0:+100</imagelabel>
  </seclabel>
</domain>



 

Link to comment
4 hours ago, gridrunner said:

Try using this for the msi interrupts (no need for reg hacks) Run it as administrator  https://www.dropbox.com/s/gymaipg6vprd508/MSI_util.zip?dl=0

 

It looks like you are not passing through a usb controller. Without which you can not  hotswap usb devices. I would recommend you passing through a usb controller rather than individual devices.

While you were writing this i finally got my first usb controller working in vm, full pass trough. Swap usb does work now and the sound stutter is gone at boot. Will test the delay and gaming later on this week. Anyway thank you! you were point me in the correct direction

 

The MSI tools reports me this but I am not sure what to select, and what it does

 

 

1.PNG

Edited by Thomas van Dalen
Link to comment
16 hours ago, Thomas van Dalen said:

While you were writing this i finally got my first usb controller working in vm, full pass trough. Swap usb does work now and the sound stutter is gone at boot. Will test the delay and gaming later on this week. Anyway thank you! you were point me in the correct direction

 

The MSI tools reports me this but I am not sure what to select, and what it does

 

 

1.PNG

 

Anywhere you see a tick the msi interupts are enabled. 

So tick anything that mentions your sound or graphics card.

You will notice your 980ti has 2 boxes not ticked tick those and the 2 for the high definition audio device then click apply.

leave everything else as it already is.

Edited by gridrunner
Link to comment
On 9/5/2017 at 5:55 PM, gridrunner said:

 

Anywhere you see a tick the msi interrupts are enabled. 

So tick anything that mentions your sound or graphics card.

 

Well, i tested it and still have the audio lag. Could you help me further? I also bought and Asus pcie card but that is not working, my iommu are listed below.

IOMMU group 14 is the new card. But i cant get the vm started with that that card on a passtrough. Keep getting a warning.

 vfio: Error: Failed to setup INTx fd: Device or resource busy

I tried to put it in syslinx.cfg  
append vfio-pci.ids=1912:0014,1b21:1242,14e4:43a0,13f6:8788 initrd=/bzroot,/bzroot-gui (19:12 is usb controller pcie card and 1b21 is a usb 3.1 onboard usb port) 

I also tried it with the pcie bridge, but nothing. still getting the error. Even when i disable the usb controllers pcie and usb port 3.1 on the vm it wount boot.

 

Furthermore everything else works ok now. Im using unRAID for two weeks and love it, just need to learn the hypervisor as thing can get tricky with correct settings. Last step is to get audio sync working but dont wanne spend more money on my rig.

 
log.pngLog
 

PCI Devices and IOMMU Groups

IOMMU group 0
	[8086:191f] 00:00.0 Host bridge: Intel Corporation Skylake Host Bridge/DRAM Registers (rev 07)
IOMMU group 1
	[8086:1901] 00:01.0 PCI bridge: Intel Corporation Skylake PCIe Controller (x16) (rev 07)
	[10de:17c8] 01:00.0 VGA compatible controller: NVIDIA Corporation GM200 [GeForce GTX 980 Ti] (rev a1)
	[10de:0fb0] 01:00.1 Audio device: NVIDIA Corporation GM200 High Definition Audio (rev a1)
IOMMU group 2
	[8086:1912] 00:02.0 VGA compatible controller: Intel Corporation HD Graphics 530 (rev 06)
IOMMU group 3
	[8086:a12f] 00:14.0 USB controller: Intel Corporation Sunrise Point-H USB 3.0 xHCI Controller (rev 31)
IOMMU group 4
	[8086:a13a] 00:16.0 Communication controller: Intel Corporation Sunrise Point-H CSME HECI #1 (rev 31)
IOMMU group 5
	[8086:a102] 00:17.0 SATA controller: Intel Corporation Sunrise Point-H SATA controller [AHCI mode] (rev 31)
IOMMU group 6
	[8086:a167] 00:1b.0 PCI bridge: Intel Corporation Sunrise Point-H PCI Root Port #17 (rev f1)
IOMMU group 7
	[8086:a169] 00:1b.2 PCI bridge: Intel Corporation Sunrise Point-H PCI Root Port #19 (rev f1)
IOMMU group 8
	[8086:a16a] 00:1b.3 PCI bridge: Intel Corporation Sunrise Point-H PCI Root Port #20 (rev f1)
IOMMU group 9
	[8086:a110] 00:1c.0 PCI bridge: Intel Corporation Sunrise Point-H PCI Express Root Port #1 (rev f1)
IOMMU group 10
	[8086:a112] 00:1c.2 PCI bridge: Intel Corporation Sunrise Point-H PCI Express Root Port #3 (rev f1)
IOMMU group 11
	[8086:a118] 00:1d.0 PCI bridge: Intel Corporation Sunrise Point-H PCI Express Root Port #9 (rev f1)
IOMMU group 12
	[8086:a145] 00:1f.0 ISA bridge: Intel Corporation Sunrise Point-H LPC Controller (rev 31)
	[8086:a121] 00:1f.2 Memory controller: Intel Corporation Sunrise Point-H PMC (rev 31)
	[8086:a123] 00:1f.4 SMBus: Intel Corporation Sunrise Point-H SMBus (rev 31)
IOMMU group 13
	[8086:15b8] 00:1f.6 Ethernet controller: Intel Corporation Ethernet Connection (2) I219-V (rev 31)
IOMMU group 14
	[1b21:1080] 03:00.0 PCI bridge: ASMedia Technology Inc. ASM1083/1085 PCIe to PCI Bridge (rev 04)
	[13f6:8788] 04:04.0 Multimedia audio controller: C-Media Electronics Inc CMI8788 [Oxygen HD Audio]
IOMMU group 15
	[14e4:43a0] 05:00.0 Network controller: Broadcom Limited BCM4360 802.11ac Wireless Network Adapter (rev 03)
IOMMU group 16
	[1b21:1242] 06:00.0 USB controller: ASMedia Technology Inc. ASM1142 USB 3.1 Host Controller
IOMMU group 17
	[1912:0014] 07:00.0 USB controller: Renesas Technology Corp. uPD720201 USB 3.0 Host Controller (rev 03)
IOMMU group 18
	[144d:a802] 08:00.0 Non-Volatile memory controller: Samsung Electronics Co Ltd NVMe SSD Controller SM951/PM951 (rev 01)

 

 

Edited by Thomas van Dalen
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.