Skip to contentSkip to conversation

kernel/cpu.c: linux misses the initialization of one CPU (off-by-one regression)

DISCUSSION Bagas Sanjaya 2 participants 2 messages May 29, 2023 – Jun 20, 2023 Regressions

lore
Share & tools
lore
#0 lore raw

Hi,

I notice a regression report on Bugzilla [1]. Quoting from it:

Quoted 28 lines

Since commit 18415f33e2ac4ab382cbca8b5ff82a9036b5bd49 linux misses the initialization of 1 CPU when the CONFIG_NR_CPUS is equal to the actual number of CPUs in the system. One can work around the issue by increasing CONFIG_NR_CPUS or apply the following patch:

From aa5ef661936655f0d806fdbf2d28fc9513dd5c69 Mon Sep 17 00:00:00 2001
From: Bert Karwatzki <[email protected]>
Date: Sun, 28 May 2023 14:35:45 +0200
Subject: [PATCH] Fix CPU detection when CONFIG_NR_CPUS is equal to the actual
number of CPUs.

---
 kernel/cpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/cpu.c +1 -1
index 005f863a3d2b..5e900b531827 100644
@@ -1770,7 +1770,7 @@ static void __init cpuhp_bringup_mask(const struct cpumask *mask, unsigned int n
 	for_each_cpu(cpu, mask) {
 		struct cpuhp_cpu_state *st = per_cpu_ptr(&cpuhp_state, cpu);
 
-		if (!--ncpus)
+		if (!ncpus--)
 			break;
 
 		if (cpu_up(cpu, target) && can_rollback_cpu(st)) {
Signature · 1 line
2.40.1

Anyway, I'm adding it to regzbot:

#regzbot introduced: 18415f33e2ac4a https://bugzilla.kernel.org/show_bug.cgi?id=217498
#regzbot title: Off-by-one CPU initalization when CONFIG_NR_CPUS equal to actual system CPU count

Thanks.

[1]: https://bugzilla.kernel.org/show_bug.cgi?id=217498

Signature · 1 line
An old man doll... just what I always wanted! - Clara
#1 lore raw

[TLDR: This mail in primarily relevant for Linux kernel regression tracking. See link in footer if these mails annoy you.]

Quoted 4 lines · Bagas Sanjaya

I notice a regression report on Bugzilla [1]. Quoting from it:
[...]
#regzbot introduced: 18415f33e2ac4a https://bugzilla.kernel.org/show_bug.cgi?id=217498
#regzbot title: Off-by-one CPU initalization when CONFIG_NR_CPUS equal to actual system CPU count

Fix in next (just like the culprit):

#regzbot fix: 06c6796e0304234
#regzbot ignore-activity

Ciao, Thorsten (wearing his 'the Linux kernel's regression tracker' hat) --
Everything you wanna know about Linux kernel regression tracking:
https://linux-regtracking.leemhuis.info/about/#tldr
That page also explains what to do if mails like this annoy you.