• Bjorn Helgaas's avatar
    [PATCH] ia64: clean up acpi_boot_init() · bf841403
    Bjorn Helgaas authored
    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.
    bf841403
acpi.c 17.8 KB