Skip to content

Commit 6ef8eb5

Browse files
chenhuacaiKAGA-KOKO
authored andcommitted
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: 18415f3 ("cpu/hotplug: Allow "parallel" bringup up to CPUHP_BP_KICK_AP_STATE") Fixes: 06c6796 ("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
1 parent 932d847 commit 6ef8eb5

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

kernel/cpu.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1859,6 +1859,9 @@ static inline bool cpuhp_bringup_cpus_parallel(unsigned int ncpus) { return fals
18591859

18601860
void __init bringup_nonboot_cpus(unsigned int max_cpus)
18611861
{
1862+
if (!max_cpus)
1863+
return;
1864+
18621865
/* Try parallel bringup optimization if enabled */
18631866
if (cpuhp_bringup_cpus_parallel(max_cpus))
18641867
return;

0 commit comments

Comments
 (0)