An interesting week. Didn't go quite in the direction I expected it to.
Cole kindly provided some documentation for spectrum-vm for the developer manual. This was especially nice, because it marked the first time I was able to remove an item from the Contribution Ideas page because somebody had done the contribution! Thanks Cole!
: https://spectrum-os.org/lists/archives/spectrum-devel/87zh97coks.fsf@alyssa.... : https://spectrum-os.org/doc/developer-manual.html#_spectrum_vm : https://spectrum-os.org/git/www/commit/?id=bf7cde0ddd06455f212fb39092b87313c... : https://spectrum-os.org/todo.html
My main goal for this week was to start modifying libwayland-server to use a virtio_wl socket as the display socket, as described last week.
So, in pursuit of this goal, I started the week by trying to write a test program that would start a VM running a compositor, create a socket, attach one end to that VM, and then start another VM running a Wayland client, and attach the other end of the socket to that VM. Then, in theory, all I had to do was the libwayland-server modifications, and then the compositor and client would be able to talk to each other.
Unfortunately, I didn't get that far. The program froze after starting the first VM. I assumed I must have done something wrong, so I rewrote it, and had the same problem. I did it again, and same problem.
Some further debugging revealed that the command to add the socket to the first VM was hanging. And also, crosvm was hanging. Running the command outside this program worked fine, though. It returned immediately, and crosvm kept running with the new socket added.
What I eventually realised was that the crosvm hang only happened if the command was sent to it early enough. After some intense staring at the crosvm code, I realised that there was a deadlock resulting from trying to wait for a response from a virtual device before the device had been initialized. Despite this issue manifesting with adding Wayland sockets, which is a feature unique to crosvm, a lot of the code for that is adapted from the code for resizing virtual block devices, which is an upstream feature. And that had the same issue, so this is actually an upstream bug.
The fix was not easy, and required some fairly substantial refactoring. It's described in detail in the patch message. I think it's probably a pretty interesting read.
I also merged in the latest upstream crosvm changes.
I spent a few more hours trying to get libvda (an optional dependency of crosvm; required for virtio-video) to build, and I got it to work, thanks to some help from Puck. There's still a hack in there I'll tidy up before I push it, but it's cool to have this packaged for future experimentation with this crosvm feature.
With the crosvm issue out of the way, which ended up taking most of the week to identify and fix, hopefully next week I'll be able to actually get going on those libwayland-server changes.