Re: how to run bhyve and virtualbox at the same time

From: Alexander Eichner <freebsd_at_aeichner.de>
Date: Tue, 28 Jun 2022 10:01:17 UTC
Hi,

VirtualBox 6.1.x uses its own hypervisor with kernel modules on macOS, it just uses some internal kernel interfaces to be able to share
the hardware virtualization functionality with other hypervisors.

On hosts other than Windows and macOS VirtualBox defaults to an exclusive use of VT-x/SVM for performance reasons. That mode can be changed
to do the initialization every time VirtualBox is scheduled on a particular CPU which has higher overhead but allows sharing the hardware virtualization capabilities
with other hypervisors. The setting can be changed with VBoxManage. Look at the manual under [1] and search for „hwvirtexclusive“.
However bhyve would need to support something similar to be able to play along, I don’t know whether it does.

Regards,
Alexander Eichner

[1] https://www.virtualbox.org/manual/UserManual.html

> On 28.06.2022 11:29, David Chisnall <theraven@FreeBSD.org> wrote:
> 
> On 27/06/2022 20:41, Mario Marietto wrote:
>> I did it already and it works. Fact is that if I use virtualbox I can't use bhyve at the same time. So It's not a good idea to use only virtualbox machines.
> 
> On macOS, VirtualBox can coexist with other hypervisors because it does not provide a kernel module (it is not allowed to on recent macOS) but is, instead, layered on top of Apple's Hypervisor framework.
> 
> bhyve has also been ported to sit on top of Apple's Hypervisor framework (xhyve, used by Docker) and I believe that the abstractions provided by the bhyve kernel module are fairly similar.
> 
> It should be possible to port VirtualBox to sit on top of vmm.ko.  I have not been able to find any documentation of the vmm(4) ioctls other than the source code, so I'd imagine that about 2/3 of this work would be documenting the kernel interfaces.
> 
> David
>