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

Alex Williamson alex.l.williamson at gmail.com
Thu Jun 9 14:55:23 UTC 2016


On Thu, Jun 9, 2016 at 1:07 AM, Abdulla Bubshait <abdulla.bubshait at gmail.com
> 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...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/vfio-users/attachments/20160609/c92dd314/attachment.htm>


More information about the vfio-users mailing list