Commit bf841403 authored by Bjorn Helgaas's avatar Bjorn Helgaas Committed by David Mosberger

[PATCH] ia64: clean up acpi_boot_init()

I was confused about this bit
of code in acpi_boot_init():

        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_build_cpu_map();

because it first saves available cpus in smp_boot_data, then potentially
modifies available_cpus.  This looked at first like a bug, but I think
actually works out correctly, because smp_boot_data.cpu_count is only
used in smp_build_cpu_map(), and if cpu_count is zero, it prevents us
from looking at smp_boot_data.cpu_phys_id[0], which hasn't been
initialized.

This should only happen with really buggy firmware, so I'm not even
sure it's worth doing more than panicking, but if we're going to deal
with it, I propose the following patch to avoid even the appearance
of a bug.  This just does what acpi_parse_lsapic() would have done
if the firmware tables were correct.
parent 758d297b
...@@ -603,11 +603,13 @@ acpi_boot_init (void) ...@@ -603,11 +603,13 @@ acpi_boot_init (void)
printk(KERN_ERR PREFIX "Can't find FADT\n"); printk(KERN_ERR PREFIX "Can't find FADT\n");
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
smp_boot_data.cpu_count = available_cpus;
if (available_cpus == 0) { if (available_cpus == 0) {
printk(KERN_INFO "ACPI: Found 0 CPUS; assuming 1\n"); printk(KERN_INFO "ACPI: Found 0 CPUS; assuming 1\n");
printk(KERN_INFO "CPU 0 (0x%04x)", hard_smp_processor_id());
smp_boot_data.cpu_phys_id[available_cpus] = hard_smp_processor_id();
available_cpus = 1; /* We've got at least one of these, no? */ available_cpus = 1; /* We've got at least one of these, no? */
} }
smp_boot_data.cpu_count = available_cpus;
smp_build_cpu_map(); smp_build_cpu_map();
# ifdef CONFIG_NUMA # ifdef CONFIG_NUMA
......
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