* [PATCH] ACPI: print error message and bail out early if failed to parse APIC ID for CPU
@ 2014-01-09 8:15 Jiang Liu
2014-01-09 12:12 ` Rafael J. Wysocki
0 siblings, 1 reply; 4+ messages in thread
From: Jiang Liu @ 2014-01-09 8:15 UTC (permalink / raw)
To: Rafael J . Wysocki, Len Brown, Rafael J. Wysocki
Cc: Jiang Liu, linux-acpi, linux-kernel
Enhance ACPI CPU hotplug driver to print clear error message and
bail out early if BIOS returns wrong value in ACPI MADT table or
_MAT method. Otherwise it will add the CPU device even if failed
to get APIC ID and fails any operations against sysfs interface:
/sys/devices/system/cpu/cpux/online
Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
---
drivers/acpi/acpi_processor.c | 24 ++++++++++++++----------
1 file changed, 14 insertions(+), 10 deletions(-)
diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c
index 3c1d6b0..6ce71b0 100644
--- a/drivers/acpi/acpi_processor.c
+++ b/drivers/acpi/acpi_processor.c
@@ -212,7 +212,7 @@ static int acpi_processor_get_info(struct acpi_device *device)
union acpi_object object = { 0 };
struct acpi_buffer buffer = { sizeof(union acpi_object), &object };
struct acpi_processor *pr = acpi_driver_data(device);
- int cpu_index, device_declaration = 0;
+ int apic_id, cpu_index, device_declaration = 0;
acpi_status status = AE_OK;
static int cpu0_initialized;
unsigned long long value;
@@ -258,18 +258,21 @@ static int acpi_processor_get_info(struct acpi_device *device)
device_declaration = 1;
pr->acpi_id = value;
}
- pr->apic_id = acpi_get_apicid(pr->handle, device_declaration,
- pr->acpi_id);
- cpu_index = acpi_map_cpuid(pr->apic_id, pr->acpi_id);
- /* Handle UP system running SMP kernel, with no LAPIC in MADT */
- if (!cpu0_initialized && (cpu_index == -1) &&
- (num_online_cpus() == 1)) {
- cpu_index = 0;
+ apic_id = acpi_get_apicid(pr->handle, device_declaration, pr->acpi_id);
+ if (apic_id < 0) {
+ acpi_handle_err(pr->handle, "failed to get CPU APIC ID.\n");
+ return -ENODEV;
}
+ pr->apic_id = apic_id;
- cpu0_initialized = 1;
-
+ cpu_index = acpi_map_cpuid(pr->apic_id, pr->acpi_id);
+ if (!cpu0_initialized) {
+ cpu0_initialized = 1;
+ /* Handle UP system running SMP kernel, with no LAPIC in MADT */
+ if ((cpu_index == -1) && (num_online_cpus() == 1))
+ cpu_index = 0;
+ }
pr->id = cpu_index;
/*
@@ -282,6 +285,7 @@ static int acpi_processor_get_info(struct acpi_device *device)
if (ret)
return ret;
}
+
/*
* On some boxes several processors use the same processor bus id.
* But they are located in different scope. For example:
--
1.7.10.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] ACPI: print error message and bail out early if failed to parse APIC ID for CPU
2014-01-09 8:15 [PATCH] ACPI: print error message and bail out early if failed to parse APIC ID for CPU Jiang Liu
@ 2014-01-09 12:12 ` Rafael J. Wysocki
2014-01-10 1:35 ` Jiang Liu
0 siblings, 1 reply; 4+ messages in thread
From: Rafael J. Wysocki @ 2014-01-09 12:12 UTC (permalink / raw)
To: Jiang Liu; +Cc: Rafael J . Wysocki, Len Brown, linux-acpi, linux-kernel
On Thursday, January 09, 2014 04:15:19 PM Jiang Liu wrote:
> Enhance ACPI CPU hotplug driver to print clear error message and
> bail out early if BIOS returns wrong value in ACPI MADT table or
> _MAT method. Otherwise it will add the CPU device even if failed
> to get APIC ID and fails any operations against sysfs interface:
> /sys/devices/system/cpu/cpux/online
>
> Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
Do you have any pointers to bug reports regarding this etc.? If so,
it would be good to add links to them to the commit log.
Thanks!
> ---
> drivers/acpi/acpi_processor.c | 24 ++++++++++++++----------
> 1 file changed, 14 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c
> index 3c1d6b0..6ce71b0 100644
> --- a/drivers/acpi/acpi_processor.c
> +++ b/drivers/acpi/acpi_processor.c
> @@ -212,7 +212,7 @@ static int acpi_processor_get_info(struct acpi_device *device)
> union acpi_object object = { 0 };
> struct acpi_buffer buffer = { sizeof(union acpi_object), &object };
> struct acpi_processor *pr = acpi_driver_data(device);
> - int cpu_index, device_declaration = 0;
> + int apic_id, cpu_index, device_declaration = 0;
> acpi_status status = AE_OK;
> static int cpu0_initialized;
> unsigned long long value;
> @@ -258,18 +258,21 @@ static int acpi_processor_get_info(struct acpi_device *device)
> device_declaration = 1;
> pr->acpi_id = value;
> }
> - pr->apic_id = acpi_get_apicid(pr->handle, device_declaration,
> - pr->acpi_id);
> - cpu_index = acpi_map_cpuid(pr->apic_id, pr->acpi_id);
>
> - /* Handle UP system running SMP kernel, with no LAPIC in MADT */
> - if (!cpu0_initialized && (cpu_index == -1) &&
> - (num_online_cpus() == 1)) {
> - cpu_index = 0;
> + apic_id = acpi_get_apicid(pr->handle, device_declaration, pr->acpi_id);
> + if (apic_id < 0) {
> + acpi_handle_err(pr->handle, "failed to get CPU APIC ID.\n");
> + return -ENODEV;
> }
> + pr->apic_id = apic_id;
>
> - cpu0_initialized = 1;
> -
> + cpu_index = acpi_map_cpuid(pr->apic_id, pr->acpi_id);
> + if (!cpu0_initialized) {
> + cpu0_initialized = 1;
> + /* Handle UP system running SMP kernel, with no LAPIC in MADT */
> + if ((cpu_index == -1) && (num_online_cpus() == 1))
> + cpu_index = 0;
> + }
> pr->id = cpu_index;
>
> /*
> @@ -282,6 +285,7 @@ static int acpi_processor_get_info(struct acpi_device *device)
> if (ret)
> return ret;
> }
> +
> /*
> * On some boxes several processors use the same processor bus id.
> * But they are located in different scope. For example:
>
--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ACPI: print error message and bail out early if failed to parse APIC ID for CPU
2014-01-09 12:12 ` Rafael J. Wysocki
@ 2014-01-10 1:35 ` Jiang Liu
2014-01-10 1:52 ` Rafael J. Wysocki
0 siblings, 1 reply; 4+ messages in thread
From: Jiang Liu @ 2014-01-10 1:35 UTC (permalink / raw)
To: Rafael J. Wysocki; +Cc: Rafael J . Wysocki, Len Brown, linux-acpi, linux-kernel
On 2014/1/9 20:12, Rafael J. Wysocki wrote:
> On Thursday, January 09, 2014 04:15:19 PM Jiang Liu wrote:
>> Enhance ACPI CPU hotplug driver to print clear error message and
>> bail out early if BIOS returns wrong value in ACPI MADT table or
>> _MAT method. Otherwise it will add the CPU device even if failed
>> to get APIC ID and fails any operations against sysfs interface:
>> /sys/devices/system/cpu/cpux/online
>>
>> Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
>
> Do you have any pointers to bug reports regarding this etc.? If so,
> it would be good to add links to them to the commit log.
Hi Rafael,
I have no bug id for this. It was found during verifying an
internal BIOS version, so no external bug id for it yet.
Cheers!
Gerry
>
> Thanks!
>
>> ---
>> drivers/acpi/acpi_processor.c | 24 ++++++++++++++----------
>> 1 file changed, 14 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c
>> index 3c1d6b0..6ce71b0 100644
>> --- a/drivers/acpi/acpi_processor.c
>> +++ b/drivers/acpi/acpi_processor.c
>> @@ -212,7 +212,7 @@ static int acpi_processor_get_info(struct acpi_device *device)
>> union acpi_object object = { 0 };
>> struct acpi_buffer buffer = { sizeof(union acpi_object), &object };
>> struct acpi_processor *pr = acpi_driver_data(device);
>> - int cpu_index, device_declaration = 0;
>> + int apic_id, cpu_index, device_declaration = 0;
>> acpi_status status = AE_OK;
>> static int cpu0_initialized;
>> unsigned long long value;
>> @@ -258,18 +258,21 @@ static int acpi_processor_get_info(struct acpi_device *device)
>> device_declaration = 1;
>> pr->acpi_id = value;
>> }
>> - pr->apic_id = acpi_get_apicid(pr->handle, device_declaration,
>> - pr->acpi_id);
>> - cpu_index = acpi_map_cpuid(pr->apic_id, pr->acpi_id);
>>
>> - /* Handle UP system running SMP kernel, with no LAPIC in MADT */
>> - if (!cpu0_initialized && (cpu_index == -1) &&
>> - (num_online_cpus() == 1)) {
>> - cpu_index = 0;
>> + apic_id = acpi_get_apicid(pr->handle, device_declaration, pr->acpi_id);
>> + if (apic_id < 0) {
>> + acpi_handle_err(pr->handle, "failed to get CPU APIC ID.\n");
>> + return -ENODEV;
>> }
>> + pr->apic_id = apic_id;
>>
>> - cpu0_initialized = 1;
>> -
>> + cpu_index = acpi_map_cpuid(pr->apic_id, pr->acpi_id);
>> + if (!cpu0_initialized) {
>> + cpu0_initialized = 1;
>> + /* Handle UP system running SMP kernel, with no LAPIC in MADT */
>> + if ((cpu_index == -1) && (num_online_cpus() == 1))
>> + cpu_index = 0;
>> + }
>> pr->id = cpu_index;
>>
>> /*
>> @@ -282,6 +285,7 @@ static int acpi_processor_get_info(struct acpi_device *device)
>> if (ret)
>> return ret;
>> }
>> +
>> /*
>> * On some boxes several processors use the same processor bus id.
>> * But they are located in different scope. For example:
>>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ACPI: print error message and bail out early if failed to parse APIC ID for CPU
2014-01-10 1:35 ` Jiang Liu
@ 2014-01-10 1:52 ` Rafael J. Wysocki
0 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2014-01-10 1:52 UTC (permalink / raw)
To: Jiang Liu; +Cc: Rafael J . Wysocki, Len Brown, linux-acpi, linux-kernel
On Friday, January 10, 2014 09:35:08 AM Jiang Liu wrote:
>
> On 2014/1/9 20:12, Rafael J. Wysocki wrote:
> > On Thursday, January 09, 2014 04:15:19 PM Jiang Liu wrote:
> >> Enhance ACPI CPU hotplug driver to print clear error message and
> >> bail out early if BIOS returns wrong value in ACPI MADT table or
> >> _MAT method. Otherwise it will add the CPU device even if failed
> >> to get APIC ID and fails any operations against sysfs interface:
> >> /sys/devices/system/cpu/cpux/online
> >>
> >> Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com>
> >
> > Do you have any pointers to bug reports regarding this etc.? If so,
> > it would be good to add links to them to the commit log.
> Hi Rafael,
> I have no bug id for this. It was found during verifying an
> internal BIOS version, so no external bug id for it yet.
OK
I'm going to queue it up for 3.14.
Thanks!
> >> ---
> >> drivers/acpi/acpi_processor.c | 24 ++++++++++++++----------
> >> 1 file changed, 14 insertions(+), 10 deletions(-)
> >>
> >> diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c
> >> index 3c1d6b0..6ce71b0 100644
> >> --- a/drivers/acpi/acpi_processor.c
> >> +++ b/drivers/acpi/acpi_processor.c
> >> @@ -212,7 +212,7 @@ static int acpi_processor_get_info(struct acpi_device *device)
> >> union acpi_object object = { 0 };
> >> struct acpi_buffer buffer = { sizeof(union acpi_object), &object };
> >> struct acpi_processor *pr = acpi_driver_data(device);
> >> - int cpu_index, device_declaration = 0;
> >> + int apic_id, cpu_index, device_declaration = 0;
> >> acpi_status status = AE_OK;
> >> static int cpu0_initialized;
> >> unsigned long long value;
> >> @@ -258,18 +258,21 @@ static int acpi_processor_get_info(struct acpi_device *device)
> >> device_declaration = 1;
> >> pr->acpi_id = value;
> >> }
> >> - pr->apic_id = acpi_get_apicid(pr->handle, device_declaration,
> >> - pr->acpi_id);
> >> - cpu_index = acpi_map_cpuid(pr->apic_id, pr->acpi_id);
> >>
> >> - /* Handle UP system running SMP kernel, with no LAPIC in MADT */
> >> - if (!cpu0_initialized && (cpu_index == -1) &&
> >> - (num_online_cpus() == 1)) {
> >> - cpu_index = 0;
> >> + apic_id = acpi_get_apicid(pr->handle, device_declaration, pr->acpi_id);
> >> + if (apic_id < 0) {
> >> + acpi_handle_err(pr->handle, "failed to get CPU APIC ID.\n");
> >> + return -ENODEV;
> >> }
> >> + pr->apic_id = apic_id;
> >>
> >> - cpu0_initialized = 1;
> >> -
> >> + cpu_index = acpi_map_cpuid(pr->apic_id, pr->acpi_id);
> >> + if (!cpu0_initialized) {
> >> + cpu0_initialized = 1;
> >> + /* Handle UP system running SMP kernel, with no LAPIC in MADT */
> >> + if ((cpu_index == -1) && (num_online_cpus() == 1))
> >> + cpu_index = 0;
> >> + }
> >> pr->id = cpu_index;
> >>
> >> /*
> >> @@ -282,6 +285,7 @@ static int acpi_processor_get_info(struct acpi_device *device)
> >> if (ret)
> >> return ret;
> >> }
> >> +
> >> /*
> >> * On some boxes several processors use the same processor bus id.
> >> * But they are located in different scope. For example:
> >>
> >
> --
> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-01-10 1:38 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-09 8:15 [PATCH] ACPI: print error message and bail out early if failed to parse APIC ID for CPU Jiang Liu
2014-01-09 12:12 ` Rafael J. Wysocki
2014-01-10 1:35 ` Jiang Liu
2014-01-10 1:52 ` Rafael J. Wysocki
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.