mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-24 15:56:49 +00:00
48d0068bb1
This backports the fix for the broken "nosmp" and "maxcpus=0" cmdline params. Signed-off-by: Martin Schiller <ms@dev.tdt.de> Link: https://github.com/openwrt/openwrt/pull/15811 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
39 lines
1.4 KiB
Diff
39 lines
1.4 KiB
Diff
From 6ef8eb5125722c241fd60d7b0c872d5c2e5dd4ca Mon Sep 17 00:00:00 2001
|
|
From: Huacai Chen <chenhuacai@loongson.cn>
|
|
Date: Tue, 18 Jun 2024 16:13:36 +0800
|
|
Subject: [PATCH] cpu: Fix broken cmdline "nosmp" and "maxcpus=0"
|
|
|
|
After the rework of "Parallel CPU bringup", the cmdline "nosmp" and
|
|
"maxcpus=0" parameters are not working anymore. These parameters set
|
|
setup_max_cpus to zero and that's handed to bringup_nonboot_cpus().
|
|
|
|
The code there does a decrement before checking for zero, which brings it
|
|
into the negative space and brings up all CPUs.
|
|
|
|
Add a zero check at the beginning of the function to prevent this.
|
|
|
|
[ tglx: Massaged change log ]
|
|
|
|
Fixes: 18415f33e2ac4ab382 ("cpu/hotplug: Allow "parallel" bringup up to CPUHP_BP_KICK_AP_STATE")
|
|
Fixes: 06c6796e0304234da6 ("cpu/hotplug: Fix off by one in cpuhp_bringup_mask()")
|
|
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
|
|
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
|
|
Cc: stable@vger.kernel.org
|
|
Link: https://lore.kernel.org/r/20240618081336.3996825-1-chenhuacai@loongson.cn
|
|
---
|
|
kernel/cpu.c | 3 +++
|
|
1 file changed, 3 insertions(+)
|
|
|
|
--- a/kernel/cpu.c
|
|
+++ b/kernel/cpu.c
|
|
@@ -1907,6 +1907,9 @@ static inline bool cpuhp_bringup_cpus_pa
|
|
|
|
void __init bringup_nonboot_cpus(unsigned int max_cpus)
|
|
{
|
|
+ if (!max_cpus)
|
|
+ return;
|
|
+
|
|
/* Try parallel bringup optimization if enabled */
|
|
if (cpuhp_bringup_cpus_parallel(max_cpus))
|
|
return;
|