From: tip-bot for Nicholas Piggin <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com,
torvalds@linux-foundation.org, npiggin@gmail.com,
fweisbec@gmail.com, mingo@kernel.org, rafael.j.wysocki@intel.com,
peterz@infradead.org, tglx@linutronix.de
Subject: [tip:sched/core] power/suspend: Add function to disable secondaries for suspend
Date: Fri, 3 May 2019 04:29:06 -0700 [thread overview]
Message-ID: <tip-c2cb30bfceceba8a2a0d5713230a250dd6140e22@git.kernel.org> (raw)
In-Reply-To: <20190411033448.20842-3-npiggin@gmail.com>
Commit-ID: c2cb30bfceceba8a2a0d5713230a250dd6140e22
Gitweb: https://git.kernel.org/tip/c2cb30bfceceba8a2a0d5713230a250dd6140e22
Author: Nicholas Piggin <npiggin@gmail.com>
AuthorDate: Thu, 11 Apr 2019 13:34:45 +1000
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Fri, 3 May 2019 12:53:14 +0200
power/suspend: Add function to disable secondaries for suspend
This adds a function to disable secondary CPUs for suspend that are
not necessarily non-zero / non-boot CPUs. Platforms will be able to
use this to suspend using non-zero CPUs.
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rafael J . Wysocki <rafael.j.wysocki@intel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linuxppc-dev@lists.ozlabs.org
Link: https://lkml.kernel.org/r/20190411033448.20842-3-npiggin@gmail.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
include/linux/cpu.h | 10 ++++++++++
kernel/kexec_core.c | 4 ++--
kernel/power/hibernate.c | 12 ++++++------
kernel/power/suspend.c | 4 ++--
4 files changed, 20 insertions(+), 10 deletions(-)
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 5041357d0297..563e697e7779 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -137,6 +137,16 @@ static inline int disable_nonboot_cpus(void)
return freeze_secondary_cpus(0);
}
extern void enable_nonboot_cpus(void);
+
+static inline int suspend_disable_secondary_cpus(void)
+{
+ return freeze_secondary_cpus(0);
+}
+static inline void suspend_enable_secondary_cpus(void)
+{
+ return enable_nonboot_cpus();
+}
+
#else /* !CONFIG_PM_SLEEP_SMP */
static inline int disable_nonboot_cpus(void) { return 0; }
static inline void enable_nonboot_cpus(void) {}
diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c
index d7140447be75..fd5c95ff9251 100644
--- a/kernel/kexec_core.c
+++ b/kernel/kexec_core.c
@@ -1150,7 +1150,7 @@ int kernel_kexec(void)
error = dpm_suspend_end(PMSG_FREEZE);
if (error)
goto Resume_devices;
- error = disable_nonboot_cpus();
+ error = suspend_disable_secondary_cpus();
if (error)
goto Enable_cpus;
local_irq_disable();
@@ -1183,7 +1183,7 @@ int kernel_kexec(void)
Enable_irqs:
local_irq_enable();
Enable_cpus:
- enable_nonboot_cpus();
+ suspend_enable_secondary_cpus();
dpm_resume_start(PMSG_RESTORE);
Resume_devices:
dpm_resume_end(PMSG_RESTORE);
diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
index abef759de7c8..cfc7a57049e4 100644
--- a/kernel/power/hibernate.c
+++ b/kernel/power/hibernate.c
@@ -281,7 +281,7 @@ static int create_image(int platform_mode)
if (error || hibernation_test(TEST_PLATFORM))
goto Platform_finish;
- error = disable_nonboot_cpus();
+ error = suspend_disable_secondary_cpus();
if (error || hibernation_test(TEST_CPUS))
goto Enable_cpus;
@@ -323,7 +323,7 @@ static int create_image(int platform_mode)
local_irq_enable();
Enable_cpus:
- enable_nonboot_cpus();
+ suspend_enable_secondary_cpus();
Platform_finish:
platform_finish(platform_mode);
@@ -417,7 +417,7 @@ int hibernation_snapshot(int platform_mode)
int __weak hibernate_resume_nonboot_cpu_disable(void)
{
- return disable_nonboot_cpus();
+ return suspend_disable_secondary_cpus();
}
/**
@@ -486,7 +486,7 @@ static int resume_target_kernel(bool platform_mode)
local_irq_enable();
Enable_cpus:
- enable_nonboot_cpus();
+ suspend_enable_secondary_cpus();
Cleanup:
platform_restore_cleanup(platform_mode);
@@ -564,7 +564,7 @@ int hibernation_platform_enter(void)
if (error)
goto Platform_finish;
- error = disable_nonboot_cpus();
+ error = suspend_disable_secondary_cpus();
if (error)
goto Enable_cpus;
@@ -586,7 +586,7 @@ int hibernation_platform_enter(void)
local_irq_enable();
Enable_cpus:
- enable_nonboot_cpus();
+ suspend_enable_secondary_cpus();
Platform_finish:
hibernation_ops->finish();
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
index 0bd595a0b610..59b6def23046 100644
--- a/kernel/power/suspend.c
+++ b/kernel/power/suspend.c
@@ -428,7 +428,7 @@ static int suspend_enter(suspend_state_t state, bool *wakeup)
if (suspend_test(TEST_PLATFORM))
goto Platform_wake;
- error = disable_nonboot_cpus();
+ error = suspend_disable_secondary_cpus();
if (error || suspend_test(TEST_CPUS))
goto Enable_cpus;
@@ -458,7 +458,7 @@ static int suspend_enter(suspend_state_t state, bool *wakeup)
BUG_ON(irqs_disabled());
Enable_cpus:
- enable_nonboot_cpus();
+ suspend_enable_secondary_cpus();
Platform_wake:
platform_resume_noirq(state);
next prev parent reply other threads:[~2019-05-03 11:29 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-11 3:34 [PATCH v2 0/5] Allow CPU0 to be nohz full Nicholas Piggin
2019-04-11 3:34 ` [PATCH v2 1/5] sched/core: allow the remote scheduler tick to be started on CPU0 Nicholas Piggin
2019-05-03 11:28 ` [tip:sched/core] sched/core: Allow " tip-bot for Nicholas Piggin
2019-04-11 3:34 ` [PATCH v2 2/5] PM / suspend: add function to disable secondaries for suspend Nicholas Piggin
2019-05-03 11:29 ` tip-bot for Nicholas Piggin [this message]
2019-05-03 17:46 ` [tip:sched/core] power/suspend: Add " tip-bot for Nicholas Piggin
2019-04-11 3:34 ` [PATCH v2 3/5] kernel/cpu: Allow non-zero CPU to be primary for suspend / kexec freeze Nicholas Piggin
2019-04-25 12:02 ` Peter Zijlstra
2019-04-26 4:32 ` Nicholas Piggin
2019-05-03 11:29 ` [tip:sched/core] " tip-bot for Nicholas Piggin
2019-05-03 17:46 ` tip-bot for Nicholas Piggin
2019-04-11 3:34 ` [PATCH v2 4/5] kernel/sched/isolation: require a present CPU in housekeeping mask Nicholas Piggin
2019-05-03 11:30 ` [tip:sched/core] sched/isolation: Require " tip-bot for Nicholas Piggin
2019-05-03 17:47 ` tip-bot for Nicholas Piggin
2019-05-03 23:52 ` Frederic Weisbecker
2019-05-04 0:27 ` Frederic Weisbecker
2019-05-04 6:59 ` Nicholas Piggin
2019-05-06 15:16 ` Frederic Weisbecker
2019-05-06 23:50 ` Nicholas Piggin
2019-05-08 0:35 ` Frederic Weisbecker
2019-05-08 1:38 ` Nicholas Piggin
2019-04-11 3:34 ` [PATCH v2 5/5] nohz_full: Allow the boot CPU to be nohz_full Nicholas Piggin
2019-05-03 11:31 ` [tip:sched/core] " tip-bot for Nicholas Piggin
2019-05-03 17:48 ` tip-bot for Nicholas Piggin
2019-04-25 12:04 ` [PATCH v2 0/5] Allow CPU0 to be nohz full Peter Zijlstra
2019-04-30 2:46 ` Nicholas Piggin
2019-04-30 12:07 ` Peter Zijlstra
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=tip-c2cb30bfceceba8a2a0d5713230a250dd6140e22@git.kernel.org \
--to=tipbot@zytor.com \
--cc=fweisbec@gmail.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=npiggin@gmail.com \
--cc=peterz@infradead.org \
--cc=rafael.j.wysocki@intel.com \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.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).