[xen staging] x86: reduce IRQs disabled section in flush_area_local()

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[xen staging] x86: reduce IRQs disabled section in flush_area_local()

patchbot
commit 8b77e779caa4b03961dc56abb1079fa6d77c60b9
Author:     Jan Beulich <[hidden email]>
AuthorDate: Mon Jul 9 10:51:33 2018 +0200
Commit:     Jan Beulich <[hidden email]>
CommitDate: Mon Jul 9 10:51:33 2018 +0200

    x86: reduce IRQs disabled section in flush_area_local()
   
    Only the pre_flush() / post_flush() section actually needs to run with
    interrupts disabled.
   
    Signed-off-by: Jan Beulich <[hidden email]>
    Acked-by: Andrew Cooper <[hidden email]>
---
 xen/arch/x86/flushtlb.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/flushtlb.c b/xen/arch/x86/flushtlb.c
index 797c5d52cc..0d550f9e93 100644
--- a/xen/arch/x86/flushtlb.c
+++ b/xen/arch/x86/flushtlb.c
@@ -76,7 +76,13 @@ static void post_flush(u32 t)
 
 static void do_tlb_flush(void)
 {
-    u32 t = pre_flush();
+    unsigned long flags;
+    u32 t;
+
+    /* This non-reentrant function is sometimes called in interrupt context. */
+    local_irq_save(flags);
+
+    t = pre_flush();
 
     if ( use_invpcid )
         invpcid_flush_all();
@@ -89,6 +95,8 @@ static void do_tlb_flush(void)
     }
 
     post_flush(t);
+
+    local_irq_restore(flags);
 }
 
 void switch_cr3_cr4(unsigned long cr3, unsigned long cr4)
@@ -147,10 +155,6 @@ void switch_cr3_cr4(unsigned long cr3, unsigned long cr4)
 unsigned int flush_area_local(const void *va, unsigned int flags)
 {
     unsigned int order = (flags - 1) & FLUSH_ORDER_MASK;
-    unsigned long irqfl;
-
-    /* This non-reentrant function is sometimes called in interrupt context. */
-    local_irq_save(irqfl);
 
     if ( flags & (FLUSH_TLB|FLUSH_TLB_GLOBAL) )
     {
@@ -218,8 +222,6 @@ unsigned int flush_area_local(const void *va, unsigned int flags)
         }
     }
 
-    local_irq_restore(irqfl);
-
     if ( flags & FLUSH_ROOT_PGTBL )
         get_cpu_info()->root_pgt_changed = true;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging

_______________________________________________
Xen-changelog mailing list
[hidden email]
https://lists.xenproject.org/xen-changelog