summaryrefslogtreecommitdiffstats
path: root/include/linux/cpu.h
diff options
context:
space:
mode:
authorNicholas Piggin <npiggin@gmail.com>2019-04-11 13:34:46 +1000
committerIngo Molnar <mingo@kernel.org>2019-05-03 19:42:58 +0200
commit9ca12ac04bb7d7cfb28aa549dcd3d15761f15543 (patch)
tree98dbad7e8c82eea820041cdf693d02b919d0ecc1 /include/linux/cpu.h
parent2f1a6fbbef7781382850c3104ecb658f21b5d460 (diff)
downloadlinux-stable-9ca12ac04bb7d7cfb28aa549dcd3d15761f15543.tar.gz
linux-stable-9ca12ac04bb7d7cfb28aa549dcd3d15761f15543.tar.bz2
linux-stable-9ca12ac04bb7d7cfb28aa549dcd3d15761f15543.zip
kernel/cpu: Allow non-zero CPU to be primary for suspend / kexec freeze
This patch provides an arch option, ARCH_SUSPEND_NONZERO_CPU, to opt-in to allowing suspend to occur on one of the housekeeping CPUs rather than hardcoded CPU0. This will allow CPU0 to be a nohz_full CPU with a later change. It may be possible for platforms with hardware/firmware restrictions on suspend/wake effectively support this by handing off the final stage to CPU0 when kernel housekeeping is no longer required. Another option is to make housekeeping / nohz_full mask dynamic at runtime, but the complexity could not be justified at this time. 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-4-npiggin@gmail.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'include/linux/cpu.h')
-rw-r--r--include/linux/cpu.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 7ab2f09c0a14..73baab8535c1 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -140,7 +140,12 @@ extern void enable_nonboot_cpus(void);
static inline int suspend_disable_secondary_cpus(void)
{
- return freeze_secondary_cpus(0);
+ int cpu = 0;
+
+ if (IS_ENABLED(CONFIG_PM_SLEEP_SMP_NONZERO_CPU))
+ cpu = -1;
+
+ return freeze_secondary_cpus(cpu);
}
static inline void suspend_enable_secondary_cpus(void)
{