[openwrt/openwrt] generic: 6.6: backport fix for broken cmdline "nosmp" and "maxcpus=0"
LEDE Commits
lede-commits at lists.infradead.org
Sat Jul 6 08:55:01 PDT 2024
hauke pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/48d0068bb14b982671910f369507c7fd9a5b2392
commit 48d0068bb14b982671910f369507c7fd9a5b2392
Author: Martin Schiller <ms at dev.tdt.de>
AuthorDate: Mon Jul 1 11:41:36 2024 +0200
generic: 6.6: backport fix for broken cmdline "nosmp" and "maxcpus=0"
This backports the fix for the broken "nosmp" and "maxcpus=0" cmdline
params.
Signed-off-by: Martin Schiller <ms at dev.tdt.de>
Link: https://github.com/openwrt/openwrt/pull/15811
Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
...up_max_cpus_namespace_collision_shadowing.patch | 52 ++++++++++++++++++++++
...pu-Fix-broken-cmdline-nosmp-and-maxcpus-0.patch | 38 ++++++++++++++++
2 files changed, 90 insertions(+)
diff --git a/target/linux/generic/backport-6.6/0080-v6.9-smp-Avoid-setup_max_cpus_namespace_collision_shadowing.patch b/target/linux/generic/backport-6.6/0080-v6.9-smp-Avoid-setup_max_cpus_namespace_collision_shadowing.patch
new file mode 100644
index 0000000000..e3e9859037
--- /dev/null
+++ b/target/linux/generic/backport-6.6/0080-v6.9-smp-Avoid-setup_max_cpus_namespace_collision_shadowing.patch
@@ -0,0 +1,52 @@
+From 4c8a49854130da0117a0fdb858551824919a2389 Mon Sep 17 00:00:00 2001
+From: Ingo Molnar <mingo at kernel.org>
+Date: Tue, 27 Feb 2024 09:58:15 +0100
+Subject: [PATCH] smp: Avoid 'setup_max_cpus' namespace collision/shadowing
+
+bringup_nonboot_cpus() gets passed the 'setup_max_cpus'
+variable in init/main.c - which is also the name of the parameter,
+shadowing the name.
+
+To reduce confusion and to allow the 'setup_max_cpus' value
+to be #defined in the <linux/smp.h> header, use the 'max_cpus'
+name for the function parameter name.
+
+Signed-off-by: Ingo Molnar <mingo at kernel.org>
+Cc: Thomas Gleixner <tglx at linutronix.de>
+Cc: linux-kernel at vger.kernel.org
+---
+ include/linux/cpu.h | 2 +-
+ kernel/cpu.c | 6 +++---
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+--- a/include/linux/cpu.h
++++ b/include/linux/cpu.h
+@@ -109,7 +109,7 @@ void notify_cpu_starting(unsigned int cp
+ extern void cpu_maps_update_begin(void);
+ extern void cpu_maps_update_done(void);
+ int bringup_hibernate_cpu(unsigned int sleep_cpu);
+-void bringup_nonboot_cpus(unsigned int setup_max_cpus);
++void bringup_nonboot_cpus(unsigned int max_cpus);
+
+ #else /* CONFIG_SMP */
+ #define cpuhp_tasks_frozen 0
+--- a/kernel/cpu.c
++++ b/kernel/cpu.c
+@@ -1905,14 +1905,14 @@ static bool __init cpuhp_bringup_cpus_pa
+ static inline bool cpuhp_bringup_cpus_parallel(unsigned int ncpus) { return false; }
+ #endif /* CONFIG_HOTPLUG_PARALLEL */
+
+-void __init bringup_nonboot_cpus(unsigned int setup_max_cpus)
++void __init bringup_nonboot_cpus(unsigned int max_cpus)
+ {
+ /* Try parallel bringup optimization if enabled */
+- if (cpuhp_bringup_cpus_parallel(setup_max_cpus))
++ if (cpuhp_bringup_cpus_parallel(max_cpus))
+ return;
+
+ /* Full per CPU serialized bringup */
+- cpuhp_bringup_mask(cpu_present_mask, setup_max_cpus, CPUHP_ONLINE);
++ cpuhp_bringup_mask(cpu_present_mask, max_cpus, CPUHP_ONLINE);
+ }
+
+ #ifdef CONFIG_PM_SLEEP_SMP
diff --git a/target/linux/generic/backport-6.6/0081-v6.10-cpu-Fix-broken-cmdline-nosmp-and-maxcpus-0.patch b/target/linux/generic/backport-6.6/0081-v6.10-cpu-Fix-broken-cmdline-nosmp-and-maxcpus-0.patch
new file mode 100644
index 0000000000..e47796a078
--- /dev/null
+++ b/target/linux/generic/backport-6.6/0081-v6.10-cpu-Fix-broken-cmdline-nosmp-and-maxcpus-0.patch
@@ -0,0 +1,38 @@
+From 6ef8eb5125722c241fd60d7b0c872d5c2e5dd4ca Mon Sep 17 00:00:00 2001
+From: Huacai Chen <chenhuacai at 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 at loongson.cn>
+Signed-off-by: Thomas Gleixner <tglx at linutronix.de>
+Cc: stable at 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;
More information about the lede-commits
mailing list