Skip to content
This repository was archived by the owner on May 2, 2024. It is now read-only.

Commit 419bb61

Browse files
jcmvbkbcgregkh
authored andcommitted
xtensa: SMP: limit number of possible CPUs by NR_CPUS
[ Upstream commit 25384ce ] This fixes the following warning at boot when the kernel is booted on a board with more CPU cores than was configured in NR_CPUS: smp_init_cpus: Core Count = 8 smp_init_cpus: Core Id = 0 ------------[ cut here ]------------ WARNING: CPU: 0 PID: 0 at include/linux/cpumask.h:121 smp_init_cpus+0x54/0x74 Modules linked in: CPU: 0 PID: 0 Comm: swapper Not tainted 5.0.0-rc3-00015-g1459333f88a0 beagleboard#124 Call Trace: __warn$part$3+0x6a/0x7c warn_slowpath_null+0x35/0x3c smp_init_cpus+0x54/0x74 setup_arch+0x1c0/0x1d0 start_kernel+0x44/0x310 _startup+0x107/0x107 Signed-off-by: Max Filippov <jcmvbkbc@gmail.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent d9ba842 commit 419bb61

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

arch/xtensa/kernel/smp.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@ void __init smp_init_cpus(void)
9696
pr_info("%s: Core Count = %d\n", __func__, ncpus);
9797
pr_info("%s: Core Id = %d\n", __func__, core_id);
9898

99+
if (ncpus > NR_CPUS) {
100+
ncpus = NR_CPUS;
101+
pr_info("%s: limiting core count by %d\n", __func__, ncpus);
102+
}
103+
99104
for (i = 0; i < ncpus; ++i)
100105
set_cpu_possible(i, true);
101106
}

0 commit comments

Comments
 (0)