]> xenbits.xensource.com Git - people/iwj/xen.git/commitdiff
xen/arm: move the tlb_flush in create_p2m_entries to the end of the function
authorStefano Stabellini <stefano.stabellini@eu.citrix.com>
Mon, 29 Apr 2013 17:04:26 +0000 (18:04 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Tue, 30 Apr 2013 10:31:33 +0000 (11:31 +0100)
Move the flush after the pagetable entry has actually been written to
avoid races with other vcpus refreshing the same entriy.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
xen/arch/arm/p2m.c

index 1e8c8b40279bb3a5ce4cfbfc418b32736fe2b2bb..9fc55346d79c636ceeece1f4a4b6b5dcd6ba7507 100644 (file)
@@ -133,7 +133,7 @@ static int create_p2m_entries(struct domain *d,
                      paddr_t maddr,
                      int mattr)
 {
-    int rc;
+    int rc, flush;
     struct p2m_domain *p2m = &d->arch.p2m;
     lpae_t *first = NULL, *second = NULL, *third = NULL;
     paddr_t addr;
@@ -186,10 +186,8 @@ static int create_p2m_entries(struct domain *d,
             third = map_domain_page(second[second_table_offset(addr)].p2m.base);
             cur_second_offset = second_table_offset(addr);
         }
-        /* else: third already valid */
 
-        if ( third[third_table_offset(addr)].p2m.valid )
-            flush_tlb_all_local();
+        flush = third[third_table_offset(addr)].p2m.valid;
 
         /* Allocate a new RAM page and attach */
         switch (op) {
@@ -226,6 +224,9 @@ static int create_p2m_entries(struct domain *d,
                 }
                 break;
         }
+
+        if ( flush )
+            flush_tlb_all_local();
     }
 
     rc = 0;