Re: [vfio-users] Why does the audio from VM crackle?

2016-06-15 Thread Bob Dawes

On 09/06/16 08:35, Philip Abernethy wrote:


I actually have this problem with passed through audio. I could 
improve there situation by fiddling with the sample frequency and size 
in the audio settings. Currently running at 192000Hz and 24 bit.
My first instinct was to blame it on me skimping on the CPU, because I 
got me a quad core i5 instead of the octa core i7.


Philip


On Thu, 9 Jun 2016 09:08 Abdulla Bubshait, > wrote:


I am not the only one who has this issue, but if you emulate an
audio card you end up with occasional crackling audio output,
which is sometimes associated with drops in FPS.

I know there are ways to pass audio devices to the VM directly,
but in many setups it would be preferable to pass the audio to the
host.

Does anyone know the reason the audio has distortion or crackling,
and are there any known solutions to the problem?
___
vfio-users mailing list
vfio-users@redhat.com 
https://www.redhat.com/mailman/listinfo/vfio-users



___
vfio-users mailing list
vfio-users@redhat.com
https://www.redhat.com/mailman/listinfo/vfio-users


My onboard audio was almost completely unusable when I first started 
out, but I got it to work great with the following


export QEMU_AUDIO_DRV=alsa
export QEMU_ALSA_ADC_BUFFER_SIZE=1024 QEMU_ALSA_ADC_PERIOD_SIZE=256
export QEMU_ALSA_DAC_BUFFER_SIZE=1024 QEMU_ALSA_DAC_PERIOD_SIZE=256
export QEMU_AUDIO_DAC_FIXED_SETTINGS=1
export QEMU_AUDIO_DAC_FIXED_FREQ=44100 QEMU_AUDIO_DAC_FIXED_FMT=S16 
QEMU_AUDIO_ADC_FIXED_FREQ=44100 QEMU_AUDIO_ADC_FIXED_FMT=S16

export QEMU_AUDIO_DAC_TRY_POLL=1 QEMU_AUDIO_ADC_TRY_POLL=1
export QEMU_AUDIO_TIMER_PERIOD=50

qemu-system-...

Have barely had a crackle since I switched to a lower time period and 
lined up the qemu audio timer period with the alsa timer period (so it's 
windows start / end together so are less sensitive to timer jitter). 
Pulse audio always worked great as an alternative but there was (and 
still is when I just tried) a bug with random time delays on the 
microphone with pulse audio.


If that doesn't work you can send me the contents of /proc/asound/timers 
and I'll work out a window size for you. On some linux kernels you might 
find modprobe snd_timer gets you a better timer. ALSA has quite a lot of 
kernel options around timers and buffers.


buildacct@Poople-PC:~$ more /proc/asound/timers
G0: system timer : .333us (1000 ticks)
P0-0-0: PCM playback 0-0-0 : SLAVE
P0-0-1: PCM capture 0-0-1 : SLAVE
P0-1-0: PCM playback 0-1-0 : SLAVE
P0-2-1: PCM capture 0-2-1 : SLAVE
P0-3-0: PCM playback 0-3-0 : SLAVE
P0-7-0: PCM playback 0-7-0 : SLAVE

Good luck - it's still a little twitchy even with the above, but 
removing the audio device from windows system manager and scanning for 
changes often fixes it on the 1 time in 20 I boot and it doesn't work. 
It's still possible to make it crackle by putting heavy load on both 
host and client.


Or you can use the passthrough audio from your graphics card of course.

Regards,

D

___
vfio-users mailing list
vfio-users@redhat.com
https://www.redhat.com/mailman/listinfo/vfio-users


Re: [vfio-users] Why does the audio from VM crackle?

2016-06-14 Thread Ivan Volosyuk
I struggled with the rare (but very annoying) crackles and finally I don't
have them anymore with emulated audio.

I use cpu isolation and keep 2 CPU threads for host out of 8.
I use MSI as per alex's VFIO blog.

I pass following env to qemu:
QEMU_AUDIO_DRV=pa
QEMU_PA_SAMPLES=1024
PULSE_COOKIE=/home/ivan/.config/pulse/cookie
PULSE_SERVER=unix:/home/ivan/.pulse_server

I switched qemu to -soundhw ac97
I have hv_time in cpu string:
host,kvm=off,hv_relaxed,hv_spinlocks=0x1fff,hv_vapic,hv_time,hv-vendor-id=servo,hv-vpindex,hv-reset,hv-runtime,hv-crash
I have following rtc settings: -rtc base=utc,driftfix=slew -no-hpet -global
kvm-pit.lost_tick_policy=discard

#  cd .pulse; grep -r ivan .
./default.pa:load-module module-native-protocol-unix srbchannel=1
socket=/home/ivan/.pulse_server
./client.conf:default-server = unix:/home/ivan/.pulse_server

pulse/daemon.conf:
realtime-scheduling = yes
# values which seem to work for me
default-fragments = 2
default-fragment-size-msec = 125
enable-shm = yes
shm-size-bytes = 0
realtime-priority = 5


On Fri, Jun 10, 2016 at 6:15 AM Abdulla Bubshait 
wrote:

> The CPU isolation and interrupt reduction for the guest CPUs seems to
> have greatly reduced the audio problems.
>
> Thanks for that.
>
> On Thu, Jun 9, 2016 at 12:43 PM, Milos Kaurin 
> wrote:
> > Yes, this keeps coming up now and again on this list.
> >
> > My solution was:
> >
> > 1. Buy a dedicated PCIE sound card
> > 2. Pass it through to the guest
> > 3. Route audio: mobo soundcard > guest soundcard
> >
> > In essence, the always-on guest would handle audio, but I would still
> have
> > crackles (rarely), especially from the web browsers (host & guest). Games
> > not so much.
> >
> > To fix crackles, I did the following:
> > 1. In the kernel cmdline: Use hugepages, 16x1GB for the guest (16 for the
> > host, 32 total)
> > 2. In the kernel cmdline: Use cpuisol (6 cores for the gues, 2 for the
> host)
> > 3. In the kernel cmdline: Use nohz_full and rcu_nocbs for the guest cores
> > 4. In the virt XML: Use cputune, hugepages, cpu mode=host-passthrough
> with
> > the correct topology
> > 5. In the virt XML: iothreadpin and emulatorpin for the 2 host CPUs
> > 6. In the virt XML: Use virtio wherever possible (net, block devices)
> >
> > I think I covered everything. If anyone else has any other tips, please
> let
> > me know.
> >
> >
> >
> > Appenix
> >
> >
> > My /etc/default/grub:
> >
> > GRUB_CMDLINE_LINUX="rhgb quiet intel_iommu=on iommu=pt kvm.ignore_msrs=1
> > rd.driver.pre=vfio-pci hugepagesz=1G default_hugepagesz=1G hugepages=16
> > nohz_full=1,2,3,5,6,7 rcu_nocbs=1,2,3,5,6,7 isolcpus=1,2,3,5,6,7"
> >
> >
> >
> > My XML:
> >
> > 
> >   Win10
> >   4bb72e5b-c886-425f-8280-b69755ebf054
> >   16777216
> >   16777216
> >   
> > 
> >   
> >   6
> >   2
> >   
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> >   
> >   
> > hvm
> >  > type='pflash'>/usr/share/edk2.git/ovmf-x64/OVMF_CODE-pure-efi.fd
> > /var/lib/libvirt/qemu/nvram/Win10_VARS.fd
> >   
> >   
> > 
> > 
> > 
> >   
> > 
> > 
> >   
> >   
> > 
> >   
> >   
> > 
> > 
> > 
> >   
> >   destroy
> >   restart
> >   restart
> >   
> > 
> > 
> >   
> >   
> > /usr/bin/qemu-kvm
> > 
> >   
> >   
> >   
> >   
> >> function='0x0'/>
> > 
> > 
> > 
> >> function='0x0'/>
> > 
> > 
> > 
> >   
> >   
> >   
> >> function='0x0'/>
> > 
> > 
> >   
> > 
> >   
> >> function='0x0'/>
> > 
> > 
> >   
> > 
> >   
> >> function='0x0'/>
> > 
> > 
> >   
> > 
> >   
> >> function='0x0'/>
> > 
> > 
> >   
> > 
> >   
> >> function='0x0'/>
> > 
> > 
> >   
> > 
> >
> >
> >
>
> ___
> vfio-users mailing list
> vfio-users@redhat.com
> https://www.redhat.com/mailman/listinfo/vfio-users
>
___
vfio-users mailing list
vfio-users@redhat.com
https://www.redhat.com/mailman/listinfo/vfio-users


Re: [vfio-users] Why does the audio from VM crackle?

2016-06-09 Thread Abdulla Bubshait
The CPU isolation and interrupt reduction for the guest CPUs seems to
have greatly reduced the audio problems.

Thanks for that.

On Thu, Jun 9, 2016 at 12:43 PM, Milos Kaurin  wrote:
> Yes, this keeps coming up now and again on this list.
>
> My solution was:
>
> 1. Buy a dedicated PCIE sound card
> 2. Pass it through to the guest
> 3. Route audio: mobo soundcard > guest soundcard
>
> In essence, the always-on guest would handle audio, but I would still have
> crackles (rarely), especially from the web browsers (host & guest). Games
> not so much.
>
> To fix crackles, I did the following:
> 1. In the kernel cmdline: Use hugepages, 16x1GB for the guest (16 for the
> host, 32 total)
> 2. In the kernel cmdline: Use cpuisol (6 cores for the gues, 2 for the host)
> 3. In the kernel cmdline: Use nohz_full and rcu_nocbs for the guest cores
> 4. In the virt XML: Use cputune, hugepages, cpu mode=host-passthrough with
> the correct topology
> 5. In the virt XML: iothreadpin and emulatorpin for the 2 host CPUs
> 6. In the virt XML: Use virtio wherever possible (net, block devices)
>
> I think I covered everything. If anyone else has any other tips, please let
> me know.
>
>
>
> Appenix
>
>
> My /etc/default/grub:
>
> GRUB_CMDLINE_LINUX="rhgb quiet intel_iommu=on iommu=pt kvm.ignore_msrs=1
> rd.driver.pre=vfio-pci hugepagesz=1G default_hugepagesz=1G hugepages=16
> nohz_full=1,2,3,5,6,7 rcu_nocbs=1,2,3,5,6,7 isolcpus=1,2,3,5,6,7"
>
>
>
> My XML:
>
> 
>   Win10
>   4bb72e5b-c886-425f-8280-b69755ebf054
>   16777216
>   16777216
>   
> 
>   
>   6
>   2
>   
> 
> 
> 
> 
> 
> 
> 
> 
> 
>   
>   
> hvm
>  type='pflash'>/usr/share/edk2.git/ovmf-x64/OVMF_CODE-pure-efi.fd
> /var/lib/libvirt/qemu/nvram/Win10_VARS.fd
>   
>   
> 
> 
> 
>   
> 
> 
>   
>   
> 
>   
>   
> 
> 
> 
>   
>   destroy
>   restart
>   restart
>   
> 
> 
>   
>   
> /usr/bin/qemu-kvm
> 
>   
>   
>   
>   
>function='0x0'/>
> 
> 
> 
>function='0x0'/>
> 
> 
> 
>   
>   
>   
>function='0x0'/>
> 
> 
>   
> 
>   
>function='0x0'/>
> 
> 
>   
> 
>   
>function='0x0'/>
> 
> 
>   
> 
>   
>function='0x0'/>
> 
> 
>   
> 
>   
>function='0x0'/>
> 
> 
>   
> 
>
>
>

___
vfio-users mailing list
vfio-users@redhat.com
https://www.redhat.com/mailman/listinfo/vfio-users


Re: [vfio-users] Why does the audio from VM crackle?

2016-06-09 Thread Abdulla Bubshait
On Thu, Jun 9, 2016 at 3:35 AM, Philip Abernethy  wrote:
> I actually have this problem with passed through audio. I could improve
> there situation by fiddling with the sample frequency and size in the audio
> settings. Currently running at 192000Hz and 24 bit.
> My first instinct was to blame it on me skimping on the CPU, because I got
> me a quad core i5 instead of the octa core i7.
>

Philip-

What audio driver did you use? hda or ich6?

___
vfio-users mailing list
vfio-users@redhat.com
https://www.redhat.com/mailman/listinfo/vfio-users


Re: [vfio-users] Why does the audio from VM crackle?

2016-06-09 Thread Milos Kaurin
model name: Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz


On Thu, Jun 9, 2016 at 6:56 PM, Spam House  wrote:

> Milos -
>
> What CPU are you using?
>
> On Thu, Jun 9, 2016 at 11:43 AM, Milos Kaurin 
> wrote:
>
>> Yes, this keeps coming up now and again on this list.
>>
>> My solution was:
>>
>> 1. Buy a dedicated PCIE sound card
>> 2. Pass it through to the guest
>> 3. Route audio: mobo soundcard > guest soundcard
>>
>> In essence, the always-on guest would handle audio, but I would still
>> have crackles (rarely), especially from the web browsers (host & guest).
>> Games not so much.
>>
>> To fix crackles, I did the following:
>> 1. In the kernel cmdline: Use hugepages, 16x1GB for the guest (16 for the
>> host, 32 total)
>> 2. In the kernel cmdline: Use cpuisol (6 cores for the gues, 2 for the
>> host)
>> 3. In the kernel cmdline: Use nohz_full and rcu_nocbs for the guest cores
>> 4. In the virt XML: Use cputune, hugepages, cpu mode=host-passthrough
>> with the correct topology
>> 5. In the virt XML: iothreadpin and emulatorpin for the 2 host CPUs
>> 6. In the virt XML: Use virtio wherever possible (net, block devices)
>>
>> I think I covered everything. If anyone else has any other tips, please
>> let me know.
>>
>>
>>
>> Appenix
>>
>>
>> My /etc/default/grub:
>>
>> GRUB_CMDLINE_LINUX="rhgb quiet intel_iommu=on iommu=pt kvm.ignore_msrs=1
>> rd.driver.pre=vfio-pci hugepagesz=1G default_hugepagesz=1G hugepages=16
>> nohz_full=1,2,3,5,6,7 rcu_nocbs=1,2,3,5,6,7 isolcpus=1,2,3,5,6,7"
>>
>>
>>
>> My XML:
>>
>> 
>>   Win10
>>   4bb72e5b-c886-425f-8280-b69755ebf054
>>   16777216
>>   16777216
>>   
>> 
>>   
>>   6
>>   2
>>   
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>>   
>>   
>> hvm
>> > type='pflash'>/usr/share/edk2.git/ovmf-x64/OVMF_CODE-pure-efi.fd
>> /var/lib/libvirt/qemu/nvram/Win10_VARS.fd
>>   
>>   
>> 
>> 
>> 
>>   
>> 
>> 
>>   
>>   
>> 
>>   
>>   
>> 
>> 
>> 
>>   
>>   destroy
>>   restart
>>   restart
>>   
>> 
>> 
>>   
>>   
>> /usr/bin/qemu-kvm
>> 
>>   
>>   
>>   
>>   
>>   > function='0x0'/>
>> 
>> 
>> 
>>   > function='0x0'/>
>> 
>> 
>> 
>>   
>>   
>>   
>>   > function='0x0'/>
>> 
>> 
>>   
>> 
>>   
>>   > function='0x0'/>
>> 
>> 
>>   
>> 
>>   
>>   > function='0x0'/>
>> 
>> 
>>   
>> 
>>   
>>   > function='0x0'/>
>> 
>> 
>>   
>> 
>>   
>>   > function='0x0'/>
>> 
>> 
>>   
>> 
>>
>>
>>
>> ​
>>
>> ___
>> vfio-users mailing list
>> vfio-users@redhat.com
>> https://www.redhat.com/mailman/listinfo/vfio-users
>>
>>
>
___
vfio-users mailing list
vfio-users@redhat.com
https://www.redhat.com/mailman/listinfo/vfio-users


Re: [vfio-users] Why does the audio from VM crackle?

2016-06-09 Thread Spam House
Milos -

What CPU are you using?

On Thu, Jun 9, 2016 at 11:43 AM, Milos Kaurin 
wrote:

> Yes, this keeps coming up now and again on this list.
>
> My solution was:
>
> 1. Buy a dedicated PCIE sound card
> 2. Pass it through to the guest
> 3. Route audio: mobo soundcard > guest soundcard
>
> In essence, the always-on guest would handle audio, but I would still have
> crackles (rarely), especially from the web browsers (host & guest). Games
> not so much.
>
> To fix crackles, I did the following:
> 1. In the kernel cmdline: Use hugepages, 16x1GB for the guest (16 for the
> host, 32 total)
> 2. In the kernel cmdline: Use cpuisol (6 cores for the gues, 2 for the
> host)
> 3. In the kernel cmdline: Use nohz_full and rcu_nocbs for the guest cores
> 4. In the virt XML: Use cputune, hugepages, cpu mode=host-passthrough with
> the correct topology
> 5. In the virt XML: iothreadpin and emulatorpin for the 2 host CPUs
> 6. In the virt XML: Use virtio wherever possible (net, block devices)
>
> I think I covered everything. If anyone else has any other tips, please
> let me know.
>
>
>
> Appenix
>
>
> My /etc/default/grub:
>
> GRUB_CMDLINE_LINUX="rhgb quiet intel_iommu=on iommu=pt kvm.ignore_msrs=1
> rd.driver.pre=vfio-pci hugepagesz=1G default_hugepagesz=1G hugepages=16
> nohz_full=1,2,3,5,6,7 rcu_nocbs=1,2,3,5,6,7 isolcpus=1,2,3,5,6,7"
>
>
>
> My XML:
>
> 
>   Win10
>   4bb72e5b-c886-425f-8280-b69755ebf054
>   16777216
>   16777216
>   
> 
>   
>   6
>   2
>   
> 
> 
> 
> 
> 
> 
> 
> 
> 
>   
>   
> hvm
>  type='pflash'>/usr/share/edk2.git/ovmf-x64/OVMF_CODE-pure-efi.fd
> /var/lib/libvirt/qemu/nvram/Win10_VARS.fd
>   
>   
> 
> 
> 
>   
> 
> 
>   
>   
> 
>   
>   
> 
> 
> 
>   
>   destroy
>   restart
>   restart
>   
> 
> 
>   
>   
> /usr/bin/qemu-kvm
> 
>   
>   
>   
>   
>function='0x0'/>
> 
> 
> 
>function='0x0'/>
> 
> 
> 
>   
>   
>   
>function='0x0'/>
> 
> 
>   
> 
>   
>function='0x0'/>
> 
> 
>   
> 
>   
>function='0x0'/>
> 
> 
>   
> 
>   
>function='0x0'/>
> 
> 
>   
> 
>   
>function='0x0'/>
> 
> 
>   
> 
>
>
>
> ​
>
> ___
> vfio-users mailing list
> vfio-users@redhat.com
> https://www.redhat.com/mailman/listinfo/vfio-users
>
>
___
vfio-users mailing list
vfio-users@redhat.com
https://www.redhat.com/mailman/listinfo/vfio-users


Re: [vfio-users] Why does the audio from VM crackle?

2016-06-09 Thread Janusz
W dniu 09.06.2016 o 18:52, Abdulla Bubshait pisze:
> On Thu, Jun 9, 2016 at 10:55 AM, Alex Williamson
>  wrote:
>> This seems rather obvious doesn't it?  An emulated audio device is just a
>> blob of code that requires the CPU to run it.  Generating audio, it's highly
>> susceptible to latency issues.  At the same time you're apparently playing a
>> game that consumes significant CPU time.  Total CPU cycles on the system
>> have a fixed limit.  Therefore any time you exceed that limit or get close
>> enough for scheduling latency to become an issue, you can expect the audio
>> emulation to suffer.  This is why bare metal has devices dedicated to
>> various activities.  Solutions are 1) get a faster system, 2) load the
>> system less or maybe more optimally, 3) assign a device to offload the work.
>>
>> The "more optimally" part of 2) might include pinning vCPUs, pinning the
>> emulator thread, leaving sufficient CPU power unassigned so that the host
>> has enough capacity to run emulation at full speed, reducing host overhead
>> via things like hugepages, etc...
> I don't need to be playing games for it to have problems. I shut down
> everything in
> both the host and guest, plenty of cycles to spare. If I were to test
> the speaker setting
> in the windows Control Panel I get crackling. I have an i7 4790 so I
> thought I had
> enough cycles to be able to handle that part on its own.
>
> I do have vCPUs pinned to 2 of the cores, leaving 2 cores for the
> host. I also have
> hugepages setup. I tried changing the governor to performance and pinning qemu
> to non-VM cores. It seems I cannot get a setup that doesn't have audio issues.
>
> I was wondering if there was a better way to move audio from the guest
> to the host.
>
Make sure you disable any input devices and other output devices you are
not using in windows (like hdmi audio). Also, are you running with
-nographic option? if no, then try with it. I had those problems, but
this helped me fix them.

___
vfio-users mailing list
vfio-users@redhat.com
https://www.redhat.com/mailman/listinfo/vfio-users


Re: [vfio-users] Why does the audio from VM crackle?

2016-06-09 Thread Abdulla Bubshait
On Thu, Jun 9, 2016 at 10:55 AM, Alex Williamson
 wrote:
> This seems rather obvious doesn't it?  An emulated audio device is just a
> blob of code that requires the CPU to run it.  Generating audio, it's highly
> susceptible to latency issues.  At the same time you're apparently playing a
> game that consumes significant CPU time.  Total CPU cycles on the system
> have a fixed limit.  Therefore any time you exceed that limit or get close
> enough for scheduling latency to become an issue, you can expect the audio
> emulation to suffer.  This is why bare metal has devices dedicated to
> various activities.  Solutions are 1) get a faster system, 2) load the
> system less or maybe more optimally, 3) assign a device to offload the work.
>
> The "more optimally" part of 2) might include pinning vCPUs, pinning the
> emulator thread, leaving sufficient CPU power unassigned so that the host
> has enough capacity to run emulation at full speed, reducing host overhead
> via things like hugepages, etc...

I don't need to be playing games for it to have problems. I shut down
everything in
both the host and guest, plenty of cycles to spare. If I were to test
the speaker setting
in the windows Control Panel I get crackling. I have an i7 4790 so I
thought I had
enough cycles to be able to handle that part on its own.

I do have vCPUs pinned to 2 of the cores, leaving 2 cores for the
host. I also have
hugepages setup. I tried changing the governor to performance and pinning qemu
to non-VM cores. It seems I cannot get a setup that doesn't have audio issues.

I was wondering if there was a better way to move audio from the guest
to the host.

___
vfio-users mailing list
vfio-users@redhat.com
https://www.redhat.com/mailman/listinfo/vfio-users


Re: [vfio-users] Why does the audio from VM crackle?

2016-06-09 Thread Milos Kaurin
Yes, this keeps coming up now and again on this list.

My solution was:

1. Buy a dedicated PCIE sound card
2. Pass it through to the guest
3. Route audio: mobo soundcard > guest soundcard

In essence, the always-on guest would handle audio, but I would still have
crackles (rarely), especially from the web browsers (host & guest). Games
not so much.

To fix crackles, I did the following:
1. In the kernel cmdline: Use hugepages, 16x1GB for the guest (16 for the
host, 32 total)
2. In the kernel cmdline: Use cpuisol (6 cores for the gues, 2 for the host)
3. In the kernel cmdline: Use nohz_full and rcu_nocbs for the guest cores
4. In the virt XML: Use cputune, hugepages, cpu mode=host-passthrough with
the correct topology
5. In the virt XML: iothreadpin and emulatorpin for the 2 host CPUs
6. In the virt XML: Use virtio wherever possible (net, block devices)

I think I covered everything. If anyone else has any other tips, please let
me know.



Appenix


My /etc/default/grub:

GRUB_CMDLINE_LINUX="rhgb quiet intel_iommu=on iommu=pt kvm.ignore_msrs=1
rd.driver.pre=vfio-pci hugepagesz=1G default_hugepagesz=1G hugepages=16
nohz_full=1,2,3,5,6,7 rcu_nocbs=1,2,3,5,6,7 isolcpus=1,2,3,5,6,7"



My XML:


  Win10
  4bb72e5b-c886-425f-8280-b69755ebf054
  16777216
  16777216
  

  
  6
  2
  









  
  
hvm
/usr/share/edk2.git/ovmf-x64/OVMF_CODE-pure-efi.fd
/var/lib/libvirt/qemu/nvram/Win10_VARS.fd
  
  



  


  
  

  
  



  
  destroy
  restart
  restart
  


  
  
/usr/bin/qemu-kvm

  
  
  
  
  



  



  
  
  
  


  

  
  


  

  
  


  

  
  


  

  
  


  




​
___
vfio-users mailing list
vfio-users@redhat.com
https://www.redhat.com/mailman/listinfo/vfio-users


Re: [vfio-users] Why does the audio from VM crackle?

2016-06-09 Thread Alex Williamson
On Thu, Jun 9, 2016 at 1:07 AM, Abdulla Bubshait  wrote:

> I am not the only one who has this issue, but if you emulate an audio card
> you end up with occasional crackling audio output, which is sometimes
> associated with drops in FPS.
>
> I know there are ways to pass audio devices to the VM directly, but in
> many setups it would be preferable to pass the audio to the host.
>
> Does anyone know the reason the audio has distortion or crackling, and are
> there any known solutions to the problem?
>

This seems rather obvious doesn't it?  An emulated audio device is just a
blob of code that requires the CPU to run it.  Generating audio, it's
highly susceptible to latency issues.  At the same time you're apparently
playing a game that consumes significant CPU time.  Total CPU cycles on the
system have a fixed limit.  Therefore any time you exceed that limit or get
close enough for scheduling latency to become an issue, you can expect the
audio emulation to suffer.  This is why bare metal has devices dedicated to
various activities.  Solutions are 1) get a faster system, 2) load the
system less or maybe more optimally, 3) assign a device to offload the work.

The "more optimally" part of 2) might include pinning vCPUs, pinning the
emulator thread, leaving sufficient CPU power unassigned so that the host
has enough capacity to run emulation at full speed, reducing host overhead
via things like hugepages, etc...
___
vfio-users mailing list
vfio-users@redhat.com
https://www.redhat.com/mailman/listinfo/vfio-users


Re: [vfio-users] Why does the audio from VM crackle?

2016-06-09 Thread Arjen
For me, letting the host load the driver (snd_hda_intel) before passing 
through the onboard audio to the VM fixed the crackling and buffer 
underruns. I never found out why this worked...
Passing through the physical USB 2.0 controller worked wonders for my 
USB TV tuner compared to forwarding just the USB port.

Hopefully either of those approaches can help you too.

kind regards, Arjen

On 06/09/2016 10:21 AM, Stein van Broekhoven wrote:

I have a on motherboard audio card that I can pass through to a vm
without issues.
If I do the same with a usb audio device I also get the crackling on
playback.
So I suspect it is due to the latency in the emulated usb.

Possible Solutions:
 - Pass through a pci audio device. (on motherboard / extra audio card)
 - Pass through entire USB controller on pci level (read about this
didn't yet try it myself)




*Van: *"rndbit" 
*Aan: *vfio-users@redhat.com
*Verzonden: *Donderdag 9 juni 2016 09:17:29
*Onderwerp: *Re: [vfio-users] Why does the audio from VM crackle?

Check your DPC latency, it is one of causes for cracking sound. This is
exact reason i stopped using vga passthrough for gaming..

On 2016.06.09 10:07, Abdulla Bubshait wrote:

I am not the only one who has this issue, but if you emulate an
audio card you end up with occasional crackling audio output, which
is sometimes associated with drops in FPS.

I know there are ways to pass audio devices to the VM directly, but
in many setups it would be preferable to pass the audio to the host.

Does anyone know the reason the audio has distortion or crackling,
and are there any known solutions to the problem?


___
vfio-users mailing list
vfio-users@redhat.com
https://www.redhat.com/mailman/listinfo/vfio-users



___
vfio-users mailing list
vfio-users@redhat.com
https://www.redhat.com/mailman/listinfo/vfio-users


___
vfio-users mailing list
vfio-users@redhat.com
https://www.redhat.com/mailman/listinfo/vfio-users



___
vfio-users mailing list
vfio-users@redhat.com
https://www.redhat.com/mailman/listinfo/vfio-users


Re: [vfio-users] Why does the audio from VM crackle?

2016-06-09 Thread Stein van Broekhoven
I have a on motherboard audio card that I can pass through to a vm without 
issues. 
If I do the same with a usb audio device I also get the crackling on playback. 
So I suspect it is due to the latency in the emulated usb. 

Possible Solutions: 
- Pass through a pci audio device. (on motherboard / extra audio card) 
- Pass through entire USB controller on pci level (read about this didn't yet 
try it myself) 




Van: "rndbit"  
Aan: vfio-users@redhat.com 
Verzonden: Donderdag 9 juni 2016 09:17:29 
Onderwerp: Re: [vfio-users] Why does the audio from VM crackle? 



Check your DPC latency, it is one of causes for cracking sound. This is exact 
reason i stopped using vga passthrough for gaming.. 
On 2016.06.09 10:07, Abdulla Bubshait wrote: 



I am not the only one who has this issue, but if you emulate an audio card you 
end up with occasional crackling audio output, which is sometimes associated 
with drops in FPS. 

I know there are ways to pass audio devices to the VM directly, but in many 
setups it would be preferable to pass the audio to the host. 

Does anyone know the reason the audio has distortion or crackling, and are 
there any known solutions to the problem? 


___
vfio-users mailing list vfio-users@redhat.com 
https://www.redhat.com/mailman/listinfo/vfio-users 




___ 
vfio-users mailing list 
vfio-users@redhat.com 
https://www.redhat.com/mailman/listinfo/vfio-users 
___
vfio-users mailing list
vfio-users@redhat.com
https://www.redhat.com/mailman/listinfo/vfio-users


Re: [vfio-users] Why does the audio from VM crackle?

2016-06-09 Thread rndbit
Check your DPC latency, it is one of causes for cracking sound. This is
exact reason i stopped using vga passthrough for gaming..

On 2016.06.09 10:07, Abdulla Bubshait wrote:
> I am not the only one who has this issue, but if you emulate an audio
> card you end up with occasional crackling audio output, which is
> sometimes associated with drops in FPS.
>
> I know there are ways to pass audio devices to the VM directly, but in
> many setups it would be preferable to pass the audio to the host.
>
> Does anyone know the reason the audio has distortion or crackling, and
> are there any known solutions to the problem?
>
>
> ___
> vfio-users mailing list
> vfio-users@redhat.com
> https://www.redhat.com/mailman/listinfo/vfio-users

___
vfio-users mailing list
vfio-users@redhat.com
https://www.redhat.com/mailman/listinfo/vfio-users


Re: [vfio-users] Why does the audio from VM crackle?

2016-06-09 Thread Philip Abernethy
I actually have this problem with passed through audio. I could improve
there situation by fiddling with the sample frequency and size in the audio
settings. Currently running at 192000Hz and 24 bit.
My first instinct was to blame it on me skimping on the CPU, because I got
me a quad core i5 instead of the octa core i7.

Philip

On Thu, 9 Jun 2016 09:08 Abdulla Bubshait, 
wrote:

> I am not the only one who has this issue, but if you emulate an audio card
> you end up with occasional crackling audio output, which is sometimes
> associated with drops in FPS.
>
> I know there are ways to pass audio devices to the VM directly, but in
> many setups it would be preferable to pass the audio to the host.
>
> Does anyone know the reason the audio has distortion or crackling, and are
> there any known solutions to the problem?
> ___
> vfio-users mailing list
> vfio-users@redhat.com
> https://www.redhat.com/mailman/listinfo/vfio-users
>
___
vfio-users mailing list
vfio-users@redhat.com
https://www.redhat.com/mailman/listinfo/vfio-users