Description:
Nested virtualization, take KVM host as L0, create guest on it, install Xen on guest, then guest cannot boot up from Xen and keep rebooting.
Reproduce steps:
1. Enable KVM nested on host(L0)
rmmod kvm_intel
modprobe kvm_intel nested=y
cat /sys/module/kvm_intel/parameters/nested
Y
2.Create L1 guest via qemu:
qemu-system-x86_64 -accel kvm -cpu host -drive file=rhel8.img,if=none,id=virtio-disk0 -device virtio-blk-pci,drive=virtio-disk0 -m 7168 -smp 8 -monitor pty -cpu host -device virtio-net-pci,netdev=nic0,mac=00:16:3e:72:5e:0a -netdev tap,id=nic0,br=virbr0,helper=/usr/libexec/qemu-bridge-helper,vhost=on
-serial stdio
3. Build and install Xen on L1 guest
4. Reboot L1 and make it boot from Xen
Then L1 keep rebooting, full log attached.
……
(XEN) Running stub recovery selftests...
(XEN) traps.c:1590: GPF (0000): ffff82d0bfffe041 [ffff82d0bfffe041] -> ffff82d08038e40c
(XEN) traps.c:785: Trap 12: ffff82d0bfffe040 [ffff82d0bfffe040] -> ffff82d08038e40c
(XEN) traps.c:1124: Trap 3: ffff82d0bfffe041 [ffff82d0bfffe041] -> ffff82d08038e40c
(XEN) ----[ Xen-4.14-unstable x86_64 debug=y Tainted: C ]----
(XEN) CPU: 0
(XEN) RIP: e008:[<ffff82d08043a8bc>] core2_vpmu_init+0xa5/0x221
(XEN) RFLAGS: 0000000000010202 CONTEXT: hypervisor
(XEN) rax: 0000000008300802 rbx: 0000000000000000 rcx: 0000000000000345
(XEN) rdx: 0000000000000004 rsi: 000000000000000a rdi: 0000000000000063
(XEN) rbp: ffff82d0804b7d68 rsp: ffff82d0804b7d58 r8: 0000000000000004
(XEN) r9: 0000000000000008 r10: ffff82d0805effe0 r11: 0000000000000032
(XEN) r12: 0000000000000002 r13: 0000000000000008 r14: ffff82d0805dd0c0
(XEN) r15: ffff82d0805de300 cr0: 000000008005003b cr4: 00000000003526e0
(XEN) cr3: 00000000bfca4000 cr2: 0000000000000000
(XEN) fsb: 0000000000000000 gsb: 0000000000000000 gss: 0000000000000000
(XEN) ds: 0000 es: 0000 fs: 0000 gs: 0000 ss: 0000 cs: e008
(XEN) Xen code around <ffff82d08043a8bc> (core2_vpmu_init+0xa5/0x221):
(XEN) 00 06 00 b9 45 03 00 00 <0f> 32 48 89 c1 48 c1 e9 0d 83 e1 01 88 0d 32 00
(XEN) Xen stack trace from rsp=ffff82d0804b7d58:
(XEN) ffff82d080452168 ffff82d080452248 ffff82d0804b7d78 ffff82d08043a622
(XEN) ffff82d0804b7d98 ffff82d08040dcb0 0000000000000008 0000000000000000
(XEN) ffff82d0804b7ee8 ffff82d0804339db 0000000001fb4fff 00000000000001f6
(XEN) ffff83000009de80 ffffffff00000000 000ffff82d0807f6 0000000000000002
(XEN) 0000000000000002 0000000000000002 0000000000000002 0000000000000002
(XEN) 0000000000000001 0000000000000001 0000000000100000 ffff82d08047ac00
(XEN) 0000000000200000 ffff82d08047acdc 0000000100000008 0000000000000007
(XEN) 0000000001fb4000 0000000000000000 0000000000000007 ffff83000009dd20
(XEN) ffff83000009de80 ffff83000009dfb0 0000000000000000 0000000000000000
(XEN) 0000000400000000 0000000000000000 ffffffffffffffff 00000000ffffffff
(XEN) 0000000800000000 000000010000006e 0000000000000003 00000000000002f8
(XEN) 0000000000000002 0000000000000000 0000000000000000 0000000000000000
(XEN) 0000000000000000 0000000000000000 0000000000000000 ffff82d0802000ec
(XEN) 0000000000000000 0000000000000000 0000000000000000 0000000000000000
(XEN) 0000000000000000 0000000000000000 0000000000000000 0000000000000000
(XEN) 0000000000000000 0000000000000000 0000000000000000 0000000000000000
(XEN) 0000000000000000 0000000000000000 0000000000000000 0000000000000000
(XEN) 0000000000000000 0000000000000000 0000000000000000 0000000000000000
(XEN) 0000000000000000 0000000000000000 0000000000000000 0000000000000000
(XEN) 0000000000000000 0000e01000000000 ffff8301f136e000 0000000000000000
(XEN) Xen call trace:
(XEN) [<ffff82d08043a8bc>] R core2_vpmu_init+0xa5/0x221
(XEN) [<ffff82d08043a622>] F arch/x86/cpu/vpmu.c#vpmu_init+0xc4/0x100
(XEN) [<ffff82d08040dcb0>] F do_initcalls+0x35/0x44
(XEN) [<ffff82d0804339db>] F __start_xen+0x22d7/0x2808
(XEN) [<ffff82d0802000ec>] F __high_start+0x4c/0x4e
(XEN)
(XEN)
(XEN) ****************************************
(XEN) Panic on CPU 0:
(XEN) GENERAL PROTECTION FAULT
(XEN) [error_code=0000]
(XEN) ****************************************
(XEN)
(XEN) Reboot in five seconds...
Environment:
Host(L0):
KVM:
https://git.kernel.org/pub/scm/virt/kvm/kvm.git/
Branch: next
Commit: ead68df94d248c80fdbae220ae5425eb5af2e753
Kernel version: 5.6.0_rc1
Qemu:
https://git.qemu.org/git/qemu.git
Branch: master
Commit:
88e2b97aa3e369a454c9d8360afddc348070c708
Guest(L1):
Xen: https://xenbits.xen.org/git-http/xen.git
Branch:
master
Commit: c47984aabead53918e5ba6d43cdb3f1467452739
Xen version: 4.14-unstable
Host OS(L0): Red Hat Enterprise Linux 8.1
Guest OS(L1): Red Hat Enterprise Linux 8.1
Thanks,
Fan