[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v2] xen: don't flush the TLB on grant ops for auto-translated guests



For auto-translated guests the p2m code will do the necessary TLB
flushes, so there's no need to perform any TLB flushes in generic
grant table code.

Signed-off-by: Roger Pau Monnà <roger.pau@xxxxxxxxxx>
Cc: Jan Beulich <jbeulich@xxxxxxxx>
Cc: Tim Deegan <tim@xxxxxxx>
Cc: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
Changes since v1:
 - Pack the tlb flush code inside of a function.
 - Replace the remaining caller of flush_tlb_mask in gnttab_transfer.
---
 xen/common/grant_table.c |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index 107b000..00140a7 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -147,6 +147,12 @@ struct active_grant_entry {
 #define active_entry(t, e) \
     ((t)->active[(e)/ACGNT_PER_PAGE][(e)%ACGNT_PER_PAGE])
 
+static inline void gnttab_flush_tlb(const struct domain *d)
+{
+    if ( !paging_mode_external(d) )
+        flush_tlb_mask(d->domain_dirty_cpumask);
+}
+
 static inline unsigned int
 num_act_frames_from_sha_frames(const unsigned int num)
 {
@@ -1099,7 +1105,7 @@ gnttab_unmap_grant_ref(
             guest_handle_add_offset(uop, 1);
         }
 
-        flush_tlb_mask(current->domain->domain_dirty_cpumask);
+        gnttab_flush_tlb(current->domain);
 
         for ( i = 0; i < partial_done; i++ )
             __gnttab_unmap_common_complete(&(common[i]));
@@ -1114,7 +1120,7 @@ gnttab_unmap_grant_ref(
     return 0;
 
 fault:
-    flush_tlb_mask(current->domain->domain_dirty_cpumask);
+    gnttab_flush_tlb(current->domain);
 
     for ( i = 0; i < partial_done; i++ )
         __gnttab_unmap_common_complete(&(common[i]));
@@ -1162,7 +1168,7 @@ gnttab_unmap_and_replace(
             guest_handle_add_offset(uop, 1);
         }
         
-        flush_tlb_mask(current->domain->domain_dirty_cpumask);
+        gnttab_flush_tlb(current->domain);
         
         for ( i = 0; i < partial_done; i++ )
             __gnttab_unmap_common_complete(&(common[i]));
@@ -1177,7 +1183,7 @@ gnttab_unmap_and_replace(
     return 0;
 
 fault:
-    flush_tlb_mask(current->domain->domain_dirty_cpumask);
+    gnttab_flush_tlb(current->domain);
 
     for ( i = 0; i < partial_done; i++ )
         __gnttab_unmap_common_complete(&(common[i]));
@@ -1569,7 +1575,7 @@ gnttab_transfer(
         }
 
         guest_physmap_remove_page(d, gop.mfn, mfn, 0);
-        flush_tlb_mask(d->domain_dirty_cpumask);
+        gnttab_flush_tlb(d);
 
         /* Find the target domain. */
         if ( unlikely((e = rcu_lock_domain_by_id(gop.domid)) == NULL) )
-- 
1.7.7.5 (Apple Git-26)


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.