Another glitchy audio / video issue with Win 8.1 VM


whophil

Recommended Posts

I, like many others, have problems with glitchy (demon) audio in my Windows 8 VM. This affects video playback occasionally and gaming often.

 

Hardware:

  • CPU: AMD A8-5500
  • Motherboard: Asrock FM2A78M-ITX+
  • GPU: Nvidia GTX 950

 

VM:

  • Machine: i440fx-2.3
  • BIOS: OVMF
  • Hyper-V disabled
  • USB controller passthrough via PCI

 

 

Things I've Tried:

 

None of these fix the problem, although I think some improvements were seen when enabling MSI. I am somewhat surprised that using a USB soundcard didn't fix the problem -- does this indicate that high DPC latency is caused by something other than the GTX 950 audio? Using USB sound is non-ideal for me, since audio and video both go direct to my TV via HDMI.

 

Are there any other ideas out there?

 

My VM XML is here:

<domain type='kvm'>
  <name>Win8-HTPC-OVMF</name>
  <uuid>a2c7ea78-f49a-ef5b-6b16-521d098d40c9</uuid>
  <metadata>
    <vmtemplate name="Custom" icon="windows.png" os="windows"/>
  </metadata>
  <memory unit='KiB'>8388608</memory>
  <currentMemory unit='KiB'>8388608</currentMemory>
  <memoryBacking>
    <nosharepages/>
    <locked/>
  </memoryBacking>
  <vcpu placement='static'>3</vcpu>
  <cputune>
    <vcpupin vcpu='0' cpuset='1'/>
    <vcpupin vcpu='1' cpuset='2'/>
    <vcpupin vcpu='2' cpuset='3'/>
  </cputune>
  <resource>
    <partition>/machine</partition>
  </resource>
  <os>
    <type arch='x86_64' machine='pc-i440fx-2.3'>hvm</type>
    <loader type='pflash'>/usr/share/qemu/ovmf-x64/OVMF-pure-efi.fd</loader>
  </os>
  <features>
    <acpi/>
    <apic/>
    <hap/>
  </features>
  <cpu mode='host-passthrough'>
    <topology sockets='1' cores='3' threads='1'/>
  </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/bin/qemu-system-x86_64</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='unsafe'/>
      <source file='/mnt/user/VM-test/Win8-HTPC-OVMF/vdisk1.img'/>
      <target dev='hdc' bus='virtio'/>
      <boot order='1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </disk>
    <controller type='usb' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
    </controller>
    <controller type='pci' index='0' model='pci-root'/>
    <controller type='virtio-serial' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </controller>
    <interface type='bridge'>
      <mac address='00:16:3e:51:20:4c'/>
      <source bridge='br0'/>
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </interface>
    <serial type='pty'>
      <target port='0'/>
    </serial>
    <console type='pty'>
      <target type='serial' port='0'/>
    </console>
    <channel type='unix'>
      <source mode='bind' path='/var/lib/libvirt/qemu/channel/target/Win8-HTPC-OVMF.org.qemu.guest_agent.0'/>
      <target type='virtio' name='org.qemu.guest_agent.0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
    <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='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>
      <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='0x00' slot='0x12' function='0x0'/>
      </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='0x00' slot='0x12' function='0x2'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x00' slot='0x13' function='0x0'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x00' slot='0x13' function='0x2'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0b' function='0x0'/>
    </hostdev>
    <memballoon model='virtio'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </memballoon>
  </devices>
</domain>

 

Link to comment

So is the audio issue specifically with the USB headset?  The MSI audio fix for the NVIDIA GPUs won't do anything to help USB headsets (that's only for when the audio is going through the GPU like through HDMI, DVI, DisplayPort, etc.).  If you're passing through the entire USB controller to the VM and the USB headset is attached to that controller, that's kind of odd as well.  What happens if you don't use the USB headset?

Link to comment

Sorry if it wasn't clear. I originally had glitchy audio when using the HDMI audio of the GTX 950. I then tried to fix it by using a USB sound card, and the problem persisted.

 

Ok, so to be clear, if you completely detach the USB sound card and use the HDMI audio with the MSI fix in place, you still get glitchy audio?  How were you getting audio through HDMI to speakers (through a stereo jack on your monitor or something)?  Is the audio glitchiness pretty much the same experience with both HDMI and the USB sound card?  Like does it sound the same way?  If so, it sounds a heck of a lot more like a problem inside the guest as opposed to DPC latency.

 

What about passing through the audio on your motherboard (if any)?  Same affect?

Link to comment

If I remove the USB sound card and use only the GTX 950 audio, the audio glitches.

 

When I was using the USB sound card, I was connecting it via a 3.5mm --> RCA adapter to my TV's audio input (the TV allows for me to choose audio sources for the HDMI input). I had the same audio glitches. I didn't do extensive testing with the USB sound card, since it also had a ton of noise (not sure if this was a ground loop problem or something else).

 

In short:

- GTX 950 HDMI audio passed through, USB sound card REMOVED --> glitches

- GTX 950 HDMI audio REMOVED, USB sound card --> glitches

 

I have not tried passing through the motherboard audio, but I can try at some point during the weekend.

[EDIT: It looks like I can't pass through the motherboard audio; it's in a very populated IOMMU group and I have currently not enabled pcie_acs_override]

 

However, I'd really like to get the GTX 950 HDMI audio working correctly. It seems some people have reported success with q35 machines; I wonder if this is at all related.

Link to comment

If I remove the USB sound card and use only the GTX 950 audio, the audio glitches.

 

When I was using the USB sound card, I was connecting it via a 3.5mm --> RCA adapter to my TV's audio input (the TV allows for me to choose audio sources for the HDMI input). I had the same audio glitches. I didn't do extensive testing with the USB sound card, since it also had a ton of noise (not sure if this was a ground loop problem or something else).

 

In short:

- GTX 950 HDMI audio passed through, USB sound card REMOVED --> glitches

- GTX 950 HDMI audio REMOVED, USB sound card --> glitches

 

I have not tried passing through the motherboard audio, but I can try at some point during the weekend.

[EDIT: It looks like I can't pass through the motherboard audio; it's in a very populated IOMMU group and I have currently not enabled pcie_acs_override]

 

However, I'd really like to get the GTX 950 HDMI audio working correctly. It seems some people have reported success with q35 machines; I wonder if this is at all related.

 

The only thing worth noting is that if you have already activated your copy of Windows, changing to Q35 will probably prompt for a reactivation because it will be like you switched the motherboards.  So if you haven't activated yet, it's worth a shot just toggling to Q35 to see if that helps.  If you have, I probably wouldn't do that just yet.  Double check the MSI setup in Windows Device manager and also check your audio settings in Windows itself (see if they are set to headphones mode or anything funky there).

 

I've honestly never seen someone continue to have issues with HDMI audio after applying the MSI audio fix.

Link to comment

I checked the sound settings in Windows, and nothing seems to be out of the ordinary -- everything is set to stereo output, which matches my TV.

 

I also tried switching to Q35 -- after some fiddling with QEMU commands to get the GTX 950 and its audio device recognized correctly, I can conclude that the "demon audio" is still there, and maybe even worse. Also, overall system performance is worse (including cursor lag when using wireless USB mouse).

 

With the Q35 machine, I did confirm that MSI is again enabled (here is the output of lspci -v)

01:00.0 VGA compatible controller: NVIDIA Corporation Device 1402 (rev a1) (prog-if 00 [VGA controller])
Subsystem: Gigabyte Technology Co., Ltd Device 36c3
Flags: bus master, fast devsel, latency 0, IRQ 39
Memory at fd000000 (32-bit, non-prefetchable) [size=16M]
Memory at c0000000 (64-bit, prefetchable) [size=256M]
Memory at d0000000 (64-bit, prefetchable) [size=32M]
I/O ports at e000 [size=128]
Expansion ROM at fe000000 [disabled] [size=512K]
Capabilities: [60] Power Management version 3
Capabilities: [68] MSI: Enable+ Count=1/1 Maskable- 64bit+
Capabilities: [78] Express Legacy Endpoint, MSI 00
Capabilities: [100] Virtual Channel
Capabilities: [258] #1e
Capabilities: [128] Power Budgeting <?>
Capabilities: [420] Advanced Error Reporting
Capabilities: [600] Vendor Specific Information: ID=0001 Rev=1 Len=024 <?>
Kernel driver in use: vfio-pci

01:00.1 Audio device: NVIDIA Corporation Device 0fba (rev a1)
Subsystem: Gigabyte Technology Co., Ltd Device 36c3
Flags: bus master, fast devsel, latency 0, IRQ 40
Memory at fe080000 (32-bit, non-prefetchable) [size=16K]
Capabilities: [60] Power Management version 3
Capabilities: [68] MSI: Enable+ Count=1/1 Maskable- 64bit+
Capabilities: [78] Express Endpoint, MSI 00
Capabilities: [100] Advanced Error Reporting
Kernel driver in use: vfio-pci

03:00.0 Ethernet controller: Qualcomm Atheros QCA8171 Gigabit Ethernet (rev 10)
Subsystem: ASRock Incorporation Device 10a1
Flags: bus master, fast devsel, latency 0, IRQ 38
Memory at fe100000 (64-bit, non-prefetchable) [size=256K]
I/O ports at d000 [size=128]
Capabilities: [40] Power Management version 3
Capabilities: [58] Express Endpoint, MSI 00
Capabilities: [c0] MSI: Enable+ Count=1/16 Maskable+ 64bit+
Capabilities: [d8] MSI-X: Enable- Count=16 Masked-
Capabilities: [100] Advanced Error Reporting
Capabilities: [180] Device Serial Number 00-00-00-00-00-00-00-00
Kernel driver in use: alx
Kernel modules: alx

 

Attached below is the XML file for the Q35 machine.

 

<domain type='kvm' id='11' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
  <name>Win8-HTPC-OVMF</name>
  <uuid>a2c7ea78-f49a-ef5b-6b16-521d098d40c9</uuid>
  <metadata>
    <vmtemplate name="Custom" icon="windows.png" os="windows"/>
  </metadata>
  <memory unit='KiB'>8388608</memory>
  <currentMemory unit='KiB'>8388608</currentMemory>
  <memoryBacking>
    <nosharepages/>
    <locked/>
  </memoryBacking>
  <vcpu placement='static'>3</vcpu>
  <cputune>
    <vcpupin vcpu='0' cpuset='1'/>
    <vcpupin vcpu='1' cpuset='2'/>
    <vcpupin vcpu='2' cpuset='3'/>
  </cputune>
  <resource>
    <partition>/machine</partition>
  </resource>
  <os>
    <type arch='x86_64' machine='pc-q35-2.3'>hvm</type>
    <loader type='pflash'>/usr/share/qemu/ovmf-x64/OVMF-pure-efi.fd</loader>
  </os>
  <features>
    <acpi/>
    <apic/>
  </features>
  <cpu mode='host-passthrough'>
    <topology sockets='1' cores='3' threads='1'/>
  </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/bin/qemu-system-x86_64</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='unsafe'/>
      <source file='/mnt/user/VM-test/Win8-HTPC-OVMF/vdisk1.img'/>
      <backingStore/>
      <target dev='hdc' bus='virtio'/>
      <boot order='1'/>
      <alias name='virtio-disk2'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x04' function='0x0'/>
    </disk>
    <controller type='usb' index='0' model='ich9-ehci1'>
      <alias name='usb'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x02' function='0x7'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <alias name='usb'/>
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x02' function='0x0' multifunction='on'/>
    </controller>
    <controller type='sata' index='0'>
      <alias name='ide'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
    </controller>
    <controller type='pci' index='0' model='pcie-root'>
      <alias name='pcie.0'/>
    </controller>
    <controller type='pci' index='1' model='dmi-to-pci-bridge'>
      <alias name='pci.1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1e' function='0x0'/>
    </controller>
    <controller type='pci' index='2' model='pci-bridge'>
      <alias name='pci.2'/>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x01' function='0x0'/>
    </controller>
    <controller type='virtio-serial' index='0'>
      <alias name='virtio-serial0'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x03' function='0x0'/>
    </controller>
    <interface type='bridge'>
      <mac address='00:16:3e:51:20:4c'/>
      <source bridge='br0'/>
      <target dev='vnet1'/>
      <model type='virtio'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x01' function='0x0'/>
    </interface>
    <serial type='pty'>
      <source path='/dev/pts/1'/>
      <target port='0'/>
      <alias name='serial0'/>
    </serial>
    <console type='pty' tty='/dev/pts/1'>
      <source path='/dev/pts/1'/>
      <target type='serial' port='0'/>
      <alias name='serial0'/>
    </console>
    <channel type='unix'>
      <source mode='bind' path='/var/lib/libvirt/qemu/channel/target/Win8-HTPC-OVMF.org.qemu.guest_agent.0'/>
      <target type='virtio' name='org.qemu.guest_agent.0' state='disconnected'/>
      <alias name='channel0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x00' slot='0x12' function='0x0'/>
      </source>
      <alias name='hostdev0'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x08' function='0x0'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x00' slot='0x12' function='0x2'/>
      </source>
      <alias name='hostdev1'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x09' function='0x0'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x00' slot='0x13' function='0x0'/>
      </source>
      <alias name='hostdev2'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x0a' function='0x0'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x00' slot='0x13' function='0x2'/>
      </source>
      <alias name='hostdev3'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x0b' function='0x0'/>
    </hostdev>
    <memballoon model='virtio'>
      <alias name='balloon0'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x07' function='0x0'/>
    </memballoon>
  </devices>
  <qemu:commandline>
    <qemu:arg value='-device'/>
    <qemu:arg value='ioh3420,bus=pcie.0,addr=1c.0,multifunction=on,port=1,chassis=1,id=root.1'/>
    <qemu:arg value='-device'/>
    <qemu:arg value='vfio-pci,host=01:00.0,bus=root.1,addr=00.0,multifunction=on,x-vga=on'/>
    <qemu:arg value='-device'/>
    <qemu:arg value='vfio-pci,host=01:00.1,bus=root.1,addr=00.1'/>
  </qemu:commandline>
</domain>

 

Link to comment

The disk image is on the cache drive, which is a SSD.

 

There is one other Ubuntu Server VM running on the system which runs my Plex server, but this VM is mostly idle during testing.

 

When I go to the advanced settings of my audio playback device, 16bit 44000 HZ (DVD Quality) is already the default settings.

 

Also, the two options "Allow applications to take exclusive control of this device" and "Give exclusive mode applications priority" are both checked by default.

 

Link to comment

The disk image is on the cache drive, which is a SSD.

 

There is one other Ubuntu Server VM running on the system which runs my Plex server, but this VM is mostly idle during testing.

 

When I go to the advanced settings of my audio playback device, 16bit 44000 HZ (DVD Quality) is already the default settings.

 

Also, the two options "Allow applications to take exclusive control of this device" and "Give exclusive mode applications priority" are both checked by default.

Shut down the server. Run nothing but the VM and let us know if your problem persists. We need to figure out whether this is hardware or configuration issue.

Link to comment
  • 1 month later...

I did some testing and found that the audio glitches were (at least in part) related to another VM I had running which was sharing allocated CPUs. I had assigned cores 1,2,3 to the Windows VM and cores 0,1 to the other (Linux VM) -- note the duplicate assignment of core 1. When I increased CPU load on the Linux VM, my Windows VM would produce audio glitches.

 

Here's my current setup, which hasn't produced an audio glitch in awhile:

Windows VM -- Cores 2,3 (with isolcpus=2,3 in syslinux.cfg)

Linux VM -- Cores 0,1

 

Unfortunately, I can only run my Windows VM with two CPUs (even when the Linux VM is idle or not running, due to isolcpus). But that is enough for my current needs. Hope this is helpful.

Link to comment
  • 4 weeks later...

I've had similar issues with sound static and latency. I can't really pinpoint the issue and I have separate core assignments for the two Win 10 vm's. I have mostly resolved it by running both of the vm's audio through oboard audio and the other on a sound card. Also if I run them using display port I get audio issues even when  I am directly connected via 3.5mm. I have disabled other audio devices inside windows in case display port passing audio is interfering somehow. I imagine that there is some resource related to audio that is trying to use the cpu and introducing latency. The usb audio WAS working at some point but then stopped, without me making any updates to unraid, settings, or anything else. I upgraded to 6.2 beta unraid but it did not change anything, though I like the build.

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.