From a5d77afecc2cb8fcd3bca0f4a51e0c4b26b32c67 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Tue, 9 Sep 2003 10:20:00 -0700 Subject: [PATCH] [PATCH] Handle NR_CPUS overflow From: john stultz Don't try to support more than NR_CPUS cpus: things overflow. Also, increase the default in config for some architectures. (Dave Hansen). --- arch/i386/Kconfig | 1 + arch/i386/kernel/mpparse.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig index 928c42588f10d..f337b2d31815b 100644 --- a/arch/i386/Kconfig +++ b/arch/i386/Kconfig @@ -454,6 +454,7 @@ config SMP config NR_CPUS int "Maximum number of CPUs (2-255)" depends on SMP + default "32" if X86_NUMAQ || X86_SUMMIT || X86_BIGSMP || X86_ES7000 default "8" help This allows you to specify the maximum number of CPUs which this diff --git a/arch/i386/kernel/mpparse.c b/arch/i386/kernel/mpparse.c index efa412dd182a5..96d97a18b8ae1 100644 --- a/arch/i386/kernel/mpparse.c +++ b/arch/i386/kernel/mpparse.c @@ -167,6 +167,11 @@ void __init MP_processor_info (struct mpc_config_processor *m) boot_cpu_logical_apicid = apicid; } + if (num_processors >= NR_CPUS) { + printk(KERN_WARNING "NR_CPUS limit of %i reached. Cannot " + "boot CPU(apicid 0x%d).\n", NR_CPUS, m->mpc_apicid); + return; + } num_processors++; if (MAX_APICS - m->mpc_apicid <= 0) { -- 2.53.0