Commit 856b185dd23da39e562983fbf28860f54e661b41

Authored by Alex Chiang
Committed by Len Brown
1 parent 589643be66

ACPI: processor: fix processor_physically_present on UP

The commit 5d554a7bb06 (ACPI: processor: add internal
processor_physically_present()) is broken on uniprocessor (UP)
configurations, as acpi_get_cpuid() will always return -1.

We use the value of num_possible_cpus() to tell us whether we got
an invalid cpuid from acpi_get_cpuid() in the SMP case, or if
instead, we are UP, in which case num_possible_cpus() is #defined
as 1.

We use num_possible_cpus() instead of num_online_cpus() to
protect ourselves against the scenario of CPU hotplug, and we've
taken down all the CPUs except one.

Thanks to Jan Pogadl for initial report and analysis and Chen
Gong for review.

https://bugzilla.kernel.org/show_bug.cgi?id=16357

Reported-by: Jan Pogadl <pogadl.jan@googlemail.com>:
Reviewed-by: Chen Gong <gong.chen@linux.intel.com>
Signed-off-by: Alex Chiang <achiang@canonical.com>
Signed-off-by: Len Brown <len.brown@intel.com>

Showing 1 changed file with 1 additions and 1 deletions Side-by-side Diff

drivers/acpi/processor_core.c
... ... @@ -223,7 +223,7 @@
223 223 type = (acpi_type == ACPI_TYPE_DEVICE) ? 1 : 0;
224 224 cpuid = acpi_get_cpuid(handle, type, acpi_id);
225 225  
226   - if (cpuid == -1)
  226 + if ((cpuid == -1) && (num_possible_cpus() > 1))
227 227 return false;
228 228  
229 229 return true;