[PATCH v2 1/4] cpu/hotplug: Introduce CONFIG_PARALLEL_SMT_PRIMARY_FIRST
From: Jinjie Ruan <hidden>
Date: 2026-06-18 09:26:17
Also in:
linux-mips, linux-riscv, lkml
Subsystem:
cpu hotplug, mips, risc-v architecture, the rest, x86 architecture (32-bit and 64-bit) · Maintainers:
Thomas Gleixner, Peter Zijlstra, Thomas Bogendoerfer, Paul Walmsley, Palmer Dabbelt, Albert Ou, Linus Torvalds, Ingo Molnar, Borislav Petkov, Dave Hansen
During parallel CPU bringup, x86 requires primary SMT threads to boot first to avoid siblings stopping during microcode updates. This constraint is architecture-specific and unnecessary for other platforms like arm64. Introduce CONFIG_PARALLEL_SMT_PRIMARY_FIRST to decouple this constraint. Platforms requiring this temporal order (e.g., x86) can select it in Kconfig. Other architectures (e.g., arm64) can leave it unselected to entirely bypass the SMT branch via the preprocessor. Signed-off-by: Jinjie Ruan <redacted> --- arch/Kconfig | 4 ++++ arch/mips/Kconfig | 1 + arch/riscv/Kconfig | 1 + arch/x86/Kconfig | 1 + kernel/cpu.c | 6 +++++- 5 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/arch/Kconfig b/arch/Kconfig
index e86880045158..0365d2df2659 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig@@ -102,6 +102,10 @@ config HOTPLUG_PARALLEL bool select HOTPLUG_SPLIT_STARTUP +config PARALLEL_SMT_PRIMARY_FIRST + bool + depends on HOTPLUG_PARALLEL + config GENERIC_IRQ_ENTRY bool
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 4364f3dba688..84e11ac0cf71 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig@@ -642,6 +642,7 @@ config EYEQ select MIPS_CPU_SCACHE select MIPS_GIC select MIPS_L1_CACHE_SHIFT_7 + select PARALLEL_SMT_PRIMARY_FIRST if HOTPLUG_PARALLEL select PCI_DRIVERS_GENERIC select SMP_UP if SMP select SWAP_IO_SPACE
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index d235396c4514..0cc49aecc841 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig@@ -210,6 +210,7 @@ config RISCV select OF select OF_EARLY_FLATTREE select OF_IRQ + select PARALLEL_SMT_PRIMARY_FIRST if HOTPLUG_PARALLEL select PCI_DOMAINS_GENERIC if PCI select PCI_ECAM if (ACPI && PCI) select PCI_MSI if PCI
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index f3f7cb01d69d..3ad4115ad051 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig@@ -314,6 +314,7 @@ config X86 select NEED_PER_CPU_PAGE_FIRST_CHUNK select NEED_SG_DMA_LENGTH select NUMA_MEMBLKS if NUMA + select PARALLEL_SMT_PRIMARY_FIRST if HOTPLUG_PARALLEL select PCI_DOMAINS if PCI select PCI_LOCKLESS_CONFIG if PCI select PERF_EVENTS
diff --git a/kernel/cpu.c b/kernel/cpu.c
index bc4f7a9ba64e..7ef8cdf4d239 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c@@ -1792,6 +1792,7 @@ static int __init parallel_bringup_parse_param(char *arg) } early_param("cpuhp.parallel", parallel_bringup_parse_param); +#ifdef CONFIG_PARALLEL_SMT_PRIMARY_FIRST #ifdef CONFIG_HOTPLUG_SMT static inline bool cpuhp_smt_aware(void) {
@@ -1811,7 +1812,8 @@ static inline const struct cpumask *cpuhp_get_primary_thread_mask(void) { return cpu_none_mask; } -#endif +#endif /* CONFIG_HOTPLUG_SMT */ +#endif /* CONFIG_PARALLEL_SMT_PRIMARY_FIRST */ bool __weak arch_cpuhp_init_parallel_bringup(void) {
@@ -1837,6 +1839,7 @@ static bool __init cpuhp_bringup_cpus_parallel(unsigned int ncpus) if (!__cpuhp_parallel_bringup) return false; +#ifdef CONFIG_PARALLEL_SMT_PRIMARY_FIRST if (cpuhp_smt_aware()) { const struct cpumask *pmask = cpuhp_get_primary_thread_mask(); static struct cpumask tmp_mask __initdata;
@@ -1857,6 +1860,7 @@ static bool __init cpuhp_bringup_cpus_parallel(unsigned int ncpus) cpumask_andnot(&tmp_mask, mask, pmask); mask = &tmp_mask; } +#endif /* CONFIG_PARALLEL_SMT_PRIMARY_FIRST */ /* Bring the not-yet started CPUs up */ cpuhp_bringup_mask(mask, ncpus, CPUHP_BP_KICK_AP);
--
2.34.1