linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: geoff@infradead.org (Geoff Levand)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v20 01/14] arm64: hibernate: Don't hibernate on systems with stuck CPUs
Date: Thu, 23 Jun 2016 17:54:48 +0000	[thread overview]
Message-ID: <97dcd35763eddf1b4c50a26d16389f313269f0c8.1466702804.git.geoff@infradead.org> (raw)
In-Reply-To: <cover.1466702804.git.geoff@infradead.org>

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(+)

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)) {
-- 
2.5.0

  parent reply	other threads:[~2016-06-23 17:54 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-23 17:54 [PATCH v20 00/14] arm64 kexec kernel patches Geoff Levand
2016-06-23 17:54 ` [PATCH v20 06/14] arm64/kexec: Add pr_debug output Geoff Levand
2016-06-23 17:54 ` [PATCH v20 07/14] arm64: kdump: reserve memory for crash dump kernel Geoff Levand
2016-06-23 17:54 ` [PATCH v20 04/14] arm64/kexec: Add core kexec support Geoff Levand
2016-06-27 11:18   ` James Morse
2016-06-27 14:39     ` Catalin Marinas
2016-06-27 16:29       ` James Morse
2016-06-27 17:00         ` Geoff Levand
2016-06-23 17:54 ` [PATCH v20 02/14] arm64: smp: Add function to determine if cpus are stuck in the kernel Geoff Levand
2016-06-23 17:54 ` [PATCH v20 08/14] arm64: limit memory regions based on DT property, usable-memory Geoff Levand
2016-06-23 17:54 ` [PATCH v20 11/14] arm64: kdump: add VMCOREINFO's for user-space coredump tools Geoff Levand
2016-06-23 17:54 ` [PATCH v20 10/14] arm64: kdump: add kdump support Geoff Levand
2016-06-23 17:54 ` [PATCH v20 12/14] arm64: kdump: enable kdump in the arm64 defconfig Geoff Levand
2016-06-23 17:54 ` [PATCH v20 03/14] arm64: Add back cpu reset routines Geoff Levand
2016-06-23 17:54 ` Geoff Levand [this message]
2016-06-27 11:04   ` [PATCH v20 01/14] arm64: hibernate: Don't hibernate on systems with stuck CPUs James Morse
2016-06-27 16:44     ` Geoff Levand
2016-06-23 17:54 ` [PATCH v20 05/14] arm64/kexec: Enable kexec in the arm64 defconfig Geoff Levand
2016-06-23 17:54 ` [PATCH v20 09/14] arm64: kdump: implement machine_crash_shutdown() Geoff Levand
2016-06-23 17:54 ` [PATCH v20 14/14] Documentation: dt: usable-memory and elfcorehdr nodes for arm64 kexec Geoff Levand
2016-06-23 17:54 ` [PATCH v20 13/14] arm64: kdump: update a kernel doc Geoff Levand
2016-06-30  9:00   ` Baoquan He
2016-07-01  7:37     ` AKASHI Takahiro
2016-07-01  7:45       ` Baoquan He
2016-07-04  3:04         ` AKASHI Takahiro
2016-06-30 13:00   ` Dave Young
2016-06-27 17:00 ` [PATCH v20 00/14] arm64 kexec kernel patches Catalin Marinas
2016-06-27 17:07   ` Geoff Levand
2016-06-29  0:54   ` AKASHI Takahiro
2016-06-29  9:20     ` Catalin Marinas
2016-06-30  1:46       ` AKASHI Takahiro
2016-07-01  2:39         ` Pratyush Anand
2016-07-04  7:14           ` AKASHI Takahiro
2016-07-04 10:15             ` Pratyush Anand
2016-07-15  4:17 ` Simon Horman
2016-07-15 16:18   ` Geoff Levand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=97dcd35763eddf1b4c50a26d16389f313269f0c8.1466702804.git.geoff@infradead.org \
    --to=geoff@infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).