Skip to contentSkip to conversation

Invalidate VPID mapping on INVLPG? [PATCH]

VPID Gianluca Guida 2 participants 2 messages Apr 30, 2008 – May 1, 2008

lore
Share & tools
lore
#0 lore raw

Hello,

In processors supporting VPID I think we should invalidate the VPID mapping in the TLB after a shadow invlpg (in case EPT is turned off).

Gianluca

xen/arch/x86/hvm/vmx/vmx.c +2 -1
diff -r 483d006cc607 xen/arch/x86/hvm/vmx/vmx.c
@@ -1368,7 +1368,8 @@ static void vmx_invlpg_intercept(unsigne
 {
     struct vcpu *curr = current;
     HVMTRACE_2D(INVLPG, curr, /*invlpga=*/ 0, vaddr);
-    paging_invlpg(curr, vaddr);
+    if ( paging_invlpg(curr, vaddr) )
+        vpid_sync_vcpu_gva(curr, vaddr);
 }
 
 #define CASE_SET_REG(REG, reg)      \
xen/include/asm-x86/hvm/vmx/vmx.h +6 -0
diff -r 483d006cc607 xen/include/asm-x86/hvm/vmx/vmx.h
@@ -301,6 +301,12 @@ static inline void ept_sync_all(void)
 
 void ept_sync_domain(struct domain *d);
 
+static inline void vpid_sync_vcpu_gva(struct vcpu *v, unsigned long gva)
+{
+    if ( cpu_has_vmx_vpid )
+        __invvpid(0, v->arch.hvm_vmx.vpid, (u64)gva);
+}
+
 static inline void vpid_sync_vcpu_all(struct vcpu *v)
 {
     if ( cpu_has_vmx_vpid )

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw

thanks, this is the right way to go.
-Xin

Quoted 17 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Gianluca Guida
Sent: 2008年4月30日 22:26
To: [email protected]
Subject: [Xen-devel] [VPID] Invalidate VPID mapping on INVLPG? [PATCH]

Hello,

In processors supporting VPID I think we should invalidate the VPID mapping in the TLB after a shadow invlpg (in case EPT is turned off).

Gianluca