diff options
author | Nicholas Piggin <npiggin@gmail.com> | 2019-04-10 23:34:46 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2019-05-03 13:42:58 -0400 |
commit | 9ca12ac04bb7d7cfb28aa549dcd3d15761f15543 (patch) | |
tree | 98dbad7e8c82eea820041cdf693d02b919d0ecc1 /kernel/cpu.c | |
parent | 2f1a6fbbef7781382850c3104ecb658f21b5d460 (diff) |
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 'kernel/cpu.c')
-rw-r--r-- | kernel/cpu.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/kernel/cpu.c b/kernel/cpu.c index 6754f3ecfd94..d1bf6e2b4752 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c | |||
@@ -9,6 +9,7 @@ | |||
9 | #include <linux/notifier.h> | 9 | #include <linux/notifier.h> |
10 | #include <linux/sched/signal.h> | 10 | #include <linux/sched/signal.h> |
11 | #include <linux/sched/hotplug.h> | 11 | #include <linux/sched/hotplug.h> |
12 | #include <linux/sched/isolation.h> | ||
12 | #include <linux/sched/task.h> | 13 | #include <linux/sched/task.h> |
13 | #include <linux/sched/smt.h> | 14 | #include <linux/sched/smt.h> |
14 | #include <linux/unistd.h> | 15 | #include <linux/unistd.h> |
@@ -1199,8 +1200,15 @@ int freeze_secondary_cpus(int primary) | |||
1199 | int cpu, error = 0; | 1200 | int cpu, error = 0; |
1200 | 1201 | ||
1201 | cpu_maps_update_begin(); | 1202 | cpu_maps_update_begin(); |
1202 | if (!cpu_online(primary)) | 1203 | if (primary == -1) { |
1203 | primary = cpumask_first(cpu_online_mask); | 1204 | primary = cpumask_first(cpu_online_mask); |
1205 | if (!housekeeping_cpu(primary, HK_FLAG_TIMER)) | ||
1206 | primary = housekeeping_any_cpu(HK_FLAG_TIMER); | ||
1207 | } else { | ||
1208 | if (!cpu_online(primary)) | ||
1209 | primary = cpumask_first(cpu_online_mask); | ||
1210 | } | ||
1211 | |||
1204 | /* | 1212 | /* |
1205 | * We take down all of the non-boot CPUs in one shot to avoid races | 1213 | * We take down all of the non-boot CPUs in one shot to avoid races |
1206 | * with the userspace trying to use the CPU hotplug at the same time | 1214 | * with the userspace trying to use the CPU hotplug at the same time |