Skip to contentSkip to conversation

xen/x86: Drop unnecessary barriers

PATCH In review Andrew Cooper 2 participants 2 messages Jan 2, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/x86: Drop unnecessary barriers

x86's current implementation of wmb() is a compiler barrier. As a result, the only change in this patch is to remove an mfence instruction from cpuidle_disable_deep_cstate().

None of these barriers serve any purpose. They are not synchronising with remote cpus, and their compiler-barrier properties are not needed for correctness purposes.

Furthermore, these wmb()'s specifically do not want to turn into sfence instructions in future changes where wmb()'s implementation is corrected.

---
CC: Jan Beulich <[email protected]>

---
 xen/arch/x86/acpi/cpu_idle.c  | 2 --
 xen/arch/x86/cpu/mcheck/mce.c | 3 ---
 xen/arch/x86/crash.c          | 3 ---
 xen/arch/x86/smpboot.c        | 2 --
 4 files changed, 10 deletions(-)
xen/arch/x86/acpi/cpu_idle.c +0 -2
index 884ee32..cb1c5da 100644
@@ -1341,8 +1341,6 @@ void cpuidle_disable_deep_cstate(void)
             max_cstate = 1;
     }
 
-    mb();
-
     hpet_disable_legacy_broadcast();
 }
 
xen/arch/x86/cpu/mcheck/mce.c +0 -3
index df0106e..a8c287d 100644
@@ -86,7 +86,6 @@ static x86_mce_vector_t _machine_check_vector = unexpected_machine_check;
 void x86_mce_vector_register(x86_mce_vector_t hdlr)
 {
     _machine_check_vector = hdlr;
-    wmb();
 }
 
 /* Call the installed machine check handler for this CPU setup. */
@@ -385,8 +384,6 @@ mcheck_mca_logout(enum mca_source who, struct mca_banks *bankmask,
             mcabank_clear(i);
         else if ( who == MCA_MCE_SCAN && need_clear )
             mcabanks_set(i, clear_bank);
-
-        wmb();
     }
 
     if ( mig && errcnt > 0 )
xen/arch/x86/crash.c +0 -3
index 82535c4..8d74258 100644
@@ -146,9 +146,6 @@ static void nmi_shootdown_cpus(void)
     write_atomic((unsigned long *)__va(__pa(&exception_table[TRAP_nmi])),
                  (unsigned long)&do_nmi_crash);
 
-    /* Ensure the new callback function is set before sending out the NMI. */
-    wmb();
-
     smp_send_nmi_allbutself();
 
     msecs = 1000; /* Wait at most a second for the other cpus to stop */
xen/arch/x86/smpboot.c +0 -2
index 0e585b3..7b97ff8 100644
@@ -361,7 +361,6 @@ void start_secondary(void *unused)
     spin_debug_enable();
     set_cpu_sibling_map(cpu);
     notify_cpu_starting(cpu);
-    wmb();
 
     /*
      * We need to hold vector_lock so there the set of online cpus
@@ -377,7 +376,6 @@ void start_secondary(void *unused)
     local_irq_enable();
     mtrr_ap_init();
 
-    wmb();
     startup_cpu_idle_loop();
 }
 
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 02.01.18 at 15:17, <[email protected]> wrote:

x86's current implementation of wmb() is a compiler barrier. As a result, the only change in this patch is to remove an mfence instruction from cpuidle_disable_deep_cstate().

Quoted 8 lines

None of these barriers serve any purpose. They are not synchronising with remote cpus, and their compiler-barrier properties are not needed for correctness purposes.

Furthermore, these wmb()'s specifically do not want to turn into sfence instructions in future changes where wmb()'s implementation is corrected.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel