diff mbox

[v20,01/14] arm64: hibernate: Don't hibernate on systems with stuck CPUs

Message ID 97dcd35763eddf1b4c50a26d16389f313269f0c8.1466702804.git.geoff@infradead.org (mailing list archive)
State New, archived
Headers show

Commit Message

Geoff Levand June 23, 2016, 5:54 p.m. UTC
From: James Morse <james.morse@arm.com>

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: 82869ac57b5 ("arm64: kernel: Add support for hibernate/suspend-to-disk")
Signed-off-by: James Morse <james.morse@arm.com>
---
 arch/arm64/kernel/hibernate.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

James Morse June 27, 2016, 11:04 a.m. UTC | #1
Hi

On 23/06/16 18:54, Geoff Levand wrote:
> From: James Morse <james.morse@arm.com>
> 
> 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: 82869ac57b5 ("arm64: kernel: Add support for hibernate/suspend-to-disk")
> Signed-off-by: James Morse <james.morse@arm.com>
> ---
>  arch/arm64/kernel/hibernate.c | 6 ++++++
>  1 file changed, 6 insertions(+)


... this patch isn't necessary for kexec, it wired up the helper function you
have in patch 2 for hibernate.

Please drop this in any future posting!


Thanks,

James
Geoff Levand June 27, 2016, 4:44 p.m. UTC | #2
Hi,

On Mon, 2016-06-27 at 12:04 +0100, James Morse wrote:
> ... this patch isn't necessary for kexec, it wired up the helper
> function you
> have in patch 2 for hibernate.
> 
> Please drop this in any future posting!

It seems both your patches I had went in for -rc5, so
they're gone now from my master.

-Geoff
diff mbox

Patch

diff --git a/arch/arm64/kernel/hibernate.c b/arch/arm64/kernel/hibernate.c
index f8df75d..21ab5df 100644
--- a/arch/arm64/kernel/hibernate.c
+++ b/arch/arm64/kernel/hibernate.c
@@ -33,6 +33,7 @@ 
 #include <asm/pgtable.h>
 #include <asm/pgtable-hwdef.h>
 #include <asm/sections.h>
+#include <asm/smp.h>
 #include <asm/suspend.h>
 #include <asm/virt.h>
 
@@ -236,6 +237,11 @@  int swsusp_arch_suspend(void)
 	unsigned long flags;
 	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);
 
 	if (__cpu_suspend_enter(&state)) {