xen: don't flush the TLB on grant ops for auto-translated guests
PATCH v2 1/1 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.
---
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(-)
xen/common/grant_table.c +11 -5
@@ -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 ) )
Signature · 7 lines
1.7.7.5 (Apple Git-26) _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 07.05.14 at 12:15, <[email protected]> wrote:
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é <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 8 lines · Roger Pau Monne
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é <[email protected]>Cc Jan Beulich <[email protected]>Cc Tim Deegan <[email protected]>Cc Ian Campbell <[email protected]>