[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220822021520.6996-5-kernelfans@gmail.com>
Date: Mon, 22 Aug 2022 10:15:14 +0800
From: Pingfan Liu <kernelfans@...il.com>
To: linux-arm-kernel@...ts.infradead.org, linux-ia64@...r.kernel.org,
linux-riscv@...ts.infradead.org, linux-kernel@...r.kernel.org
Cc: Pingfan Liu <kernelfans@...il.com>,
Thomas Gleixner <tglx@...utronix.de>,
Steven Price <steven.price@....com>,
Kuppuswamy Sathyanarayanan
<sathyanarayanan.kuppuswamy@...ux.intel.com>,
"Jason A. Donenfeld" <Jason@...c4.com>,
Frederic Weisbecker <frederic@...nel.org>,
Russell King <linux@...linux.org.uk>,
Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will@...nel.org>,
Paul Walmsley <paul.walmsley@...ive.com>,
Palmer Dabbelt <palmer@...belt.com>,
Albert Ou <aou@...s.berkeley.edu>,
Peter Zijlstra <peterz@...radead.org>,
"Eric W. Biederman" <ebiederm@...ssion.com>
Subject: [RFC 04/10] cpu/hotplug: Check the capability of kexec quick reboot
The kexec quick reboot needs each involved cpuhp_step to run in
parallel.
There are lots of teardown cpuhp_step, but not all of them belong to
arm/arm64/riscv kexec reboot path. So introducing a member
'support_kexec_parallel' in the struct cpuhp_step to signal whether the
teardown supports parallel or not. If a cpuhp_step is used in kexec
reboot, then it needs to support parallel to enable the quick reboot.
The function check_quick_reboot() checks all teardown cpuhp_steps and
report those unsupported if any.
Signed-off-by: Pingfan Liu <kernelfans@...il.com>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: Steven Price <steven.price@....com>
Cc: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@...ux.intel.com>
Cc: "Jason A. Donenfeld" <Jason@...c4.com>
Cc: Frederic Weisbecker <frederic@...nel.org>
Cc: Russell King <linux@...linux.org.uk>
Cc: Catalin Marinas <catalin.marinas@....com>
Cc: Will Deacon <will@...nel.org>
Cc: Paul Walmsley <paul.walmsley@...ive.com>
Cc: Palmer Dabbelt <palmer@...belt.com>
Cc: Albert Ou <aou@...s.berkeley.edu>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: "Eric W. Biederman" <ebiederm@...ssion.com>
To: linux-arm-kernel@...ts.infradead.org
To: linux-ia64@...r.kernel.org
To: linux-riscv@...ts.infradead.org
To: linux-kernel@...r.kernel.org
---
include/linux/cpuhotplug.h | 2 ++
kernel/cpu.c | 28 +++++++++++++++++++++++++++-
2 files changed, 29 insertions(+), 1 deletion(-)
diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h
index f61447913db9..73093fc15aec 100644
--- a/include/linux/cpuhotplug.h
+++ b/include/linux/cpuhotplug.h
@@ -374,6 +374,8 @@ static inline int cpuhp_setup_state_multi(enum cpuhp_state state,
(void *) teardown, true);
}
+void cpuhp_set_step_parallel(enum cpuhp_state state);
+
int __cpuhp_state_add_instance(enum cpuhp_state state, struct hlist_node *node,
bool invoke);
int __cpuhp_state_add_instance_cpuslocked(enum cpuhp_state state,
diff --git a/kernel/cpu.c b/kernel/cpu.c
index 94ab2727d6bb..1261c3f3be51 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -137,6 +137,9 @@ struct cpuhp_step {
/* public: */
bool cant_stop;
bool multi_instance;
+#ifdef CONFIG_SHUTDOWN_NONBOOT_CPUS
+ bool support_kexec_parallel;
+#endif
};
static DEFINE_MUTEX(cpuhp_state_mutex);
@@ -147,6 +150,14 @@ static struct cpuhp_step *cpuhp_get_step(enum cpuhp_state state)
return cpuhp_hp_states + state;
}
+#ifdef CONFIG_SHUTDOWN_NONBOOT_CPUS
+void cpuhp_set_step_parallel(enum cpuhp_state state)
+{
+ cpuhp_hp_states[state].support_kexec_parallel = true;
+}
+EXPORT_SYMBOL(cpuhp_set_step_parallel);
+#endif
+
static bool cpuhp_step_empty(bool bringup, struct cpuhp_step *step)
{
return bringup ? !step->startup.single : !step->teardown.single;
@@ -1347,7 +1358,22 @@ static void takedown_cpus_no_rollback(struct cpumask *cpus)
static bool check_quick_reboot(void)
{
- return false;
+ struct cpuhp_step *step;
+ enum cpuhp_state state;
+ bool ret = true;
+
+ for (state = CPUHP_ONLINE; state >= CPUHP_AP_OFFLINE; state--) {
+ step = cpuhp_get_step(state);
+ if (step->teardown.single == NULL)
+ continue;
+ if (step->support_kexec_parallel == false) {
+ pr_info("cpuhp state:%d, %s, does not support cpudown in parallel\n",
+ state, step->name);
+ ret = false;
+ }
+ }
+
+ return ret;
}
static struct cpumask kexec_ap_map;
--
2.31.1
Powered by blists - more mailing lists