arm64: smp: Add function to determine if cpus are stuck in the kernel
authorJames Morse <james.morse@arm.com>
Wed, 22 Jun 2016 09:06:12 +0000 (10:06 +0100)
committerAKASHI Takahiro <takahiro.akashi@linaro.org>
Wed, 14 Jun 2017 04:43:18 +0000 (13:43 +0900)
commita88cf7061c396a9dcb6278ddacae6eaf499fc388
tree39e468098ae8f700dbd5d33de71ab8ccd884c6d2
parent4a9d7e312df8523c8270cfbab6330be0ccd53519
arm64: smp: Add function to determine if cpus are stuck in the kernel

kernel/smp.c has a fancy counter that keeps track of the number of CPUs
it marked as not-present and left in cpu_park_loop(). If there are any
CPUs spinning in here, features like kexec or hibernate may release them
by overwriting this memory.

This problem also occurs on machines using spin-tables to release
secondary cores.
After commit 44dbcc93ab67 ("arm64: Fix behavior of maxcpus=N")
we bring all known cpus into the secondary holding pen, meaning this
memory can't be re-used by kexec or hibernate.

Add a function cpus_are_stuck_in_kernel() to determine if either of these
cases have occurred.

Signed-off-by: James Morse <james.morse@arm.com>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Conflicts:
arch/arm64/include/asm/smp.h
due to missing commit 17eebd1a435c ("arm64: Add cpu_panic_kernel helper")
arch/arm64/include/asm/smp.h
arch/arm64/kernel/smp.c