Skip to contentSkip to conversation

KVM: VMX: Flush all VPID tagged TLB when VMXON

PATCH In review Yang, Sheng 2 participants 3 messages Jun 17, 2008 – Jun 23, 2008

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

PATCH 1/1 KVM: VMX: Flush all VPID tagged TLB when VMXON

From efba05901f8ffca03208217d075f679f78f3469d Mon Sep 17 00:00:00 2001
From: Sheng Yang <[email protected]>
Date: Tue, 17 Jun 2008 17:41:10 +0800
Subject: [PATCH] KVM: VMX: Flush all VPID tagged TLB when VMXON

---
 arch/x86/kvm/vmx.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
arch/x86/kvm/vmx.c +0 -0
index 6e4278d..d6caea3 100644
@@ -358,6 +358,12 @@ static inline void vpid_sync_vcpu_all(struct 

vcpu_vmx *vmx)
__invvpid(VMX_VPID_EXTENT_SINGLE_CONTEXT, vmx->vpid, 0);
}

+static inline void vpid_sync_all(void)
+{
+ if (cpu_has_vmx_vpid())
+ __invvpid(VMX_VPID_EXTENT_ALL_CONTEXT, 0, 0);
+}
+
static inline void ept_sync_global(void)
{
if (cpu_has_vmx_invept_global())
@@ -3292,6 +3298,7 @@ static int __init vmx_init(void)
kvm_mmu_set_nonpresent_ptes(~0xffeull, 0ull);

ept_sync_global();
+ vpid_sync_all();

return 0;

--
1.5.5

From efba05901f8ffca03208217d075f679f78f3469d Mon Sep 17 00:00:00 2001
From: Sheng Yang <[email protected]>
Date: Tue, 17 Jun 2008 17:41:10 +0800
Subject: [PATCH] KVM: VMX: Flush all VPID tagged TLB when VMXON

---
 arch/x86/kvm/vmx.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
arch/x86/kvm/vmx.c +7 -0
index 6e4278d..d6caea3 100644
@@ -358,6 +358,12 @@ static inline void vpid_sync_vcpu_all(struct vcpu_vmx *vmx)
 	__invvpid(VMX_VPID_EXTENT_SINGLE_CONTEXT, vmx->vpid, 0);
 }
 
+static inline void vpid_sync_all(void)
+{
+	if (cpu_has_vmx_vpid())
+		__invvpid(VMX_VPID_EXTENT_ALL_CONTEXT, 0, 0);
+}
+
 static inline void ept_sync_global(void)
 {
 	if (cpu_has_vmx_invept_global())
@@ -3292,6 +3298,7 @@ static int __init vmx_init(void)
 		kvm_mmu_set_nonpresent_ptes(~0xffeull, 0ull);
 
 	ept_sync_global();
+	vpid_sync_all();
 
 	return 0;
 
Signature · 1 line
1.5.5
#1 lore raw
Quoted 6 lines · Sheng

From efba05901f8ffca03208217d075f679f78f3469d Mon Sep 17 00:00:00 2001
From: Sheng Yang <[email protected]>
Date: Tue, 17 Jun 2008 17:41:10 +0800
Subject: [PATCH] KVM: VMX: Flush all VPID tagged TLB when VMXON

Why is this needed? Don't we flush a vpid immediately after allocating it?

Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
#2 lore raw
Quoted 7 lines · On Sunday 22 June 2008 15:35:35 Avi Kivity wrote:
Quoted 4 lines · Sheng

From efba05901f8ffca03208217d075f679f78f3469d Mon Sep 17 00:00:00 2001
From: Sheng Yang <[email protected]>
Date: Tue, 17 Jun 2008 17:41:10 +0800
Subject: [PATCH] KVM: VMX: Flush all VPID tagged TLB when VMXON

Why is this needed? Don't we flush a vpid immediately after allocating it?

O, damn, I had a bad memory...

Please ignore this...

Signature · 2 lines
Thanks
Yang, Sheng