Bug 61411

Summary: [Nested]L2 guest failed to start in VMware on KVM
Product: Virtualization Reporter: Zhou, Chao (chao.zhou)
Component: kvmAssignee: virtualization_kvm
Status: VERIFIED CODE_FIX    
Severity: normal CC: mulix
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 3.11.0-rc1 Subsystem:
Regression: No Bisected commit-id:

Description Zhou, Chao 2013-09-16 06:54:06 UTC
Environment:
------------
Host OS (ia32/ia32e/IA64):ia32e
Guest OS (ia32/ia32e/IA64):ia32e
Guest OS Type (Linux/Windows):Windows
kvm.git Commit:6b9e4fa07443f5baf5bbd7ab043abd6976f8d7bc
qemu.git Commit:aaa6a40194e9f204cb853f64ef3c1e170bb014e8
Host Kernel Version:3.11.0-rc1
Hardware:Ivytown_EP, Romley_EP


Bug detailed description:
--------------------------
vmware product doesn't support foreign hypervisor, so if you want to start vmware in nested environment, please configure your vmware config file(.vmx) and add vmx.allowNested = "TRUE".

But after enable this option, when trying to start or install a VM, vmware will report 'intel VT-x implementation is incompatible with vmware'
note:
1.VMware product: VMware player and VMware Workstation

Reproduce steps:
----------------
1. qemu-system-x86_64 -enable-kvm -m 4G -smp 2 -net nic,macaddr=00:12:34:12:42:14 -net tap,script=/etc/kvm/qemu-ifup win7.qcow -cpu host  
2.install VMware player
3.use VMware player

Current result:
----------------
'intel VT-x implementation is incompatible with vmware'

Expected result:
----------------
L2 guest can boot up successfully in VMware on KVM

Basic root-causing log:
----------------------
Comment 1 Zhou, Chao 2014-09-02 04:35:18 UTC
kvm.git +qemu.git: fd275235_8b303011
test on Ivytown_EP
kernel version: 3.17.0-rc1
enable ignore_msrs(echo 1>/sys/module/kvm/parameters/ignore_msrs), then create L1 guest
qemu-system-x86_64 --enable-kvm -m 6G -smp 4 -net nic,macaddr=00:16:3e:5a:28:29 -net tap,script=/etc/kvm/qemu-ifup win7-nested.qcow2 -cpu host,-hypervisor
vmware boot up successfully
Comment 2 Zhou, Chao 2014-09-02 04:35:44 UTC
this commit fixed the bug:
commit a7c0b07d570848e50fce4d31ac01313484d6b844
Author: Wanpeng Li <wanpeng.li@linux.intel.com>
Date:   Thu Aug 21 19:46:50 2014 +0800

    KVM: nVMX: nested TPR shadow/threshold emulation
    
    This patch fix bug https://bugzilla.kernel.org/show_bug.cgi?id=61411
    
    TPR shadow/threshold feature is important to speed up the Windows guest.
    Besides, it is a must feature for certain VMM.
    
    We map virtual APIC page address and TPR threshold from L1 VMCS. If
    TPR_BELOW_THRESHOLD VM exit is triggered by L2 guest and L1 interested
    in, we inject it into L1 VMM for handling.
    
    Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: Wanpeng Li <wanpeng.li@linux.intel.com>
    [Add PAGE_ALIGNED check, do not write useless virtual APIC page address
     if TPR shadowing is disabled. - Paolo]
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>