Xen 
 
Home About Xen.org Xen Xen Summit Wiki Mailing List Bug Tracker Xen Downloads
 
   
 

xen-devel

[Xen-devel] Re: [PATCH] Flush stale TLBs

To: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] Re: [PATCH] Flush stale TLBs
From: Ben Guthro <bguthro@xxxxxxxxxxxxxxx>
Date: Tue, 30 Oct 2007 10:45:00 -0400
Cc: Robert Phillips <rphillips@xxxxxxxxxxxxxxx>
Delivery-date: Tue, 30 Oct 2007 07:45:42 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <47273D31.6030303@xxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <47273D31.6030303@xxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 2.0.0.5 (X11/20070719)
Apologies. The prior version caused build errors in unstable.
Please use the attached version instead


Ben Guthro wrote:
This patch causes a flush of the local host TLBs after any
modification of the linearpagetable mapping.

This was not needed when vmenter/vmexit always had the side effect of
flushing host TLBs.

But, with SVM ASIDs, it is possible to:
(1) Update CR3 update,
(2) vmenter the guest, and
(3) and vmexit due to a page fault
all without an intervening host TLB flush.

Then the page fault code could use the linear pagetable
to read a top-level shadow page table entry.

But, without this change, it would fetch the wrong value
due to a stale TLB.

This code applies to unstable. 
We also have a 3.1.2 version available upon request.

Signed-off-by: Robert Phillips <rphillips@xxxxxxxxxxxxxxx>
Signed-off-by: Ben Guthro <bguthro@xxxxxxxxxxxxxxx>
  

diff -r 5612da277300 xen/arch/x86/mm/shadow/multi.c
--- a/xen/arch/x86/mm/shadow/multi.c    Mon Oct 29 07:54:17 2007 -0400
+++ b/xen/arch/x86/mm/shadow/multi.c    Mon Oct 29 07:56:15 2007 -0400
@@ -3392,6 +3392,20 @@ sh_update_linear_entries(struct vcpu *v)
 #else
 #error this should not happen
 #endif
+    if ( shadow_mode_external(d) )
+    {
+        /* Having modified the linear pagetable mapping, flush local host TLBs.
+         * This was not needed when vmenter/vmexit always had the side effect 
of
+         * flushing host TLBs but, with SVM ASIDs, it is possible to
+         * finish this CR3 update, vmenter the guest, vmexit due to a
+         * page fault, without an intervening host TLB flush.
+         * Then the page fault code could use the linear pagetable
+         * to read a top-level shadow page table entry.
+         * But, without this change, it would fetch the wrong value
+         * due to a stale TLB.
+         */
+        flush_tlb_local();
+    }
 }
 
 
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>