ARM: smp: use a per-CPU variable to record the CPU number

Currently, the CPU number is accessed via thread_info on the stack, but
this will be problematic once we move it out of there, which is
preferable for security/robustness reasons.

So instead, when building for targets that implement the thread ID
registers (and therefore don't rely on thread_info.cpu to access per-CPU
variables), use a per-CPU variable for the CPU number.

Signed-off-by: Ard Biesheuvel <>
2 files changed