# This is a BitKeeper generated diff -Nru style patch. # # ChangeSet # 2004/03/17 00:44:22-05:00 len.brown@intel.com # [ACPI] check "maxcpus=N" early -- same as NR_CPUS check. # http://bugzilla.kernel.org/show_bug.cgi?id=2317 # # When the BIOS enumerates physical processors before logical, # maxcpus=N/2 will now effectively disable HT. # # This can be verified by boot messages warning that HT is off: # eg. "maxcpus=2" on a 2xHT system: # # Total of 2 processors activated (11141.12 BogoMIPS). # WARNING: No sibling found for CPU 0. # WARNING: No sibling found for CPU 1. # # arch/x86_64/kernel/setup.c # 2004/03/17 00:43:10-05:00 len.brown@intel.com +12 -1 # check "maxcpus=N" at processor enumeration-time rather than smpboot-time # # arch/x86_64/kernel/mpparse.c # 2004/03/17 00:43:10-05:00 len.brown@intel.com +12 -0 # check "maxcpus=N" at processor enumeration-time rather than smpboot-time # # arch/i386/kernel/setup.c # 2004/03/17 00:43:10-05:00 len.brown@intel.com +12 -0 # check "maxcpus=N" at processor enumeration-time rather than smpboot-time # # arch/i386/kernel/mpparse.c # 2004/03/17 00:43:10-05:00 len.brown@intel.com +9 -2 # check "maxcpus=N" at processor enumeration-time rather than smpboot-time # diff -Nru a/arch/i386/kernel/mpparse.c b/arch/i386/kernel/mpparse.c --- a/arch/i386/kernel/mpparse.c Wed Mar 17 00:44:33 2004 +++ b/arch/i386/kernel/mpparse.c Wed Mar 17 00:44:33 2004 @@ -37,6 +37,7 @@ /* Have we found an MP table */ int smp_found_config; +unsigned int __initdata maxcpus = NR_CPUS; /* * Various Linux-internal data structures created from the @@ -168,8 +169,14 @@ } if (num_processors >= NR_CPUS) { - printk(KERN_WARNING "NR_CPUS limit of %i reached. Cannot " - "boot CPU(apicid 0x%x).\n", NR_CPUS, m->mpc_apicid); + printk(KERN_WARNING "WARNING: NR_CPUS limit of %i reached." + " Processor ignored.\n", NR_CPUS); + return; + } + + if (num_processors >= maxcpus) { + printk(KERN_WARNING "WARNING: maxcpus limit of %i reached." + " Processor ignored.\n", maxcpus); return; } num_processors++; diff -Nru a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c --- a/arch/i386/kernel/setup.c Wed Mar 17 00:44:33 2004 +++ b/arch/i386/kernel/setup.c Wed Mar 17 00:44:33 2004 @@ -555,6 +555,18 @@ } } +#ifdef CONFIG_SMP + /* + * If the BIOS enumerates physical processors before logical, + * maxcpus=N at enumeration-time can be used to disable HT. + */ + else if (!memcmp(from, "maxcpus=", 8)) { + extern unsigned int maxcpus; + + maxcpus = simple_strtoul(from + 8, NULL, 0); + } +#endif + #ifdef CONFIG_ACPI_BOOT /* "acpi=off" disables both ACPI table parsing and interpreter */ else if (!memcmp(from, "acpi=off", 8)) { diff -Nru a/arch/x86_64/kernel/mpparse.c b/arch/x86_64/kernel/mpparse.c --- a/arch/x86_64/kernel/mpparse.c Wed Mar 17 00:44:33 2004 +++ b/arch/x86_64/kernel/mpparse.c Wed Mar 17 00:44:33 2004 @@ -33,6 +33,7 @@ /* Have we found an MP table */ int smp_found_config; +unsigned int __initdata maxcpus = NR_CPUS; int acpi_found_madt; @@ -117,6 +118,17 @@ Dprintk(" Bootup CPU\n"); boot_cpu_id = m->mpc_apicid; } + if (num_processors >= NR_CPUS) { + printk(KERN_WARNING "WARNING: NR_CPUS limit of %i reached." + " Processor ignored.\n", NR_CPUS); + return; + } + if (num_processors >= maxcpus) { + printk(KERN_WARNING "WARNING: maxcpus limit of %i reached." + " Processor ignored.\n", maxcpus); + return; + } + num_processors++; if (m->mpc_apicid > MAX_APICS) { diff -Nru a/arch/x86_64/kernel/setup.c b/arch/x86_64/kernel/setup.c --- a/arch/x86_64/kernel/setup.c Wed Mar 17 00:44:33 2004 +++ b/arch/x86_64/kernel/setup.c Wed Mar 17 00:44:33 2004 @@ -201,7 +201,18 @@ for (;;) { if (c != ' ') goto next_char; - + +#ifdef CONFIG_SMP + /* + * If the BIOS enumerates physical processors before logical, + * maxcpus=N at enumeration-time can be used to disable HT. + */ + else if (!memcmp(from, "maxcpus=", 8)) { + extern unsigned int maxcpus; + + maxcpus = simple_strtoul(from + 8, NULL, 0); + } +#endif #ifdef CONFIG_ACPI_BOOT /* "acpi=off" disables both ACPI table parsing and interpreter init */ if (!memcmp(from, "acpi=off", 8))