xen/arm: fix smpboot barriers
authorStefano Stabellini <sstabellini@kernel.org>
Wed, 7 Dec 2016 19:13:05 +0000 (11:13 -0800)
committerStefano Stabellini <sstabellini@kernel.org>
Wed, 7 Dec 2016 19:17:26 +0000 (11:17 -0800)
Remove useless smp_wmb() barrier after cpumask_set_cpu(cpuid,
&cpu_online_map), which is not synchronizing against anything.

Keep the other smp_wmb(), before the cpumask_set_cpu call, to ensure
that all writes before setting the cpu online are visible to other cpus.
For that to work properly, we need a corresponding smp_rmb() barrier,
after reading the online cpumask from other processors, which is
currently missing. Add it.

See: http://marc.info/?l=xen-devel&m=148093236307211

Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
Reviewed-by: Julien Grall <julien.grall@arm.com>
xen/arch/arm/smpboot.c

index 90ad1d0347ebeed1d308900b64cde0e3fa5db2fe..32e87221c096650c36cc91f9a910a55434888624 100644 (file)
@@ -307,11 +307,14 @@ void start_secondary(unsigned long boot_phys_offset,
 
     /* Run local notifiers */
     notify_cpu_starting(cpuid);
+    /*
+     * Ensure that previous writes are visible before marking the cpu as
+     * online.
+     */
     smp_wmb();
 
     /* Now report this CPU is up */
     cpumask_set_cpu(cpuid, &cpu_online_map);
-    smp_wmb();
 
     local_irq_enable();
     local_abort_enable();
@@ -408,6 +411,11 @@ int __cpu_up(unsigned int cpu)
         cpu_relax();
         process_pending_softirqs();
     }
+    /*
+     * Ensure that other cpus' initializations are visible before
+     * proceeding. Corresponds to smp_wmb() in start_secondary.
+     */
+    smp_rmb();
 
     /*
      * Nuke start of day info before checking one last time if the CPU