]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
x86/ACPI: keep x86_cpu_to_acpiid mapping valid on CPU hotplug
authorVitaly Kuznetsov <vkuznets@redhat.com>
Mon, 6 Feb 2017 17:01:51 +0000 (18:01 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 7 Feb 2017 12:34:56 +0000 (13:34 +0100)
We may or may not have all possible CPUs in MADT on boot but in any
case we're overwriting x86_cpu_to_acpiid mapping with U32_MAX when
acpi_register_lapic() is called again on the CPU hotplug path:

acpi_processor_hotadd_init()
  -> acpi_map_cpu()
    -> acpi_register_lapic()

As we have the required acpi_id information in acpi_processor_hotadd_init()
propagate it to acpi_map_cpu() to always keep x86_cpu_to_acpiid
mapping valid.

Reported-by: Andrew Jones <drjones@redhat.com>
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
arch/ia64/kernel/acpi.c
arch/x86/kernel/acpi/boot.c
drivers/acpi/acpi_processor.c
include/linux/acpi.h

index 9273e034b730360a21abeaeaa88aa2e6e2c5401c..7508c306aa9e0d8124f5270e5f8b62cf2b7467b6 100644 (file)
@@ -887,7 +887,8 @@ static int _acpi_map_lsapic(acpi_handle handle, int physid, int *pcpu)
 }
 
 /* wrapper to silence section mismatch warning */
-int __ref acpi_map_cpu(acpi_handle handle, phys_cpuid_t physid, int *pcpu)
+int __ref acpi_map_cpu(acpi_handle handle, phys_cpuid_t physid, u32 acpi_id,
+                      int *pcpu)
 {
        return _acpi_map_lsapic(handle, physid, pcpu);
 }
index 64422f850e95e2da7991ded073041f5df5b4dfae..04bc5f3f9aa1e04d904bc5a96f6cc08437022982 100644 (file)
@@ -723,11 +723,12 @@ int acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
        return 0;
 }
 
-int acpi_map_cpu(acpi_handle handle, phys_cpuid_t physid, int *pcpu)
+int acpi_map_cpu(acpi_handle handle, phys_cpuid_t physid, u32 acpi_id,
+                int *pcpu)
 {
        int cpu;
 
-       cpu = acpi_register_lapic(physid, U32_MAX, ACPI_MADT_ENABLED);
+       cpu = acpi_register_lapic(physid, acpi_id, ACPI_MADT_ENABLED);
        if (cpu < 0) {
                pr_info(PREFIX "Unable to map lapic to logical cpu number\n");
                return cpu;
index 3de3b6b8f0f1b756adc455229aedba9731113e5d..4467a8089ab890695ccf7072220d9c43d1f29c2d 100644 (file)
@@ -165,7 +165,7 @@ static int acpi_processor_errata(void)
 
 #ifdef CONFIG_ACPI_HOTPLUG_CPU
 int __weak acpi_map_cpu(acpi_handle handle,
-               phys_cpuid_t physid, int *pcpu)
+               phys_cpuid_t physid, u32 acpi_id, int *pcpu)
 {
        return -ENODEV;
 }
@@ -203,7 +203,7 @@ static int acpi_processor_hotadd_init(struct acpi_processor *pr)
        cpu_maps_update_begin();
        cpu_hotplug_begin();
 
-       ret = acpi_map_cpu(pr->handle, pr->phys_id, &pr->id);
+       ret = acpi_map_cpu(pr->handle, pr->phys_id, pr->acpi_id, &pr->id);
        if (ret)
                goto out;
 
index 5b36974ed60a55c748758c9327addaebf73912a4..6ab47e92c65a467e642c346a2242776337c013c2 100644 (file)
@@ -291,7 +291,8 @@ bool acpi_processor_validate_proc_id(int proc_id);
 
 #ifdef CONFIG_ACPI_HOTPLUG_CPU
 /* Arch dependent functions for cpu hotplug support */
-int acpi_map_cpu(acpi_handle handle, phys_cpuid_t physid, int *pcpu);
+int acpi_map_cpu(acpi_handle handle, phys_cpuid_t physid, u32 acpi_id,
+                int *pcpu);
 int acpi_unmap_cpu(int cpu);
 int acpi_map_cpu2node(acpi_handle handle, int cpu, int physid);
 #endif /* CONFIG_ACPI_HOTPLUG_CPU */