August 22nd, 2024

Haiku OS [GSoC 2024] Hardware Virtualization: Final Report

The GSoC 2024 project enhanced the Haiku operating system by integrating NVMM hypervisor support, achieving key milestones but facing unresolved issues with SVM backend, OS compatibility, and performance discrepancies.

Read original articleLink Icon
Haiku OS [GSoC 2024] Hardware Virtualization: Final Report

The GSoC 2024 project focused on enhancing the Haiku operating system by integrating hardware virtualization through the NVMM hypervisor, which supports QEMU. The primary objective was to port the NVMM driver to Haiku, specifically the VMX backend, to enable accelerated virtual machine performance. The project achieved significant milestones, including the near-complete porting of the NVMM driver and the successful patching of QEMU to support NVMM on Haiku. However, several unresolved issues remain, such as the incomplete SVM backend, compatibility problems with certain operating systems, and performance discrepancies when running on real hardware versus nested virtualization. The project also faced challenges with QEMU crashing under specific conditions and issues related to EPT translations not being flushed from the TLB in a timely manner. Despite these challenges, the project provided valuable learning experiences in virtualization, kernel development, and debugging. The code developed during the project is available on GitHub, although it has not yet been merged due to outstanding issues.

- The project aimed to integrate NVMM hypervisor support into Haiku for improved virtualization.

- Key achievements include the porting of the NVMM driver and QEMU patching for NVMM support.

- Several unresolved issues persist, including incomplete SVM backend and OS compatibility problems.

- Performance issues were identified when running on real hardware compared to nested virtualization.

- The project provided significant learning opportunities in virtualization and kernel development.

Link Icon 5 comments
By @yellowapple - 6 months
It'd be interesting to see this evolve into a reliable way to spin up a Linux or Windows VM with GPU passthrough. Since Haiku's GPU acceleration story is (last I checked) rather nonexistent, it seems like it'd be a good way to put an otherwise-unused GPU to use, so long as the GPU supports passthrough in the first place.
By @halfcat - 6 months
BeOS lives on. Relevant quote from Neil Stephenson’s In the Beginning was the Command Line [1], a fun commentary on early Mac, Windows, Linux, and BeOS competition.

”On the other side of the road are two competitors that have come along more recently.

One of them (Be, Inc.) is selling fully operational Batmobiles (the BeOS). They are more beautiful and stylish even than the Euro-sedans, better designed, more technologically advanced, and at least as reliable as anything else on the market--and yet cheaper than the others.

With one exception, that is: Linux…”

[1] https://web.stanford.edu/class/cs81n/command.txt

By @nxobject - 6 months
It's interesting that this was built to support QEMU – a lot of Haiku's tentpole applications are ports at this point (e.g. Firefox, GNU toolchain, etc.)
By @rvz - 6 months
Why is it that this post is on the front page with no comments about the actual contents of the post and yet the first comment is about "the old BeOS days" again?

I guess that the lack of comments around this project indicates the extreme technical detail of low level operating system code which is over the heads of >90% of HN readers which I want to see such posts like this here rather than yet another copy-and-paste LLM project.

This report is nicely presented and offers a neat explanation into what was done around hardware-assisted virtualization with the goal of using the NetBSD NVVM driver in another OS to support this in QEMU.

Great job to them.