Commit 0e559f50 authored by Len Brown's avatar Len Brown Committed by Len Brown

[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.
parent fea5b72f
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
/* Have we found an MP table */ /* Have we found an MP table */
int smp_found_config; int smp_found_config;
unsigned int __initdata maxcpus = NR_CPUS;
/* /*
* Various Linux-internal data structures created from the * Various Linux-internal data structures created from the
...@@ -168,8 +169,14 @@ void __init MP_processor_info (struct mpc_config_processor *m) ...@@ -168,8 +169,14 @@ void __init MP_processor_info (struct mpc_config_processor *m)
} }
if (num_processors >= NR_CPUS) { if (num_processors >= NR_CPUS) {
printk(KERN_WARNING "NR_CPUS limit of %i reached. Cannot " printk(KERN_WARNING "WARNING: NR_CPUS limit of %i reached."
"boot CPU(apicid 0x%x).\n", NR_CPUS, m->mpc_apicid); " Processor ignored.\n", NR_CPUS);
return;
}
if (num_processors >= maxcpus) {
printk(KERN_WARNING "WARNING: maxcpus limit of %i reached."
" Processor ignored.\n", maxcpus);
return; return;
} }
num_processors++; num_processors++;
......
...@@ -555,6 +555,18 @@ static void __init parse_cmdline_early (char ** cmdline_p) ...@@ -555,6 +555,18 @@ static void __init parse_cmdline_early (char ** cmdline_p)
} }
} }
#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 #ifdef CONFIG_ACPI_BOOT
/* "acpi=off" disables both ACPI table parsing and interpreter */ /* "acpi=off" disables both ACPI table parsing and interpreter */
else if (!memcmp(from, "acpi=off", 8)) { else if (!memcmp(from, "acpi=off", 8)) {
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
/* Have we found an MP table */ /* Have we found an MP table */
int smp_found_config; int smp_found_config;
unsigned int __initdata maxcpus = NR_CPUS;
int acpi_found_madt; int acpi_found_madt;
...@@ -117,6 +118,17 @@ static void __init MP_processor_info (struct mpc_config_processor *m) ...@@ -117,6 +118,17 @@ static void __init MP_processor_info (struct mpc_config_processor *m)
Dprintk(" Bootup CPU\n"); Dprintk(" Bootup CPU\n");
boot_cpu_id = m->mpc_apicid; 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++; num_processors++;
if (m->mpc_apicid > MAX_APICS) { if (m->mpc_apicid > MAX_APICS) {
......
...@@ -202,6 +202,17 @@ static __init void parse_cmdline_early (char ** cmdline_p) ...@@ -202,6 +202,17 @@ static __init void parse_cmdline_early (char ** cmdline_p)
if (c != ' ') if (c != ' ')
goto next_char; 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 #ifdef CONFIG_ACPI_BOOT
/* "acpi=off" disables both ACPI table parsing and interpreter init */ /* "acpi=off" disables both ACPI table parsing and interpreter init */
if (!memcmp(from, "acpi=off", 8)) if (!memcmp(from, "acpi=off", 8))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment