Kvm allocating a usb headset directly

Hi,

So I have this sound problem with my win10 kvm. I know it’s a common problem but I have problems to really understand all the consequences of this problem.
So I got my usb headset which has been confirmed to me by technical support that the AMP (it’s A40 astro gaming mixamp) is acting as a soundcard, so I add the usb headset as the other devices like keyboard and mouse but apparently for the sound it’s not enough? Because I got cracky noise all the time in the headset.
And from what I fell from that thread is that I need to use the pci-stub, is it correct?

Does someone know why we need pci-stub? does the keyboard and mouse have more latency than the sound?

Do I still need to put the soundcard as ac97 in the vm? Because I can’t get it working apparently, I can’t install the drivers even with signature enforcement off. To which problem is that related to?

Thanks in advance for all the help/explanation you can provide.

not all class compliant sound devices work with all usb controllers for virtualization.

you can

  • patch qemu
  • buy a pcie usb2 controller to pass
  • pass an onboard usb controller
  • buy a new usb sound card

software mitigations to try beforehand:

  • enable hyperv clocking
  • putting VM IO on it’s own thread v iothred/isolcpu
  • enabling message signaled interrupts for your GPU
1 Like

So I did exactly what I could do in other words. pci-stub is just another way to do what vfio does but in a less proper way…

any pcie usb2 controller would be good, or there are some to avoid?

pci-stub shouldn’t make any difference over vfio-pci except for cards that won’t isolate under the latter at all.

I’d recommend at least trying some of the above mitigations before buying anything

another potential workaround might be to move the sound device to another port (particularly USB2)

if the headset needs drivers, chances are it isn’t class compliant in the first place

yeah i use only usb2 with the headset.
and for the drivers I don’t really think so but I’m not sure it’s pretty plug and play
that’s why I’m surprised.

I will try those software mitigation if I find enough documentation to actually do it since most of the time is a bit harsh on that one

does the hyperv clocking is that:

  <clock offset='localtime'>
    <timer name='rtc' tickpolicy='catchup'/>
    <timer name='pit' tickpolicy='delay'/>
    <timer name='hpet' present='no'/>
    <timer name='hypervclock' present='yes'/>
  </clock>

it was already on it.

Why the qemu documentation is not as simple than java doc ^^
so in the

<vcpu cpuset='0-7'>8</vcpu>
        <cputune>
                <vcpupin vcpu='0' cpuset='0'/>
                <vcpupin vcpu='1' cpuset='1'/>
                <vcpupin vcpu='2' cpuset='2'/>
                <vcpupin vcpu='3' cpuset='3'/>
                <vcpupin vcpu='4' cpuset='4'/>
                <vcpupin vcpu='6' cpuset='6'/>
                <vcpupin vcpu='7' cpuset='7'/>
        </cputune>

what’s the cpuset? because in this example the number is not corresponding to the vcpu number.

And I don’t quite finde anything about xml configuration about enabling message interuption.

so I’ve isolate the cores of the cpu using that:
GRUB_CMDLINE_LINUX=“resume=/dev/mapper/fedora_localhost–live-swap rd.lvm.lv=fedora_localhost-live/root rd.lvm.lv=fedora_localhost-live/swap intel_io
mmu=on rd.driver.pre=vfio-pci rhgb quiet isolcpus=4-7 nohz_full=4-7 rcu_nocbs=4-7”

I’m not sure it works since I can see really low activity on the last 4 cores but not same activity as the same first.
But my Vm is now only using one core and I have done this :

  <vcpu placement='static'>8</vcpu>
  <cputune>
    <emulatorpin cpuset='4-7'/>
  </cputune>

  <cpu mode='host-passthrough' check='none'>
    <topology sockets='1' cores='4' threads='2'/>
  </cpu>

is it because of this:

Then, run qemu-system-x86_64 with taskset and chrt:

chrt -r 1 taskset -c 4-7 qemu-system-x86_64 …

The chrt command will ensure that the task scheduler will round-robin distribute work (otherwise it will all stay on the first cpu). For taskset, the CPU numbers can be comma- and/or dash-separated, like “0,1,2,3” or “0-4” or “1,7-8,10” etc.
from
https://wiki.archlinux.org/index.php/PCI_passthrough_via_OVMF#CPU_pinning

?

if so that’s gonna be shitty to run each time

and by the way can I use the 8 cores with my VM? or it is preferable in this case to only use 4?

anyway this with virsh start win10 doesn’t work. it is still on 1 core.

whoa

I said iothreads, not any of this. just add

<iothread='1'>

to the xml in the device, and make sure pulse/alsa isn’t capturing it

and for isolcpu all you need is

the archwiki spec and the commands

with regards to running all 8 cores, you should have some threads open for IO but past thatrun what you want

I’d ask around on this discord:

it’s all VFIO support

if that inv link is broken just use the permanent one at

fresh off the press:

1 Like