Commit 0a943740 authored by David Mosberger's avatar David Mosberger

smpboot.c, acpi.c:

  ia64: NR_CPUS and number of CPUs

While building a kernel for our 4-way Lion box, I made the
mistake of setting NR_CPUS to 4.  Little did I know that the
Lion ACPI tables always list 8 CPUs (with only the first N
enabled), and so the resulting kernel overflowed the
smp_boot_data.cpu_phys_id array, crashed and burned.
parent fef1012e
......@@ -192,21 +192,19 @@ acpi_parse_lsapic (acpi_table_entry_header *header)
printk(KERN_INFO "CPU %d (0x%04x)", total_cpus, (lsapic->id << 8) | lsapic->eid);
if (lsapic->flags.enabled) {
available_cpus++;
if (!lsapic->flags.enabled)
printk(" disabled");
else if (available_cpus >= NR_CPUS)
printk(" ignored (increase NR_CPUS)");
else {
printk(" enabled");
#ifdef CONFIG_SMP
smp_boot_data.cpu_phys_id[total_cpus] = (lsapic->id << 8) | lsapic->eid;
smp_boot_data.cpu_phys_id[available_cpus] = (lsapic->id << 8) | lsapic->eid;
if (hard_smp_processor_id()
== (unsigned int) smp_boot_data.cpu_phys_id[total_cpus])
== (unsigned int) smp_boot_data.cpu_phys_id[available_cpus])
printk(" (BSP)");
#endif
}
else {
printk(" disabled");
#ifdef CONFIG_SMP
smp_boot_data.cpu_phys_id[total_cpus] = -1;
#endif
++available_cpus;
}
printk("\n");
......@@ -695,11 +693,11 @@ acpi_boot_init (void)
#endif
#ifdef CONFIG_SMP
smp_boot_data.cpu_count = available_cpus;
if (available_cpus == 0) {
printk(KERN_INFO "ACPI: Found 0 CPUS; assuming 1\n");
available_cpus = 1; /* We've got at least one of these, no? */
}
smp_boot_data.cpu_count = total_cpus;
smp_build_cpu_map();
# ifdef CONFIG_NUMA
......
......@@ -449,7 +449,7 @@ smp_build_cpu_map (void)
for (cpu = 1, i = 0; i < smp_boot_data.cpu_count; i++) {
sapicid = smp_boot_data.cpu_phys_id[i];
if (sapicid == -1 || sapicid == boot_cpu_id)
if (sapicid == boot_cpu_id)
continue;
phys_cpu_present_map |= (1 << cpu);
ia64_cpu_to_sapicid[cpu] = sapicid;
......
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