Bug 217041 - sbs module causes lockup upon suspend/shutdown
Summary: sbs module causes lockup upon suspend/shutdown
Status: RESOLVED CODE_FIX
Alias: None
Product: ACPI
Classification: Unclassified
Component: Power-Battery (show other bugs)
Hardware: Intel Linux
: P1 high
Assignee: acpi_power-battery
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-02-15 07:49 UTC by Armin Wolf
Modified: 2023-02-25 08:09 UTC (History)
0 users

See Also:
Kernel Version: 6.1.12
Subsystem:
Regression: No
Bisected commit-id:


Attachments
dmesg when suspending with sbs being unloaded (56.02 KB, text/plain)
2023-02-15 07:49 UTC, Armin Wolf
Details
dmesg when suspending with pm_test set to "devices" and the sbs module being loaded (54.89 KB, text/plain)
2023-02-15 07:51 UTC, Armin Wolf
Details
kernel oops when unloading the sbs module (55.51 KB, text/plain)
2023-02-15 07:52 UTC, Armin Wolf
Details
Patch 1 (3.45 KB, patch)
2023-02-18 13:17 UTC, Armin Wolf
Details | Diff
Patch 2 (3.98 KB, patch)
2023-02-18 13:17 UTC, Armin Wolf
Details | Diff
Patch3 (5.05 KB, patch)
2023-02-18 13:17 UTC, Armin Wolf
Details | Diff

Description Armin Wolf 2023-02-15 07:49:01 UTC
Created attachment 303730 [details]
dmesg when suspending with sbs being unloaded

On my Acer Travelmate 4002 WLMI, the sbs (Smart Battery Subsystem) module is causing the kernel to lockup when suspending or shutting down.
The  system then becomes unresponsive and requires a power cycle to reboot.
This does not happen when the sbs module is unloaded prior to suspend/shutdown,
however using "modprobe -r sbs" causes a kernel oops. So both the sbs and the sbshc modules need to be unloaded manually using "rmmod <module>".
If the kernel oops occured, the system also fails to suspend/shutdown.
This issue is also present when using a 5.10 series kernel, and likely also when using a 4.19 series kernel.
Comment 1 Armin Wolf 2023-02-15 07:51:34 UTC
Created attachment 303731 [details]
dmesg when suspending with pm_test set to "devices" and the sbs module being loaded

When testing suspend with pm_test set to "devices" and the sbs module being loaded, the machine still resumes, but the video (ATI Mobility Radeon 9700) does not work anymore.
Comment 2 Armin Wolf 2023-02-15 07:52:33 UTC
Created attachment 303732 [details]
kernel oops when unloading the sbs module

Only happens when "modprobe -r sbs" is used, not with "rmmod sbs".
Comment 3 Armin Wolf 2023-02-18 13:17:14 UTC
Created attachment 303746 [details]
Patch 1
Comment 4 Armin Wolf 2023-02-18 13:17:30 UTC
Created attachment 303747 [details]
Patch 2
Comment 5 Armin Wolf 2023-02-18 13:17:43 UTC
Created attachment 303748 [details]
Patch3
Comment 6 Armin Wolf 2023-02-18 13:20:47 UTC
I managed to fix the stacktrace upon module unload. The callback function pointer was still used inside a workqueue, which then called the callback function when the module was already unloaded.

Regarding the lockup on suspend/shutdown:
It seems that the problem does not occur if i clear the SMBus alert flag before executing the callback function, so i suppose the issue lies inside the sbs alert callback.
Comment 7 Armin Wolf 2023-02-25 08:09:27 UTC
I finally found the culprit, the patch series can be found here:
https://lore.kernel.org/linux-acpi/20230225080458.1342359-1-W_Armin@gmx.de/T/#t

Note You need to log in before you can comment on or make changes to this bug.