ARM: SMP: wait for CPU to be marked active
authorRussell King <rmk+kernel@arm.linux.org.uk>
Mon, 20 Jun 2011 15:46:01 +0000 (16:46 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Tue, 21 Jun 2011 10:09:05 +0000 (11:09 +0100)
When we bring a CPU online, we should wait for it to become active
before entering the idle thread, so we know that the scheduler and
thread migration is going to work.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/kernel/smp.c

index 344e52b16c8cd4234b523547d07a8b6ff9106bd6..e7f92a4321f370d0c9e9f9dc73460a0be65c014a 100644 (file)
@@ -318,9 +318,13 @@ asmlinkage void __cpuinit secondary_start_kernel(void)
        smp_store_cpu_info(cpu);
 
        /*
-        * OK, now it's safe to let the boot CPU continue
+        * OK, now it's safe to let the boot CPU continue.  Wait for
+        * the CPU migration code to notice that the CPU is online
+        * before we continue.
         */
        set_cpu_online(cpu, true);
+       while (!cpu_active(cpu))
+               cpu_relax();
 
        /*
         * OK, it's off to the idle thread for us