[PATCH v3 0/3] ACPI: SBS: Fix various issues

Armin Wolf posted 3 patches 1 year, 1 month ago
drivers/acpi/ec.c  | 17 ++++++++++++++---
drivers/acpi/sbs.c | 27 ++++++++++++++++++---------
2 files changed, 32 insertions(+), 12 deletions(-)
[PATCH v3 0/3] ACPI: SBS: Fix various issues
Posted by Armin Wolf 1 year, 1 month ago
On my Acer Travelmate 4002WLMi, the system locks up upon
suspend/shutdown. After a lot of research, it turned out
that the sbs module was the culprit. The driver would not
correctly mask out the value used to select a battery using
the "Smart Battery Selector" (subset of the "Smart Battery Manager").
This accidentally caused a invalid power source to be selected,
which was automatically corrected by the selector. Upon
notifing the host about the corrected power source, some batteries
would be selected for re-reading, causing a endless loop.
This would lead to some workqueues filling up, which caused the
lockup upon suspend/shutdown.

The first patch fixes an issue inside the ec driver regarding the
removal of query handlers discovered thru ACPI. The second patch fixes
a kernel oops on module removal caused by a race condition when removing
custom EC query handlers. The last patch finally fixes the
suspend/shutdown issues.

As a side note: This was the first machine on which i installed Linux,
to finally fixing this took ~5 years of tinkering.

Tested on a Acer Travelmate 4002WLMi.
---
Changes in v3:
- Rework solution for the kernel oops on module removal
Changes in v2:
- make acpi_ec_add_query_handler() static to fix warning

Armin Wolf (3):
  ACPI: EC: Limit explicit removal of query handlers to custom query
    handlers
  ACPI: EC: Fix oops when removing custom query handlers
  ACPI: SBS: Fix handling of Smart Battery Selectors

 drivers/acpi/ec.c  | 17 ++++++++++++++---
 drivers/acpi/sbs.c | 27 ++++++++++++++++++---------
 2 files changed, 32 insertions(+), 12 deletions(-)

--
2.30.2
Re: [PATCH v3 0/3] ACPI: SBS: Fix various issues
Posted by Rafael J. Wysocki 1 year ago
On Fri, Mar 24, 2023 at 9:26 PM Armin Wolf <W_Armin@gmx.de> wrote:
>
> On my Acer Travelmate 4002WLMi, the system locks up upon
> suspend/shutdown. After a lot of research, it turned out
> that the sbs module was the culprit. The driver would not
> correctly mask out the value used to select a battery using
> the "Smart Battery Selector" (subset of the "Smart Battery Manager").
> This accidentally caused a invalid power source to be selected,
> which was automatically corrected by the selector. Upon
> notifing the host about the corrected power source, some batteries
> would be selected for re-reading, causing a endless loop.
> This would lead to some workqueues filling up, which caused the
> lockup upon suspend/shutdown.
>
> The first patch fixes an issue inside the ec driver regarding the
> removal of query handlers discovered thru ACPI. The second patch fixes
> a kernel oops on module removal caused by a race condition when removing
> custom EC query handlers. The last patch finally fixes the
> suspend/shutdown issues.
>
> As a side note: This was the first machine on which i installed Linux,
> to finally fixing this took ~5 years of tinkering.
>
> Tested on a Acer Travelmate 4002WLMi.
> ---
> Changes in v3:
> - Rework solution for the kernel oops on module removal
> Changes in v2:
> - make acpi_ec_add_query_handler() static to fix warning
>
> Armin Wolf (3):
>   ACPI: EC: Limit explicit removal of query handlers to custom query
>     handlers
>   ACPI: EC: Fix oops when removing custom query handlers
>   ACPI: SBS: Fix handling of Smart Battery Selectors
>
>  drivers/acpi/ec.c  | 17 ++++++++++++++---
>  drivers/acpi/sbs.c | 27 ++++++++++++++++++---------
>  2 files changed, 32 insertions(+), 12 deletions(-)
>
> --

All applied as 6.4 material with a minor comment adjustment in the first patch.

Thanks!
Re: [PATCH v3 0/3] ACPI: SBS: Fix various issues
Posted by Armin Wolf 1 year ago
Am 30.03.23 um 19:02 schrieb Rafael J. Wysocki:

> On Fri, Mar 24, 2023 at 9:26 PM Armin Wolf <W_Armin@gmx.de> wrote:
>> On my Acer Travelmate 4002WLMi, the system locks up upon
>> suspend/shutdown. After a lot of research, it turned out
>> that the sbs module was the culprit. The driver would not
>> correctly mask out the value used to select a battery using
>> the "Smart Battery Selector" (subset of the "Smart Battery Manager").
>> This accidentally caused a invalid power source to be selected,
>> which was automatically corrected by the selector. Upon
>> notifing the host about the corrected power source, some batteries
>> would be selected for re-reading, causing a endless loop.
>> This would lead to some workqueues filling up, which caused the
>> lockup upon suspend/shutdown.
>>
>> The first patch fixes an issue inside the ec driver regarding the
>> removal of query handlers discovered thru ACPI. The second patch fixes
>> a kernel oops on module removal caused by a race condition when removing
>> custom EC query handlers. The last patch finally fixes the
>> suspend/shutdown issues.
>>
>> As a side note: This was the first machine on which i installed Linux,
>> to finally fixing this took ~5 years of tinkering.
>>
>> Tested on a Acer Travelmate 4002WLMi.
>> ---
>> Changes in v3:
>> - Rework solution for the kernel oops on module removal
>> Changes in v2:
>> - make acpi_ec_add_query_handler() static to fix warning
>>
>> Armin Wolf (3):
>>    ACPI: EC: Limit explicit removal of query handlers to custom query
>>      handlers
>>    ACPI: EC: Fix oops when removing custom query handlers
>>    ACPI: SBS: Fix handling of Smart Battery Selectors
>>
>>   drivers/acpi/ec.c  | 17 ++++++++++++++---
>>   drivers/acpi/sbs.c | 27 ++++++++++++++++++---------
>>   2 files changed, 32 insertions(+), 12 deletions(-)
>>
>> --
> All applied as 6.4 material with a minor comment adjustment in the first patch.
>
> Thanks!

Thank you!