summaryrefslogtreecommitdiffstats
path: root/kernel/smpboot.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2023-05-12 23:07:27 +0200
committerPeter Zijlstra <peterz@infradead.org>2023-05-15 13:44:55 +0200
commit6f0621238b7e7680d5e26c00aa4cd473314d05b2 (patch)
tree39796c2f8f1ef84b11038aac07f7e6b8dd4e75d8 /kernel/smpboot.c
parentab24eb9abb9c60c45119370731735b79ed79f36c (diff)
downloadlinux-6f0621238b7e7680d5e26c00aa4cd473314d05b2.tar.gz
linux-6f0621238b7e7680d5e26c00aa4cd473314d05b2.tar.bz2
linux-6f0621238b7e7680d5e26c00aa4cd473314d05b2.zip
cpu/hotplug: Add CPU state tracking and synchronization
The CPU state tracking and synchronization mechanism in smpboot.c is completely independent of the hotplug code and all logic around it is implemented in architecture specific code. Except for the state reporting of the AP there is absolutely nothing architecture specific and the sychronization and decision functions can be moved into the generic hotplug core code. Provide an integrated variant and add the core synchronization and decision points. This comes in two flavours: 1) DEAD state synchronization Updated by the architecture code once the AP reaches the point where it is ready to be torn down by the control CPU, e.g. by removing power or clocks or tear down via the hypervisor. The control CPU waits for this state to be reached with a timeout. If the state is reached an architecture specific cleanup function is invoked. 2) Full state synchronization This extends #1 with AP alive synchronization. This is new functionality, which allows to replace architecture specific wait mechanims, e.g. cpumasks, completely. It also prevents that an AP which is in a limbo state can be brought up again. This can happen when an AP failed to report dead state during a previous off-line operation. The dead synchronization is what most architectures use. Only x86 makes a bringup decision based on that state at the moment. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Tested-by: Michael Kelley <mikelley@microsoft.com> Tested-by: Oleksandr Natalenko <oleksandr@natalenko.name> Tested-by: Helge Deller <deller@gmx.de> # parisc Tested-by: Guilherme G. Piccoli <gpiccoli@igalia.com> # Steam Deck Link: https://lore.kernel.org/r/20230512205256.476305035@linutronix.de
Diffstat (limited to 'kernel/smpboot.c')
-rw-r--r--kernel/smpboot.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/kernel/smpboot.c b/kernel/smpboot.c
index 2c7396da470c..3dcfd3f04ed0 100644
--- a/kernel/smpboot.c
+++ b/kernel/smpboot.c
@@ -326,6 +326,7 @@ void smpboot_unregister_percpu_thread(struct smp_hotplug_thread *plug_thread)
}
EXPORT_SYMBOL_GPL(smpboot_unregister_percpu_thread);
+#ifndef CONFIG_HOTPLUG_CORE_SYNC
static DEFINE_PER_CPU(atomic_t, cpu_hotplug_state) = ATOMIC_INIT(CPU_POST_DEAD);
/*
@@ -488,3 +489,4 @@ bool cpu_report_death(void)
}
#endif /* #ifdef CONFIG_HOTPLUG_CPU */
+#endif /* !CONFIG_HOTPLUG_CORE_SYNC */