x86: reduce IRQs disabled section in flush_area_local()
authorJan Beulich <jbeulich@suse.com>
Mon, 9 Jul 2018 08:51:33 +0000 (10:51 +0200)
committerJan Beulich <jbeulich@suse.com>
Mon, 9 Jul 2018 08:51:33 +0000 (10:51 +0200)
Only the pre_flush() / post_flush() section actually needs to run with
interrupts disabled.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/flushtlb.c

index 797c5d52cca962b5d5a7fc674a6e127504477b3b..0d550f9e933dfa4308bc572f348ce1385b52b2d9 100644 (file)
@@ -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;