From: James Morse <james.morse@arm.com>
To: linux-arm-kernel@lists.infradead.org
Cc: Mark Rutland <mark.rutland@arm.com>,
Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
Will Deacon <will.deacon@arm.com>,
Catalin Marinas <catalin.marinas@arm.com>,
"Rafael J . Wysocki" <rjw@rjwysocki.net>,
Pavel Machek <pavel@ucw.cz>, James Morse <james.morse@arm.com>,
linux-pm@vger.kernel.org
Subject: [PATCH 3/5] PM / Hibernate: Allow architectures to specify the hibernate/resume CPU
Date: Thu, 2 Jun 2016 15:10:55 +0100 [thread overview]
Message-ID: <1464876657-6692-4-git-send-email-james.morse@arm.com> (raw)
In-Reply-To: <1464876657-6692-1-git-send-email-james.morse@arm.com>
On arm64 the cpu with logical id 0 is assumed to be the boot CPU. If a
user hotplugs this CPU out, then uses kexec to boot a new kernel, the new
kernel will assign logical id 0 to a different physical CPU.
This breaks hibernate as hibernate and resume will be attempted on different
CPUs.
Define a weak symbol arch_hibernation_disable_cpus(), which defaults to
calling disable_nonboot_cpus). Architectures that allow CPU 0 to be
hotplugged can use this to control which CPU is used for hibernate/resume.
Signed-off-by: James Morse <james.morse@arm.com>
Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
Cc: Pavel Machek <pavel@ucw.cz>
---
I would have preferred a macro, but there is no hibernate-relevant header
file that all arch's have. arm, arm64 and x86 have a suspend.h, but powerpc
doesn't.
If this approach is acceptable, this patch should go with 4&5 via the arm64
tree.
kernel/power/hibernate.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
index fca9254280ee..0e668a3207ec 100644
--- a/kernel/power/hibernate.c
+++ b/kernel/power/hibernate.c
@@ -70,6 +70,16 @@ bool hibernation_available(void)
}
/**
+ * arch_hibernation_disable_cpus - Allow architectures to direct which CPU
+ * is used for suspend or resume.
+ * @suspend: True during hibernate, false for resume.
+ */
+int __weak arch_hibernation_disable_cpus(__maybe_unused bool suspend)
+{
+ return disable_nonboot_cpus();
+}
+
+/**
* hibernation_set_ops - Set the global hibernate operations.
* @ops: Hibernation operations to use in subsequent hibernation transitions.
*/
@@ -279,7 +289,7 @@ static int create_image(int platform_mode)
if (error || hibernation_test(TEST_PLATFORM))
goto Platform_finish;
- error = disable_nonboot_cpus();
+ error = arch_hibernation_disable_cpus(true);
if (error || hibernation_test(TEST_CPUS))
goto Enable_cpus;
@@ -433,7 +443,7 @@ static int resume_target_kernel(bool platform_mode)
if (error)
goto Cleanup;
- error = disable_nonboot_cpus();
+ error = arch_hibernation_disable_cpus(false);
if (error)
goto Enable_cpus;
@@ -551,7 +561,7 @@ int hibernation_platform_enter(void)
if (error)
goto Platform_finish;
- error = disable_nonboot_cpus();
+ error = arch_hibernation_disable_cpus(true);
if (error)
goto Enable_cpus;
--
2.8.0.rc3
next prev parent reply other threads:[~2016-06-02 14:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-02 14:10 [PATCH 0/5] arm64: hibernate: Fix DEBUG_PAGEALLOC and hibernate on non-boot cpu James Morse
2016-06-02 14:10 ` James Morse [this message]
2016-06-13 22:05 ` [PATCH 3/5] PM / Hibernate: Allow architectures to specify the hibernate/resume CPU Rafael J. Wysocki
2016-06-13 22:10 ` Rafael J. Wysocki
2016-06-14 9:44 ` James Morse
2016-06-14 23:07 ` Rafael J. Wysocki
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=1464876657-6692-4-git-send-email-james.morse@arm.com \
--to=james.morse@arm.com \
--cc=catalin.marinas@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-pm@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=mark.rutland@arm.com \
--cc=pavel@ucw.cz \
--cc=rjw@rjwysocki.net \
--cc=will.deacon@arm.com \
/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).