Commit d74b4e4f authored by James Morse's avatar James Morse Committed by Will Deacon

arm64: hibernate: Don't hibernate on systems with stuck CPUs

Hibernate relies on cpu hotplug to prevent secondary cores executing
the kernel text while it is being restored.

Add a call to cpus_are_stuck_in_kernel() to determine if there are
CPUs not counted by 'num_online_cpus()', and prevent hibernate in this
case.

Fixes: 82869ac5 ("arm64: kernel: Add support for hibernate/suspend-to-disk")
Acked-by: default avatarMark Rutland <mark.rutland@arm.com>
Signed-off-by: default avatarJames Morse <james.morse@arm.com>
Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
parent 5c492c3f
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include <asm/pgtable.h> #include <asm/pgtable.h>
#include <asm/pgtable-hwdef.h> #include <asm/pgtable-hwdef.h>
#include <asm/sections.h> #include <asm/sections.h>
#include <asm/smp.h>
#include <asm/suspend.h> #include <asm/suspend.h>
#include <asm/virt.h> #include <asm/virt.h>
...@@ -236,6 +237,11 @@ int swsusp_arch_suspend(void) ...@@ -236,6 +237,11 @@ int swsusp_arch_suspend(void)
unsigned long flags; unsigned long flags;
struct sleep_stack_data state; struct sleep_stack_data state;
if (cpus_are_stuck_in_kernel()) {
pr_err("Can't hibernate: no mechanism to offline secondary CPUs.\n");
return -EBUSY;
}
local_dbg_save(flags); local_dbg_save(flags);
if (__cpu_suspend_enter(&state)) { if (__cpu_suspend_enter(&state)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment