]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
KVM: VMX: Fix cr8 exiting control clobbering by EPT
authorGleb Natapov <gleb@redhat.com>
Thu, 27 Aug 2009 15:41:30 +0000 (18:41 +0300)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 24 Sep 2009 15:44:08 +0000 (08:44 -0700)
commit 5fff7d270bd6a4759b6d663741b729cdee370257 upstream.

Don't call adjust_vmx_controls() two times for the same control.
It restores options that were dropped earlier.  This loses us the cr8
exit control, which causes a massive performance regression Windows x64.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
arch/x86/kvm/vmx.c

index 16003d1c173dbb7c239e6774be0ec00b75054046..b5fa966ec072facd828f1d0eda38cade66a38f46 100644 (file)
@@ -1217,12 +1217,9 @@ static __init int setup_vmcs_config(struct vmcs_config *vmcs_conf)
        if (_cpu_based_2nd_exec_control & SECONDARY_EXEC_ENABLE_EPT) {
                /* CR3 accesses and invlpg don't need to cause VM Exits when EPT
                   enabled */
-               min &= ~(CPU_BASED_CR3_LOAD_EXITING |
-                        CPU_BASED_CR3_STORE_EXITING |
-                        CPU_BASED_INVLPG_EXITING);
-               if (adjust_vmx_controls(min, opt, MSR_IA32_VMX_PROCBASED_CTLS,
-                                       &_cpu_based_exec_control) < 0)
-                       return -EIO;
+               _cpu_based_exec_control &= ~(CPU_BASED_CR3_LOAD_EXITING |
+                                            CPU_BASED_CR3_STORE_EXITING |
+                                            CPU_BASED_INVLPG_EXITING);
                rdmsr(MSR_IA32_VMX_EPT_VPID_CAP,
                      vmx_capability.ept, vmx_capability.vpid);
        }