Bug 1223194

Summary: Empty battery reported after suspend
Product: [openSUSE] openSUSE Tumbleweed Reporter: Axel Braun <axel.braun>
Component: KernelAssignee: openSUSE Kernel Bugs <kernel-bugs>
Status: NEW --- QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None CC: axel.braun, tiwai
Version: Current   
Target Milestone: ---   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: hwinfo
output of upower
upower after suspend

Description Axel Braun 2024-04-22 08:47:10 UTC
Following up on https://lists.opensuse.org/archives/list/support@lists.opensuse.org/thread/HVP7T67KN63XXBOGMQ7QLOKNM2CJZ5OQ/

In between I have the impression that the battery status after a suspend is reported wrong from the system (so no drain ,as originally assumed).

I had the laptop suspend and at the charger over night, in the morning it reported 8% charge left. Which is definitely wrong. Other than 'in earlier times' it does not get updated to the correct status. This is quite annoying as the laptop is my primary workhorse

Let me know how I can debug/provide information on this. 

Thank you!

Operating System: openSUSE Tumbleweed 20240418
KDE Plasma Version: 6.0.4
KDE Frameworks Version: 6.1.0
Qt Version: 6.7.0
Kernel Version: 6.8.6-1-default (64-bit)
Graphics Platform: X11
Processors: 12 × Intel® Core™ i7-9750H CPU @ 2.60GHz
Memory: 15.4 GiB of RAM
Graphics Processor: Mesa Intel® UHD Graphics 630
Manufacturer: LENOVO
Product Name: 20QWS0A8GE
System Version: ThinkPad X1 Extreme 2nd
Comment 1 Takashi Iwai 2024-05-23 14:09:40 UTC
Could you give hwinfo output?
Comment 2 Axel Braun 2024-05-23 18:10:46 UTC
Created attachment 875060 [details]
hwinfo
Comment 3 Takashi Iwai 2024-05-24 15:33:28 UTC
Thanks.  And what shows "upower -d" output before and after suspend/resume?
Does it indicate the same problem, right?
Comment 4 Axel Braun 2024-05-25 06:18:34 UTC
Created attachment 875098 [details]
output of upower

upower before suspend
Comment 5 Axel Braun 2024-05-25 06:19:26 UTC
Created attachment 875099 [details]
upower after suspend

Note that Laptop was attached to power all the time
Comment 6 Takashi Iwai 2024-05-25 07:29:45 UTC
So it seems that BAT0 reports a wrong value from the beginning even before the suspend.  And it's a generic ACPI battery stuff, the most suspected is a BIOS firmware bug.  But you can try to report to the upstream, e.g. bugzilla.kernel.org.

Also, it might be worth to check whether it's a kernel regression.  You can try older kernels in my OBS repos, e.g. home:tiwai:kernel:6.6 for 6.6.x kernel
  http://download.opensuse.org/repositories/home:/tiwai:/kernel:/6.6/standard/

Graphics or something else might be not working, but if it boots up, you can try the upower stuff to check the values without GUI, too.
Comment 7 Axel Braun 2024-05-30 08:49:37 UTC
Hello Takashi

(In reply to Takashi Iwai from comment #6)
> So it seems that BAT0 reports a wrong value from the beginning even before
> the suspend.  And it's a generic ACPI battery stuff, the most suspected is a
> BIOS firmware bug. 

Well, the BIOS did not change.....

> But you can try to report to the upstream, e.g. bugzilla.kernel.org.

Done:
https://bugzilla.kernel.org/show_bug.cgi?id=218915

> Also, it might be worth to check whether it's a kernel regression.  You can
> try older kernels in my OBS repos, e.g. home:tiwai:kernel:6.6 for 6.6.x
> kernel

Currently running your 6.6.11 kernel and did not see the behaviour so far.
Comment 8 Takashi Iwai 2024-05-30 10:09:53 UTC
(In reply to Axel Braun from comment #7)
> > Also, it might be worth to check whether it's a kernel regression.  You can
> > try older kernels in my OBS repos, e.g. home:tiwai:kernel:6.6 for 6.6.x
> > kernel
> 
> Currently running your 6.6.11 kernel and did not see the behaviour so far.

Interesting.  Try 6.7.x and 6.8.x to narrow down the regression range, if it's indeed a regression.  It'll help for identifying the cause.
Comment 9 Axel Braun 2024-06-03 08:27:24 UTC
The issue was introduced with kernel 6.8, see 
https://bugzilla.kernel.org/show_bug.cgi?id=218881
Comment 10 Takashi Iwai 2024-06-13 12:53:41 UTC
The regression handling thread on ML:
  https://lore.kernel.org/all/435867b5-029b-419f-bb7f-2d4902c62556@leemhuis.info/

I'm building a test kernel with Rafael's test fix patch in OBS home:tiwai:bsc1223194 repo.  Please give it a try later.
Comment 11 Axel Braun 2024-06-14 10:08:39 UTC
(In reply to Takashi Iwai from comment #10)
> The regression handling thread on ML:
>  
> https://lore.kernel.org/all/435867b5-029b-419f-bb7f-2d4902c62556@leemhuis.
> info/
> 
> I'm building a test kernel with Rafael's test fix patch in OBS
> home:tiwai:bsc1223194 repo.  Please give it a try later.

There is a conflict, as nothing provides 'kernel-devel = 6.9.4-2.g2d30ad1' bereit, needed by kernel-default-devel-6.9.4-2.1.g2d30ad1.x86_64 

I guess it will break the nvidia drivers, but I give it a try
Comment 12 Takashi Iwai 2024-06-14 12:41:30 UTC
Ah I didn't know that you're using Nvidia driver, so I build only kernel-default.  Now I triggered the rebuilds of all packages in the same repo.
Please check it again later.
Comment 13 Axel Braun 2024-06-15 17:43:26 UTC
I used your kernel in a couple of suspend cycles, with and without AC charger, the issue is gone! Thank you!
Comment 14 Takashi Iwai 2024-06-15 19:26:14 UTC
Good to hear.  Rafael submitted the fix patch, and I'll backport it to TW kernel:
  https://lore.kernel.org/r/3317718.44csPzL39Z@kreacher