Skip to contentSkip to conversation

EPT support breakage on: KVM: VMX: Zero ept module parameter if ept is not present

PATCH Andrew Theurer 2 participants 3 messages Mar 31, 2009 – Apr 1, 2009

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

I cannot get EPT support to work on commit:
21f65ab2c582594a69dcb1484afa9f88b3414b4f
KVM: VMX: Zero ept module parameter if ept is not present

I see tons of pf_guest from kvm_stat, where as the previous commit has none. I am using "ept=1" module option for kvm-intel.

This is on Nehalem processors.

-Andrew

commit diff:

arch/x86/kvm/vmx.c +0 -0
index 8b1b9b8..96a19f8 100644 (file)
@@ -265,7 +265,7 @@ static inline int cpu_has_vmx_ept(void)
 

static inline int vm_need_ept(void)
{
- return (cpu_has_vmx_ept() && enable_ept);
+ return enable_ept;
}

static inline int vm_need_virtualize_apic_accesses(struct kvm *kvm)
@@ -1205,6 +1205,9 @@ static __init int setup_vmcs_config(struct vmcs_config *vmcs_conf)

       if (!cpu_has_vmx_vpid())
               enable_vpid = 0;

+ if (!cpu_has_vmx_ept())
+ enable_ept = 0;
+

       min = 0;
#ifdef CONFIG_X86_64
       min |= VM_EXIT_HOST_ADDR_SPACE_SIZE;
#1 lore raw

Oops... Thanks very much for reporting! I can't believe we haven't awared of that...

Could you please try the attached patch? Thanks!

arch/x86/kvm/vmx.c +9 -9
index aba41ae..8d6465b 100644
@@ -1195,15 +1195,6 @@ static __init int setup_vmcs_config(struct vmcs_config *vmcs_conf)
 		      vmx_capability.ept, vmx_capability.vpid);
 	}
 
-	if (!cpu_has_vmx_vpid())
-		enable_vpid = 0;
-
-	if (!cpu_has_vmx_ept())
-		enable_ept = 0;
-
-	if (!(vmcs_config.cpu_based_2nd_exec_ctrl & SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES))
-		flexpriority_enabled = 0;
-
 	min = 0;
 #ifdef CONFIG_X86_64
 	min |= VM_EXIT_HOST_ADDR_SPACE_SIZE;
@@ -1307,6 +1298,15 @@ static __init int hardware_setup(void)
 	if (boot_cpu_has(X86_FEATURE_NX))
 		kvm_enable_efer_bits(EFER_NX);
 
+	if (!cpu_has_vmx_vpid())
+		enable_vpid = 0;
+
+	if (!cpu_has_vmx_ept())
+		enable_ept = 0;
+
+	if (!(vmcs_config.cpu_based_2nd_exec_ctrl & SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES))
+		flexpriority_enabled = 0;
+
 	return alloc_kvm_area();
 }
 
Signature · 2 lines
regards
Yang, Sheng
#2 lore raw
Quoted 5 lines · Sheng Yang

Oops... Thanks very much for reporting! I can't believe we haven't awared of that...

Could you please try the attached patch? Thanks!

Tested and works great. Thanks!

-Andrew

Quoted 37 lines
arch/x86/kvm/vmx.c +9 -9
index aba41ae..8d6465b 100644
@@ -1195,15 +1195,6 @@ static __init int setup_vmcs_config(struct vmcs_config *vmcs_conf)
 		      vmx_capability.ept, vmx_capability.vpid);
 	}
 
-	if (!cpu_has_vmx_vpid())
-		enable_vpid = 0;
-
-	if (!cpu_has_vmx_ept())
-		enable_ept = 0;
-
-	if (!(vmcs_config.cpu_based_2nd_exec_ctrl & SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES))
-		flexpriority_enabled = 0;
-
 	min = 0;
 #ifdef CONFIG_X86_64
 	min |= VM_EXIT_HOST_ADDR_SPACE_SIZE;
@@ -1307,6 +1298,15 @@ static __init int hardware_setup(void)
 	if (boot_cpu_has(X86_FEATURE_NX))
 		kvm_enable_efer_bits(EFER_NX);
 
+	if (!cpu_has_vmx_vpid())
+		enable_vpid = 0;
+
+	if (!cpu_has_vmx_ept())
+		enable_ept = 0;
+
+	if (!(vmcs_config.cpu_based_2nd_exec_ctrl & SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES))
+		flexpriority_enabled = 0;
+
 	return alloc_kvm_area();
 }