[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen stable-4.7] xen/arm: fix smpboot barriers



commit 23077989038c076597be3d7852f51b80486cd157
Author:     Stefano Stabellini <sstabellini@xxxxxxxxxx>
AuthorDate: Wed Dec 7 11:13:05 2016 -0800
Commit:     Stefano Stabellini <sstabellini@xxxxxxxxxx>
CommitDate: Thu Jan 11 12:34:42 2018 -0800

    xen/arm: fix smpboot barriers
    
    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@xxxxxxxxxx>
    Reviewed-by: Julien Grall <julien.grall@xxxxxxx>
    (cherry picked from commit 779a0e15ca0d9d5dbcbdee29b1dad9faf73bfc77)
---
 xen/arch/arm/smpboot.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/smpboot.c b/xen/arch/arm/smpboot.c
index ba83406..81f3a59 100644
--- a/xen/arch/arm/smpboot.c
+++ b/xen/arch/arm/smpboot.c
@@ -307,12 +307,15 @@ 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 */
     smp_up_cpu = MPIDR_INVALID;
     cpumask_set_cpu(cpuid, &cpu_online_map);
-    smp_wmb();
 
     local_irq_enable();
     local_abort_enable();
@@ -407,6 +410,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
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.7

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.