George Boutsioukis: Paravirtualized audio
This is a guest blog post by George Boutsioukis, one of our Google Summer of Code students.
My name is George Boutsioukis and I’m a CS undergraduate at the Aristotle University in Thessaloniki, Greece. This is my second year in GSoC, after taking up a project last year for Python. Coming from a background mostly in compilers and machine learning, this project for me is also a crash course in virtualization and Xen.
My project is to implement paravirtualized audio in Xen, following in principle the split-driver approach already used in the other PV drivers so far. Compared to network and block paravirtualization, audio interfaces are relatively simpler to support (at least for PCM). A backend driver would only need to transfer and play the raw audio frames of the PV guest directly, without any need to process them. However, there are a few issues that need to be dealt with, most notably buffering/synchronization problems and the performance overhead it may introduce.
The initial approach is to make both ends run in userspace, using gntalloc for this purpose. A pulseaudio sink module at the frontend will transfer the raw audio frames from the guest to a backend daemon through a ring buffer. Audio capture should work in much the same way, only in reverse. The transferred data are not pulseaudio-specific, so this approach can be extended (in theory at least) for any frontend interface that works with raw PCM data, like ALSA for example.
Fortunately, some work has already been done in this direction: Rafal Wojtczuk has already written a basic PV audio implementation for Qubes-OS, which will be used as a guide for the first steps of this project. Of course, the goal is to make the final implementation production-ready, so I expect a large part of this project to be spent on dealing with practical issues, like receiving audio from multiple frontends or dealing with suspending/resuming a guest.
The code and any other relevant files will lie in a public repository at code.google.com/p/xen-audio for anyone who wishes to follow the project during the summer. The code will be upstreamed to Xen when the project is complete.