From: Srivatsa Vaddagiri <vatsa@in.ibm.com>

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>
---

 25-akpm/arch/ppc64/kernel/smp.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletion(-)

diff -puN arch/ppc64/kernel/smp.c~ppc64-fix-cpu_up-race arch/ppc64/kernel/smp.c
--- 25/arch/ppc64/kernel/smp.c~ppc64-fix-cpu_up-race	2004-08-01 23:00:01.240344376 -0700
+++ 25-akpm/arch/ppc64/kernel/smp.c	2004-08-01 23:00:01.244343768 -0700
@@ -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 *unus
 #endif
 #endif
 
+	spin_lock(&call_lock);
+	cpu_set(cpu, cpu_online_map);
+	spin_unlock(&call_lock);
+
 	local_irq_enable();
 
 	return cpu_idle(NULL);
_