[PATCH] powerpc/smp: Fix Non-boot cpus cannot be bring up.

Dongsheng Wang dongsheng.wang at freescale.com
Mon Dec 22 17:38:40 AEDT 2014


From: Wang Dongsheng <dongsheng.wang at freescale.com>

Kernel cannot bring up Non-boot cpus always get "Processor xx is stuck".
this issue bring by http://patchwork.ozlabs.org/patch/418912/ (powerpc:
Secondary CPUs must set cpu_callin_map after setting active and online)
We need to take timebase after bootup cpu give the timebase firstly.

When start_secondary, non-boot cpus set cpu_callin_map for boot cpu
after that boot cpu will give the timebase for non-boot cpu. Otherwise
non-boot cpus will fall in dead loop to waiting bootup cpu to give
imebase.

Signed-off-by: Wang Dongsheng <dongsheng.wang at freescale.com>

diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index 8ec017c..9e29836 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -703,10 +703,6 @@ void start_secondary(void *unused)
 
 	if (smp_ops->setup_cpu)
 		smp_ops->setup_cpu(cpu);
-	if (smp_ops->take_timebase)
-		smp_ops->take_timebase();
-
-	secondary_cpu_time_init();
 
 #ifdef CONFIG_PPC64
 	if (system_state == SYSTEM_RUNNING)
@@ -746,6 +742,16 @@ void start_secondary(void *unused)
 	smp_wmb();
 	cpu_callin_map[cpu] = 1;
 
+	/*
+	 * We need to take timebase after bootup cpu give the timebase.
+	 * Base on cpu_callin_map move to here, so we also need move
+	 * take_timebase. Because bootup cpu waiting for cpu_callin_map
+	 * be set after that give_timebase can be executed.
+	 */
+	if (smp_ops->take_timebase)
+		smp_ops->take_timebase();
+	secondary_cpu_time_init();
+
 	local_irq_enable();
 
 	cpu_startup_entry(CPUHP_ONLINE);
-- 
2.1.0.27.g96db324



More information about the Linuxppc-dev mailing list