init: Pin init task to the boot CPU, initially
authorThomas Gleixner <tglx@linutronix.de>
Tue, 16 May 2017 18:42:32 +0000 (20:42 +0200)
committerIngo Molnar <mingo@kernel.org>
Tue, 23 May 2017 08:01:34 +0000 (10:01 +0200)
commit8fb12156b8db61af3d49f3e5e104568494581d1f
tree7a0bbfa7ff1a094ac918e8630f0993faec9c1173
parent8655d5497735b288f8a9b458bd22e7d1bf95bb61
init: Pin init task to the boot CPU, initially

Some of the boot code in init_kernel_freeable() which runs before SMP
bringup assumes (rightfully) that it runs on the boot CPU and therefore can
use smp_processor_id() in preemptible context.

That works so far because the smp_processor_id() check starts to be
effective after smp bringup. That's just wrong. Starting with SMP bringup
and the ability to move threads around, smp_processor_id() in preemptible
context is broken.

Aside of that it does not make sense to allow init to run on all CPUs
before sched_smp_init() has been run.

Pin the init to the boot CPU so the existing code can continue to use
smp_processor_id() without triggering the checks when the enabling of those
checks starts earlier.

Tested-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/20170516184734.943149935@linutronix.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
init/main.c