xen: don't flush the TLB on grant unmap for auto-translated guests
PATCH 1/1 xen: don't flush the TLB on grant unmap 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.
--- xen/common/grant_table.c | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-)
xen/common/grant_table.c +8 -4
@@ -1099,7 +1099,8 @@ gnttab_unmap_grant_ref(guest_handle_add_offset (uop,1 ); } -flush_tlb_mask (current->domain->domain_dirty_cpumask); +if ( !paging_mode_external (current->domain) ) +flush_tlb_mask (current->domain->domain_dirty_cpumask);for ( i =0 ; i < partial_done; i++ )__gnttab_unmap_common_complete (&(common[i]));
@@ -1114,7 +1115,8 @@ gnttab_unmap_grant_ref(return 0 ; fault: -flush_tlb_mask (current->domain->domain_dirty_cpumask); +if ( !paging_mode_external (current->domain) ) +flush_tlb_mask (current->domain->domain_dirty_cpumask);for ( i =0 ; i < partial_done; i++ )__gnttab_unmap_common_complete (&(common[i]));
@@ -1162,7 +1164,8 @@ gnttab_unmap_and_replace(guest_handle_add_offset (uop,1 ); } -flush_tlb_mask (current->domain->domain_dirty_cpumask); +if ( !paging_mode_external (current->domain) ) +flush_tlb_mask (current->domain->domain_dirty_cpumask);for ( i =0 ; i < partial_done; i++ )__gnttab_unmap_common_complete (&(common[i]));
@@ -1177,7 +1180,8 @@ gnttab_unmap_and_replace(return 0 ; fault: -flush_tlb_mask (current->domain->domain_dirty_cpumask); +if ( !paging_mode_external (current->domain) ) +flush_tlb_mask (current->domain->domain_dirty_cpumask);for ( i =0 ; i < partial_done; i++ )__gnttab_unmap_common_complete (&(common[i]));
Signature · 7 lines
1.7.7.5 (Apple Git-26) _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Quoted 17 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]>--- xen/common/grant_table.c | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-)xen/common/grant_table.c +0
-0
xen/common/grant_table.c gnttab_unmap_grant_ref( · line 1103
Quoted 6 lines
xen/common/grant_table.c +2
-1@@ -1099,7 +1099,8 @@ gnttab_unmap_grant_ref(guest_handle_add_offset (uop,1 ); } -flush_tlb_mask (current->domain->domain_dirty_cpumask); +if ( !paging_mode_external (current->domain) ) +flush_tlb_mask (current->domain->domain_dirty_cpumask);
Introduce
void gnttab_flush_tlb(struct domain *d)
{
if ( !paging_mode_external(d) )
flush_tlb_mask(d->domain_dirty_cpumask);
}
?
David
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 28 lines
Quoted 1 line
Quoted 1 line · On 06.05.14 at 19:01, <[email protected]> wrote:
Quoted 17 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]>--- xen/common/grant_table.c | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-)xen/common/grant_table.c +0
-0xen/common/grant_table.c gnttab_unmap_grant_ref( · line 1103
Quoted 6 lines
xen/common/grant_table.c +2
-1@@ -1099,7 +1099,8 @@ gnttab_unmap_grant_ref(guest_handle_add_offset (uop,1 ); } -flush_tlb_mask (current->domain->domain_dirty_cpumask); +if ( !paging_mode_external (current->domain) ) +flush_tlb_mask (current->domain->domain_dirty_cpumask);Introduce
Quoted 5 lines
void
gnttab_flush_tlb(struct domain *d)
{
if ( !paging_mode_external(d) )
flush_tlb_mask(d->domain_dirty_cpumask);
}
Yes, please, but preferably as
static void gnttab_flush_tlb(const struct domain *d)
Also, while you might not be concerned about its performance, I'd highly appreciate if the one remaining use (in gnttab_transfer()) would also be inspected and - if suitable - replaced (or else a note added to the commit message clarifying why there the same can't be done).
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 34 lines · Jan Beulich
Quoted 28 lines
Quoted 1 line
Quoted 1 line · On 06.05.14 at 19:01, <[email protected]> wrote:
Quoted 17 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]>--- xen/common/grant_table.c | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-)xen/common/grant_table.c +0
-0xen/common/grant_table.c gnttab_unmap_grant_ref( · line 1103
Quoted 6 lines
xen/common/grant_table.c +2
-1@@ -1099,7 +1099,8 @@ gnttab_unmap_grant_ref(guest_handle_add_offset (uop,1 ); } -flush_tlb_mask (current->domain->domain_dirty_cpumask); +if ( !paging_mode_external (current->domain) ) +flush_tlb_mask (current->domain->domain_dirty_cpumask);Introduce
Quoted 5 lines
void
gnttab_flush_tlb(struct domain *d)
{
if ( !paging_mode_external(d) )
flush_tlb_mask(d->domain_dirty_cpumask);
}
Quoted 3 lines
Yes, please, but preferably as
static void
gnttab_flush_tlb(const struct domain *d)
Any reason not to make it static inline void?
Quoted 6 lines
Also, while you might not be concerned about its performance, I'd highly appreciate if the one remaining use (in
gnttab_transfer()) would also be inspected and - if suitable - replaced (or else a note added to the commit message clarifying why there the same can't be done).
Yes, I see the other caller of flush_tlb_mask, and guest_physmap_remove_page ends up calling p2m_set_entry, which is the same as the other callers, so AFAICT, the flush is not necessary there either.
Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 22 lines
Quoted 1 line
Quoted 1 line · On 07.05.14 at 12:00, <[email protected]> wrote:
Quoted 20 lines · Jan Beulich
Quoted 19 lines
Quoted 1 line
Quoted 1 line · On 06.05.14 at 19:01, <[email protected]> wrote:
xen/common/grant_table.c gnttab_unmap_grant_ref( · line 1103
Quoted 9 lines · Roger Pau Monne
xen/common/grant_table.c +2
-1@@ -1099,7 +1099,8 @@ gnttab_unmap_grant_ref(guest_handle_add_offset (uop,1 ); } -flush_tlb_mask (current->domain->domain_dirty_cpumask); +if ( !paging_mode_external (current->domain) ) +flush_tlb_mask (current->domain->domain_dirty_cpumask);Introduce
void
gnttab_flush_tlb(struct domain *d)
{
if ( !paging_mode_external(d) )
flush_tlb_mask(d->domain_dirty_cpumask);
}
Quoted 5 lines
Quoted 3 lines
Yes, please, but preferably as
static void
gnttab_flush_tlb(const struct domain *d)Any reason not to make it static inline void?
I don't mind the inline, but also don't insist on it.
Jan