s390/smp: wait until secondaries are active & online
authorHeiko Carstens <heiko.carstens@de.ibm.com>
Mon, 30 Mar 2015 10:51:42 +0000 (12:51 +0200)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Mon, 13 Apr 2015 08:46:20 +0000 (10:46 +0200)
This is the s390 version of 875ebe940d77 ("powerpc/smp: Wait until secondaries
are active & online").
The race described in length within the commit message is also possible on s390
and every other architecture. So fix this race on s390 as well.

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

index d140160c9aec8e636bfd477983cf31131cd79662..efd2c1968000afadc669d1f23e740317a5b809be 100644 (file)
@@ -818,7 +818,8 @@ int __cpu_up(unsigned int cpu, struct task_struct *tidle)
        pcpu_prepare_secondary(pcpu, cpu);
        pcpu_attach_task(pcpu, tidle);
        pcpu_start_fn(pcpu, smp_start_secondary, NULL);
-       while (!cpu_online(cpu))
+       /* Wait until cpu puts itself in the online & active maps */
+       while (!cpu_online(cpu) || !cpu_active(cpu))
                cpu_relax();
        return 0;
 }