Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=fbb43ab03c1fa7587476910d346ee11882b4cc62
Commit:     fbb43ab03c1fa7587476910d346ee11882b4cc62
Parent:     81257def2ab8ae1680583ce1e5f018dc6c8ed98d
Author:     Christoph Lameter <[EMAIL PROTECTED]>
AuthorDate: Wed Nov 28 16:22:08 2007 -0800
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Thu Nov 29 09:24:55 2007 -0800

    ACPI: avoid references to impossible processors.
    
    ACPI uses NR_CPUS in various loops and in some it accesses per cpu data of
    processors that are not present(!) and that will never be present.
    
    The pointers to per cpu data are typically not initialized for processors
    that are not present.  So we seem to be reading something here from offset
    0 in memory.
    
    Make ACPI use nr_cpu_ids instead. That stops at the end of the possible
    processors.
    
    Convert one loop to NR_CPUS to use the cpu_possible map instead.  That way
    ranges of processor that can never be brought online are skipped during the
    loop.
    
    Signed-off-by: Christoph Lameter <[EMAIL PROTECTED]>
    Cc: Len Brown <[EMAIL PROTECTED]>
    Acked-by: Andi Kleen <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 drivers/acpi/processor_core.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index 015689d..e48ee4f 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -494,7 +494,7 @@ static int get_cpu_id(acpi_handle handle, u32 acpi_id)
        if (apic_id == -1)
                return apic_id;
 
-       for (i = 0; i < NR_CPUS; ++i) {
+       for_each_possible_cpu(i) {
                if (cpu_physical_id(i) == apic_id)
                        return i;
        }
@@ -632,7 +632,7 @@ static int __cpuinit acpi_processor_start(struct 
acpi_device *device)
                return 0;
        }
 
-       BUG_ON((pr->id >= NR_CPUS) || (pr->id < 0));
+       BUG_ON((pr->id >= nr_cpu_ids) || (pr->id < 0));
 
        /*
         * Buggy BIOS check
@@ -774,7 +774,7 @@ static int acpi_processor_remove(struct acpi_device 
*device, int type)
 
        pr = acpi_driver_data(device);
 
-       if (pr->id >= NR_CPUS) {
+       if (pr->id >= nr_cpu_ids) {
                kfree(pr);
                return 0;
        }
@@ -845,7 +845,7 @@ int acpi_processor_device_add(acpi_handle handle, struct 
acpi_device **device)
        if (!pr)
                return -ENODEV;
 
-       if ((pr->id >= 0) && (pr->id < NR_CPUS)) {
+       if ((pr->id >= 0) && (pr->id < nr_cpu_ids)) {
                kobject_uevent(&(*device)->dev.kobj, KOBJ_ONLINE);
        }
        return 0;
@@ -883,13 +883,13 @@ acpi_processor_hotplug_notify(acpi_handle handle, u32 
event, void *data)
                        break;
                }
 
-               if (pr->id >= 0 && (pr->id < NR_CPUS)) {
+               if (pr->id >= 0 && (pr->id < nr_cpu_ids)) {
                        kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE);
                        break;
                }
 
                result = acpi_processor_start(device);
-               if ((!result) && ((pr->id >= 0) && (pr->id < NR_CPUS))) {
+               if ((!result) && ((pr->id >= 0) && (pr->id < nr_cpu_ids))) {
                        kobject_uevent(&device->dev.kobj, KOBJ_ONLINE);
                } else {
                        printk(KERN_ERR PREFIX "Device [%s] failed to start\n",
@@ -912,7 +912,7 @@ acpi_processor_hotplug_notify(acpi_handle handle, u32 
event, void *data)
                        return;
                }
 
-               if ((pr->id < NR_CPUS) && (cpu_present(pr->id)))
+               if ((pr->id < nr_cpu_ids) && (cpu_present(pr->id)))
                        kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE);
                break;
        default:
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to