]> git.hungrycats.org Git - linux/commitdiff
[PATCH] ppc64: Fix cpu_up race
authorSrivatsa Vaddagiri <vatsa@in.ibm.com>
Mon, 2 Aug 2004 03:10:56 +0000 (20:10 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Mon, 2 Aug 2004 03:10:56 +0000 (20:10 -0700)
Patch below fixes a cpu_up race in PPC64.

Signed-off-by: Srivatsa Vaddagiri <vatsa@in.ibm.com>
Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
arch/ppc64/kernel/smp.c

index f12b476c0c96a1712631a4891e4fe5e85132dd55..3a3207922717c1b1eaff1073838dea25cb6be375 100644 (file)
@@ -935,7 +935,11 @@ int __devinit __cpu_up(unsigned int cpu)
 
        if (smp_ops->give_timebase)
                smp_ops->give_timebase();
-       cpu_set(cpu, cpu_online_map);
+
+       /* Wait until cpu puts itself in the online map */
+       while (!cpu_online(cpu))
+               cpu_relax();
+
        return 0;
 }
 
@@ -971,6 +975,10 @@ int __devinit start_secondary(void *unused)
 #endif
 #endif
 
+       spin_lock(&call_lock);
+       cpu_set(cpu, cpu_online_map);
+       spin_unlock(&call_lock);
+
        local_irq_enable();
 
        return cpu_idle(NULL);