Re: [RFC][PATCH v2] ACPI: Ignore invalid _PSS entries, but use valid ones

From: Marco Aurelio da Costa
Date: Fri May 04 2012 - 12:21:41 EST


On Fri, May 4, 2012 at 6:11 PM, Konrad Rzeszutek Wilk
<konrad.wilk@xxxxxxxxxx> wrote:
> On Fri, May 04, 2012 at 05:25:13PM +0200, Marco Aurelio da Costa wrote:
>> From: Marco Aurelio da Costa <costa@xxxxxxxxx>
>> [v2: Fixes suggested by Konrad]
>> Signed-off-by: Marco Aurelio da Costa <costa@xxxxxxxxx>
>
> Heh. You didn't compile test this version did you?

>>
>> The EliteBook 8560W has non-initialized entries in its _PSS ACPI
>> table. Instead of bailing out when the first non-initialized entry is
>> found, ignore it and use only Âthe valid entries. Only bail out if there
>> is no valid entry at all.
>>
>> ---
>> --- linux-3.3.3/drivers/acpi/processor_perflib.c.orig 2012-04-24
>> 22:18:23.288041268 +0200
>> +++ linux-3.3.3/drivers/acpi/processor_perflib.c   Â2012-05-04
>> 17:22:57.400034613 +0200
>> @@ -311,6 +311,7 @@ static int acpi_processor_get_performanc
>> Â Â Â struct acpi_buffer state = { 0, NULL };
>> Â Â Â union acpi_object *pss = NULL;
>> Â Â Â int i;
>> + Â Â int last_invalid = -1;
>>
>>
>> Â Â Â status = acpi_evaluate_object(pr->handle, "_PSS", NULL, &buffer);
>> @@ -372,14 +373,32 @@ static int acpi_processor_get_performanc
>> Â Â Â Â Â Â Â Â Â ((u32)(px->core_frequency * 1000) !=
>> Â Â Â Â Â Â Â Â Â Â(px->core_frequency * 1000))) {
>> Â Â Â Â Â Â Â Â Â Â Â printk(KERN_ERR FW_BUG PREFIX
>> - Â Â Â Â Â Â Â Â Â Â Â Â Â Â"Invalid BIOS _PSS frequency: 0x%llx MHz\n",
>> - Â Â Â Â Â Â Â Â Â Â Â Â Â Âpx->core_frequency);
>> - Â Â Â Â Â Â Â Â Â Â result = -EFAULT;
>> - Â Â Â Â Â Â Â Â Â Â kfree(pr->performance->states);
>> - Â Â Â Â Â Â Â Â Â Â goto end;
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â"Invalid BIOS _PSS frequency found for processor %d: 0x%llx MHz\n",
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Âpr->id, px->core_frequency);
>> + Â Â Â Â Â Â Â Â Â Â if (last_invalidi == -1)
>
> Hrmm. invalidi?

Sorry, vi...

>
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â last_invalid = i;
>> + Â Â Â Â Â Â } else {
>> + Â Â Â Â Â Â Â Â Â Â if (last_invalid != -1) {
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â /*
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â* Copy this valid entry over last_invalid entry
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â*/
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â memcpy(&(pr->performance->states[last_invalid]),
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âpx, sizeof(struct acpi_processor_px));
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â ++last_invalid;
>> + Â Â Â Â Â Â Â Â Â Â }
>> Â Â Â Â Â Â Â }
>> Â Â Â }
>>
>> + Â Â if (last_invalid == 0) {
>> + Â Â Â Â Â Â printk(KERN_ERR FW_BUG PREFIX
>> + Â Â Â Â Â Â Â Â Â Â"No valid BIOS _PSS frequency found for processor %d\n", pr->id);
>> + Â Â Â Â Â Â result = -EFAULT;
>> + Â Â Â Â Â Â kfree(pr->performance->states);
>
> Just as a precaution - also do this pls:
>
> pr->performance->states = NULL?

It wasn't on the original code, but I agree with you.

Doing and compiling, this time... :)

>
>> + Â Â }
>> +
>> + Â Â if (last_invalid > 0)
>> + Â Â Â Â Â Â pr->performance->state_count = last_invalid;
>> +
>> Â Â Â Âend:
>> Â Â Â kfree(buffer.pointer);
>>
>> --
>> Marco Costa
>> Customer Support
>> --
>> GAMIC mbH
>> Roermonder Strasse, 151
>> 52072 Aachen
>> Germany
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
>> the body of a message to majordomo@xxxxxxxxxxxxxxx
>> More majordomo info at Âhttp://vger.kernel.org/majordomo-info.html



--
Marco Costa
Customer Support
--
GAMIC mbH
Roermonder Strasse, 151
52072 Aachen
Germany
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/