Bug 2121844 - Battery percentage gets stuck at a certain level (asus_ec_sensors locks ACPI mutex)
Summary: Battery percentage gets stuck at a certain level (asus_ec_sensors locks ACPI ...
Alias: None
Product: Fedora
Classification: Fedora
Component: kernel
Version: 36
Hardware: x86_64
OS: Linux
Target Milestone: ---
Assignee: Kernel Maintainer List
QA Contact: Fedora Extras Quality Assurance
Whiteboard: https://ask.fedoraproject.org/t/commo...
Depends On:
TreeView+ depends on / blocked
Reported: 2022-08-26 19:54 UTC by Burak Dede
Modified: 2022-09-17 12:55 UTC (History)
21 users (show)

Fixed In Version: kernel-5.19.9-200.fc36
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2022-09-17 12:34:10 UTC
Type: Bug

Attachments (Terms of Use)
Kernel dmesg (104.94 KB, text/plain)
2022-08-26 19:54 UTC, Burak Dede
no flags Details
Kernel logs of user while experiencing this issue (84.79 KB, text/plain)
2022-09-03 09:18 UTC, Christopher Klooz
no flags Details

System ID Private Priority Status Summary Last Updated
Linux Kernel 216412 0 P1 ASSIGNED asus-ec-sensors causes the lid device is not compliant to SW_LID 2022-09-06 11:04:47 UTC

Description Burak Dede 2022-08-26 19:54:38 UTC
Created attachment 1907929 [details]
Kernel dmesg

1. Please describe the problem:
Battery percentage gets stuck after the boot. It never increases/decreases. I'm using ASUS TUF A15 FA506II with AMD Ryzen 5 4600H. It uses battery_BAT1. I checked battery energy values with gnome-power-manager software and it reports the same value everytime I check.

2. What is the Version-Release number of the kernel:
5.19.4-200.fc36.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Aug 25 17:42:04 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

3. Did it work previously in Fedora? If so, what kernel version did the issue
   *first* appear?  Old kernels are available for download at
   https://koji.fedoraproject.org/koji/packageinfo?packageID=8 :

It works with 5.18.19-200.fc36.x86_64

4. Can you reproduce this issue? If so, please provide the steps to reproduce
   the issue below:

0. Update kernel to 5.19.4
1. Boot the system and check the battery percentage.
2. Use the device for a while at battery power.
3. Check the battery level.
4. It stays the same.

0. Update kernel to 5.19.4
1. Boot the system and check the battery percentage.
2. Plug the device to charger
3. Charge it for a while.
4. Check the battery level.
5. It stays the same.

5. Are you running any modules that not shipped with directly Fedora's kernel?:

Nvidia properiety driver modules only.

6. Please attach the kernel logs. You can get the complete kernel log
   for a boot with ``journalctl --no-hostname -k > dmesg.txt``. If the
   issue occurred on a previous boot, use the journalctl ``-b`` flag.

Comment 1 Burak Dede 2022-08-28 15:16:29 UTC
I have tried Rawhide kernel (6.0.0-0.rc2.20220826git4c612826bec1.22.fc38) and it didn't work either.

Comment 2 Burak Dede 2022-08-29 10:00:22 UTC
Restarting upower service and reinstalling upower didn't help.

Comment 3 Burak Dede 2022-08-30 13:00:33 UTC
Seems like the issue caused after this commit in upstream: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?h=v6.0-rc3&id=de8fbac5e59e239b00cdac611784b1bc1ff53d14

Blacklisting asus_ec_sensors module helps with the issue. 

I also think the discussion here can help you finding the root cause: https://bbs.archlinux.org/viewtopic.php?id=278933&p=4

Comment 4 Christopher Klooz 2022-09-03 09:18:35 UTC
Created attachment 1909318 [details]
Kernel logs of user while experiencing this issue

Comment 5 Christopher Klooz 2022-09-03 09:25:50 UTC
At ask.fedoraproject.org, we have currently at least three cases of the issue, although the symptoms are not equal to Burak.

One user has a kernel that is NOT tainted (his `cat /proc/sys/kernel/tainted` = 0) and he provided his kernel logs. I have attached the output of his `journalctl --no-hostname -k > dmesg.txt` he retrieved while experiencing the issue as "Kernel logs of user while experiencing this issue".

The user has a erratic battery power percentage and suspend does only work when doing it manually, but not when closing the lid.

Blacklisting asus_ec_sensors solves the issues at his machine.

The related topic is https://ask.fedoraproject.org/t/battery-indicator-not-working-properly/25946

Comment 6 Hans de Goede 2022-09-03 10:44:15 UTC
Good work on figuring out that this is caused by asus_ec_sensors !

Has anyone already reported this to the asus_ec_sensors maintainers?

Quoting from the kernel's MAINTAINERS file:

M:      Eugene Shalygin <eugene.shalygin>
M:      Denis Pauk <pauk.denis>
L:      linux-hwmon.org
S:      Maintained
F:      drivers/hwmon/asus_wmi_ec_sensors.c

Comment 7 Hans de Goede 2022-09-03 10:47:29 UTC
Ugh, wrong driver, sorry. Here is the MAINTAINERS entry for the right one:

M:      Eugene Shalygin <eugene.shalygin>
L:      linux-hwmon.org
S:      Maintained
F:      drivers/hwmon/asus-ec-sensors.c

Please report this to: Eugene Shalygin <eugene.shalygin>, with linux-hwmon.org and regressions.dev in the Cc.

Comment 8 Christopher Klooz 2022-09-03 11:01:21 UTC
I reported it.

Comment 9 Christopher Klooz 2022-09-03 12:07:26 UTC

Comment 10 Christopher Klooz 2022-09-03 12:10:22 UTC
Eugene suggested to try the second patch of https://bugzilla.kernel.org/show_bug.cgi?id=216412 on affected systems to see if it fixes this bug as well.

Comment 11 Christopher Klooz 2022-09-03 12:36:52 UTC
I don't know if one of the users is willing to test this on their systems (I forwarded the request to the users, see the ask.fedora topic I mentioned above). However, it might be observed if the issue disappears when the patch ends up in the kernel, just in case we cannot test the patch directly.

Comment 12 Artem Silenkov 2022-09-05 09:47:55 UTC
Same hardware\software versions.
Blacklisting asus-ec-sensors fixes the issue.

Comment 14 Burak Dede 2022-09-17 12:05:55 UTC
Kernel 5.19.9 seems to fix the issue. Currently testing it. Thanks for your interest.

The fixing commit: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-5.19.y&id=7d40396e6d7374e1c8bfb9dd3a1146f69375b96b

I don't know if I should close this bug or it needs other confirmation. Leaving it open for now.

Comment 15 Hans de Goede 2022-09-17 12:34:10 UTC
Thank you for reporting that this has been fixed.

I don't believe it is very useful to keep this bug open, so lets close this.

Comment 16 Christopher Klooz 2022-09-17 12:46:58 UTC
I update the workaround in common issues once the kernel is pushed to stable.

Comment 17 Hans de Goede 2022-09-17 12:55:11 UTC
(In reply to Christopher Klooz from comment #16)
> I update the workaround in common issues once the kernel is pushed to stable.

Great, thank you!

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