Re: Bhyve finally got nested virtualization.

From: Wanpeng Qian <wanpengqian_at_gmail.com>
Date: Wed, 18 Nov 2026 19:28:53 UTC
On 11/18/26, Michael Dexter wrote:
> From the thread, Mario is the author? I am confused.

Sorry for the confusion, that is my fault for answering in his thread.
No: Mario's project and mine have nothing to do with each other.
Different people, different code. I replied here only because your
"please post a review" was here.

D61708 and D61709 are mine. They were written and posted before Mario
published his tree, and nothing in them comes from it. As far as I can
tell from his mails the two also differ in scope: mine is only the vmm.ko
side, for Linux/KVM as the guest hypervisor, without EPT for the guest.

To the points in your later mail:

Prompt author: me. The assistant was Anthropic's Claude. I directed the
work, the tests ran on my hardware, and I am the one who answers for the
code.

Code provenance: the reviews are a new implementation, for stock vmm.ko,
of the first stage of the nested VMX that keelOS has had since October.
The emulation follows the Intel SDM (order number 325384-081US); the
comments name the sections, and it was compared with them section by
section. Linux's KVM was read for the overall scheme (the names vmcs12
and vmcs02 come from it) and to learn what Linux needs from the CPU when
it runs as the guest hypervisor. No code was taken from QEMU, KVM or any
other hypervisor. I cannot prove what a model has seen in its training.
What I can say is that the code is built around bhyve's own vmx.c and
its data structures, and it is small enough to be read against KVM by
anyone who wants to check. The summary of D61708 says all of this too.

Since the question is where such projects come from, some background on
keelOS.

It started on 24 September this year from one question: can the host OS
be upgraded and rebooted without stopping the guests? What I am building
is a small hypervisor that UEFI loads and that stays resident, with
FreeBSD on top of it as a restartable "root" that keeps the drivers, the
storage, the network and bhyve's device models. bhyve and vmm.ko are the
base of all of it, which is why their bugs are my bugs.

How it moves: I set the goals and make the decisions. The assistant
surveys how other hypervisors do a thing, writes a design draft, and
once I have decided it writes the code, the tests and the documentation.
Nothing counts until it has run on real hardware; QEMU is only for
iterating. Every run on the development machines is numbered and logged,
their serial consoles are recorded through the BMCs, and long stress
runs go on in the background.

Where it runs: Supermicro X10 and X11 Xeon servers, Lenovo Tiny
desktops, an AMD machine and laptops. The guests are Linux, FreeBSD,
Windows from NT 4 and XP to 11 (also with Hyper-V and WSL2 inside),
Solaris 2.6 and router systems, with NVMe, NIC VF and GPU passthrough.
The test I care most about reloads the FreeBSD root under running
guests: 300 reloads in a row on two machines without losing a guest.

In numbers, eight weeks in: a bit over 4000 commits; 88 patch files of
my own against the FreeBSD kernel, vmm and bhyve; and 45 reviews on
FreeBSD's Phabricator since 2 October (ixl and iavf, iflib, netmap,
bhyve's AHCI, NVMe, xHCI, e1000, RTC and snapshot code, vmm, vm_kern).
About a dozen of them have been accepted by reviewers so far. Most fix
bugs that showed up while running real guests; a few are about
performance, for example one that halves the NVMe attach time and one
that removes two MMIO exits per NCQ command from bhyve's AHCI.

Tests for the nested reviews: there are no automated tests in them yet.
The test plan of D61708 lists what was run by hand on bare metal and has
the commands to repeat it. If you want tests as a separate review, tell
me which form you prefer and I will do it. The vmx tests of
kvm-unit-tests are the obvious candidate, but they need work before
they run as a bhyve guest.

The call: Thursday 10 AM Pacific is 3 AM on Friday for me, so I will
most likely not be able to join. I am glad to answer anything here or
in the reviews.

Wanpeng Qian

On Thu, Nov 19, 2026 03:11 AM, Michael Dexter <editor@callfortesting.org>
wrote:

> On 11/18/26 2:46 AM, Wanpeng Qian wrote:
> >  > Please post a review!
> >
> > Here are two:
>
>  From the thread, Mario is the author? I am confused.
>
> None the less, I am reaching out to the other known authors for their
> nested bhyve projects. I will be interesting to see if the frontier
> models are providing different users the same answers to the same request.
>
> Michael
>