mbox series

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

Message ID 20230324202628.76966-1-W_Armin@gmx.de (mailing list archive)
Headers show
Series ACPI: SBS: Fix various issues | expand

Message

Armin Wolf March 24, 2023, 8:26 p.m. UTC
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

Comments

Rafael J. Wysocki March 30, 2023, 5:02 p.m. UTC | #1
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!
Armin Wolf April 6, 2023, 10:09 p.m. UTC | #2
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!