[GSOC 2024] Hardware acceleration for Haiku's QEMU port

Congratsssssss

Congratulations, looking forward to it!

Would be a great thing! Congrats +1

1 Like

Ahoy @dalmegnu ,

Have a great journey ! … riding on the road of cyberways,
seeking out to build a well-formed HW acceleration of a VM chariot
using just C / C++ equity and your talent.

Kudos !
Tra-raa !

:cowboy_hat_face:

Great news! I make pretty heavy use of VMs so this is one of the main missing Haiku features that’s stopping me using Haiku as my main OS.

2 Likes

Today I successfully virtualized the first VM! It’s a very simple proof of concept that takes two integers and adds them. It came as a companion to this blog post.

Also, both NVMM frontend and the VMX backend are compiling on Haiku (until today there were parts that didn’t compile), although some parts remain untested.

It may not look very impressive but it has taken more than a month to get the full example working.

26 Likes

Can’t say, that looks amazing :smiley: but I know from other ports that things can be hard to get even some basics shown, thanks for working on this! :+1: (and that’s just me doing the easy stuff) :smiley:

4 Likes

Here you can see the first ever VM running on QEMU (virtualized)!

The bad news is they run slower than with software emulation :clown_face:

20 Likes

Interesting part would be to know how it behaves in virtual with and without acceleration. :slight_smile:

1 Like

Well, GSoC has come to an end!

The final report: [GSoC 2024] Hardware Virtualization: Final Report | Haiku Project

Waddlesplash told me it got to HN: Hardware Virtualization | Hacker News

10 Likes

I’ve not been reading the Haiku forums for a while so I missed this.

This is fantastic news, or at least it will be when we can run Linux and other stuff well.

Haiku’s lack of hardware virtualization has long been one of the main things stopping me from trying to run Haiku as my main OS. I’m always creating new VMs and containers under Linux. I can mostly live without proper GPU support but I can’t live without good hardware virt support.

2 Likes

This is fantastic news, or at least it will be when we can run Linux and other stuff well.

Yes, well, it can’t really run much stuff well right now. There aren’t missing features, just some hard to figure out bugs.

Some months have passed so I thought it was time for an update: There are still memory corruption issues. I’ve been trying to find a minimal reproducer for this but I haven’t been successful so far, as small operating systems seem to work fine (but Haiku fails). I’ll keep working on that, I have a few ideas but this might be beyond my debugging skills.

The good news (although note I haven’t done extensive testing):

  • Haiku+NVMM behavior on real hardware vs when running as a guest on Linux/KVM seems to match now.
  • Disabling SMP is no longer needed. VM migrations across different cpus work well now.
  • Cyberus guest tests seem to return now the same results on Haiku and NetBSD.
18 Likes

Thanks for the update! I was curious about the state. It is nice that things are progressing, it is quite a challenge to take on!

Is there any info or stack traces that would make sense sharing either a tracking ticket or the dev mailing list? Also remember that it might be existing haiku code that is the cause…

3 Likes

Is there any news on this?
And also a side question (which is only somewhat related), do we have support for usb passthrough in qemu on Haiku yet?

Ideally if both are available I’d like to use this to develop some “linux on phone” stuff… but without having to run linux :slight_smile:

It world be great to run Aros One in accelerated qemu.

Sadly, not. I need to sit down and track down that memory corruption bug. For that I need to modify a Haiku guest which requires me to read and modify some parts of the Haiku codebase I’m not familiar with. Plus, I started a new job a month ago. But yeah, I should probably stop being lazy and fix this once and for all.

Regarding the second question I don’t know much about USB but you will need that NVMM supports passthrough too (if you plan to use virtualization + passthrough) which it currently doesn’t. In fact, DragonFlyBSD offers a bounty (100 USD) for anyone that implements this: https://www.dragonflybsd.org/docs/developer/Code_Bounties/#index4h2

USB passthrough would be implemented mostly in QEMU, I would think? It should be possible to implement that even without NVMM.

Bounties seem like a waste of time to me. I would have hoped there was more information on what would be needed to be done, I would have taken a look then. But this doesn’t give any info sadly.