[S390] cpu hotplug: on cpu start wait until being marked active
authorHeiko Carstens <heiko.carstens@de.ibm.com>
Wed, 3 Aug 2011 14:44:27 +0000 (16:44 +0200)
committerHeiko Carstens <heiko.carstens@de.ibm.com>
Wed, 3 Aug 2011 14:44:20 +0000 (16:44 +0200)
This is the same as fd8a7de1 "x86: cpu-hotplug: Prevent softirq wakeup
on wrong CPU".
Unlike on x86 this doesn't fix a bug on s390 since we do not have
threaded interrupt handlers. However we want to keep the same
initialization order like on x86. This should prevent bugs caused by
code which assumes (and relies on) the init order is the same on each
architecture.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
arch/s390/kernel/smp.c

index 70f4b9604575b327841ba733802054a2dab87d32..86371fdd68e7f1e0f623b8710c855ac4c619c5d8 100644 (file)
@@ -473,7 +473,12 @@ int __cpuinit start_secondary(void *cpuvoid)
        S390_lowcore.restart_psw.addr =
                PSW_ADDR_AMODE | (unsigned long) psw_restart_int_handler;
        __ctl_set_bit(0, 28); /* Enable lowcore protection */
-       /* Switch on interrupts */
+       /*
+        * Wait until the cpu which brought this one up marked it
+        * active before enabling interrupts.
+        */
+       while (!cpumask_test_cpu(smp_processor_id(), cpu_active_mask))
+               cpu_relax();
        local_irq_enable();
        /* cpu_idle will call schedule for us */
        cpu_idle();