Bug 58921

Summary: [nested virt] L2 Windows guest can't boot up ('-cpu host' to start L1)
Product: Virtualization Reporter: Jay Ren (yongjie.ren)
Component: kvmAssignee: virtualization_kvm
Status: CLOSED CODE_FIX    
Severity: normal CC: alan, chao.zhou, nyh
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 3.10.0-rc1 Subsystem:
Regression: Yes Bisected commit-id:

Description Jay Ren 2013-05-29 02:40:57 UTC
Environment:
------------
Host OS (ia32/ia32e/IA64):ia32e
Guest OS (ia32/ia32e/IA64):ia32e
Guest OS Type (Linux/Windows): Windows
kvm.git next branch Commit:db6ae6158186a17
qemu-kvm Commit:b5803aa3583e82e513
Host Kernel Version:3.9.0-rc3
Hardware:SandyBridge-EP


Bug detailed description:
--------------------------
In 'kvm on kvm' nested virtualization environment,if I start L1 with '-cpu host', a Windows (e.g. Win7) guest can't boot up as L2 guest.

note: 
1. when creating a linux guest as L2 guest, L2 guest boot up fine
2. if starting L1 with '-cpu qemu64,+vmx', L2 Windows can boot up.
3. this should be a kvm kernel bug:
kvm next + qemu-kvm   =  result
db6ae615 + b5803aa3   = bad
188424ba + b5803aa3   = good

Reproduce steps:
----------------
1.create L1 guests:
qemu-system-x86_64 --enable-kvm -m 10240 -smp 8 -net nic,macaddr=00:12:45:67:2B:1C -net tap,script=/etc/kvm/qemu-ifup
nested-kvm-rhel6u4.qcow -cpu host
2. create L2 guests:
qemu-system-x86_64 -enable-kvm -m 1024 -smp 2 -net none win7.img


Current result:
----------------
L2 guest (win7 guest) failed to boot up.

Expected result:
----------------
L2 guest (win7 guest) boot up fine
Comment 1 Nadav Har'El 2013-06-03 10:48:19 UTC
This is a dup of bug 53641
Comment 2 Zhou, Chao 2013-11-04 06:51:19 UTC
this commit fixed the bug:
commit cd2633c59b6f511effb53e10fa2c1e20b1cec1e7
Author: Jan Kiszka <jan.kiszka@siemens.com>
Date:   Wed Oct 23 17:42:15 2013 +0100

    nVMX: Fix pick-up of uninjected NMIs

    __vmx_complete_interrupts stored uninjected NMIs in arch.nmi_injected,
    not arch.nmi_pending. So we actually need to check the former field in
    vmcs12_save_pending_event. This fixes the eventinj unit test when run
    in nested KVM.

    Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>