qemu 4.2 bootloops with -cpu host and nested hypervisor
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
QEMU |
Invalid
|
Undecided
|
Unassigned | ||
qemu-kvm (CentOS) |
Unknown
|
Unknown
|
Bug Description
I've noticed that after upgrading from Ubuntu 18.04 to 20.04 that nested virtualization isn't working anymore.
I have a simple repro where I create a Windows 10 2004 guest and enable Hyper-V in it. This worked fine in 18.04 and specifically qemu <4.2 (I specifically tested Qemu 2.11-4.1 which work fine).
The -cpu arg I'm passing is simply:
-cpu host,l3-
Using that Windows won't boot because the nested hypervisor (Hyper-V) is unable to be initialize and so it just boot loops. Using the exact same qemu command works fine with 4.1 and lower.
Switching to a named CPU model like Skylake-
If I had to guess I think it would probably be related to this change https:/
For now I just have to keep an older build of QEMU to work around this. Let me know if there's anything else needed. I can also try out any patches. I already have at least a dozen copies of qemu lying around now.
Ok, after bisect between stable-4.1 and stable-4.2 I did confirm that https:/ /github. com/qemu/ qemu/commit/ 20a78b02d31534a e478779c2f2816c 273601e869 is the first bad commit.
The full qemu command line is:
qemu-system-x86_64 \ debug-threads= on \ kvm,kernel_ irqchip= on,mem- merge=off \ off,l3- cache=on, hv_relaxed, hv_spinlocks= 0x1fff, hv_vapic, hv_time \ 1,cores= 4,threads= 2 \ lost_tick_ policy= discard \ port,bus= pcie.0, id=root_ port1,chassis= 0,slot= 0 \ host=01: 00.0,id= hostdev1, bus=root_ port1,addr= 0x00,multifunct ion=on \ host=01: 00.1,id= hostdev2, bus=root_ port1,addr= 0x00.1 \ format= raw,readonly, file=OVMF_ CODE.fd \ format= raw,file= OVMF_VARS. fd \ id=drivec, file=disk. img,format= qcow2,cache= none,aio= threads \ id=iothread1 \ blk-pci, drive=drivec, scsi=off, iothread= iothread1 \ monitor. sock,server, nowait \ mouse-pci, id=input0 \ keyboard- pci,id= input1 \ id=kbd1, evdev=/ dev/input/ by-id/xxxxxxx, grab_all= yes,repeat= on \ id=mouse1, evdev=/ dev/input/ by-id/xxxxxx \ vnet,id= net0,script= no,downscript= no \
-name guest=test,
-serial none \
-enable-kvm \
-nodefaults \
-no-user-config \
-M q35,accel=
-m 8192 -mem-prealloc -no-hpet \
-cpu host,kvm=
-smp 8,sockets=
-global kvm-pit.
-rtc base=localtime \
-boot order=c \
-usb \
-device pcie-root-
-device vfio-pci,
-device vfio-pci,
-drive if=pflash,
-drive if=pflash,
-drive if=none,
-object iothread,
-device virtio-
-monitor unix:/tmp/
-device virtio-
-device virtio-
-object input-linux,
-object input-linux,
-netdev tap,ifname=
-device e1000,netdev=net0