Bug 263072

Summary: System freezes during reboot when vmm module is loaded inside a QEMU/KVM virtual machine
Product: Base System Reporter: David Sebek <dasebek>
Component: kernAssignee: freebsd-virtualization (Nobody) <virtualization>
Status: New ---    
Severity: Affects Many People CC: j.kelly.hays
Priority: ---    
Version: 13.1-RELEASE   
Hardware: Any   
OS: Any   

Description David Sebek 2022-04-05 19:56:48 UTC
FreeBSD system running inside a QEMU/KVM virtual machine freezes during a reboot when the vmm kernel module is loaded.

- How reproducible:

Always

- How to reproduce:

1. Install FreeBSD 13.0-RELEASE or 13.1-RC1
2. run the following commands as root:
# kldload vmm
# reboot

- Expected behavior:

The system reboots.

- Observed behavior:

The reboot proceeds as usual up until the point when the "Rebooting..." message is displayed and the machine should restart. But instead of restarting, the screen goes blank, but the CPU usage remains high, and the virtual machine hangs until I do a hard power-off of the virtual machine.

- Affected versions:

Guest OS:
The problem occurred on all FreeBSD versions that I tested. Namely,
FreeBSD 13.1 built from releng/13.1 on April 4, 2022
FreeBSD 13.0-RELEASE
FreeBSD 13.0-STABLE built in October 2021

Hypervisor:
I used QEMU version 6.2.0 (qemu-6.2.0-5.fc36) together with virt-manager version 4.0.0. It doesn't matter whether I choose the Q35 or i440FX chipset or BIOS or UEFI boot in the VM settings.
The problem is also present when running FreeBSD in a DigitalOcean droplet.

I don't know how loading the vmm module affects the system reboot. It could also be an issue with the QEMU/KVM hypervisor itself. But without the vmm module loaded, the machine reboots correctly every time.