Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 248452

Summary: [2.6.27.5 regression] ACPI battery power management broken
Product: Gentoo Linux Reporter: Leonid Podolny <leonidp.lists>
Component: [OLD] UnspecifiedAssignee: Gentoo Kernel Bug Wranglers and Kernel Maintainers <kernel>
Status: RESOLVED OBSOLETE    
Severity: normal CC: pacho
Priority: High    
Version: 2008.0   
Hardware: All   
OS: Linux   
URL: http://bugzilla.kernel.org/show_bug.cgi?id=12187
Whiteboard: linux-2.6.27.5-regression
Package list:
Runtime testing required: ---
Attachments: dmesg from -r1 (i.e. working)
dmesg from -r4 (i.e. non-working)
dmesg right after boot
dmesg right after battery dissapeared
Don't do transaction from GPE handler in poll mode.
possible

Description Leonid Podolny 2008-11-23 18:44:36 UTC
Some time (10-20 minutes on average) after booting the laptop the system stops seeing the battery and ac_adapter info in /proc/acpi/{battery,ac_adapter}. This is a regression -- in gentoo-sources-2.6.27-r1 everything worked great.

For example, with fully charged battery and power chord connected:
looptop ~ # cat /proc/acpi/battery/BAT1/state
present:                 no
looptop ~ # cat /proc/acpi/ac_adapter/ADP1/state
state:                   off-line

I had this problem some time ago and even complained upstream:
http://www.spinics.net/lists/linux-acpi/msg14208.html
http://bugzilla.kernel.org/show_bug.cgi?id=10855.
However, when I upgraded the kernel to (vanilla) 2.6.26-rc6, the problem misteriously went away.
I'm attaching the dmesg logs from (working) 2.6.27-rc1 and (non-working) 2.6.27-rc4.
Comment 1 Leonid Podolny 2008-11-23 18:45:49 UTC
Created attachment 173056 [details]
dmesg from -r1 (i.e. working)
Comment 2 Leonid Podolny 2008-11-23 18:46:12 UTC
Created attachment 173057 [details]
dmesg from -r4 (i.e. non-working)
Comment 3 Leonid Podolny 2008-11-23 18:49:28 UTC
Following is a diff chunk from the attached dmesg outputs that seems to mess the things up.

@@ -152,13 +153,11 @@
 PCI: MCFG area at e0000000 reserved in ACPI motherboard resources
 PCI: Using MMCONFIG at e0000000 - efffffff
 ACPI: EC: non-query interrupt received, switching to interrupt mode
-ACPI: EC: GPE storm detected, disabling EC GPE
-ACPI: EC: missing confirmations, switch off interrupt mode.
 ACPI: EC: GPE = 0x17, I/O: command/status = 0x66, data = 0x62
-ACPI: EC: driver started in poll mode
+ACPI: EC: driver started in interrupt mode
 ACPI: PCI Root Bridge [PCI0] (0000:00)
 PCI: 0000:00:02.0 reg 10 64bit mmio: [fda00000, fdafffff]
-PCI: 0000:00:02.0 reg 18 32bit mmio: [d0000000, dfffffff]
+PCI: 0000:00:02.0 reg 18 64bit mmio: [d0000000, dfffffff]
 PCI: 0000:00:02.0 reg 20 io port: [b480, b487]
 PCI: 0000:00:02.1 reg 10 64bit mmio: [fdb00000, fdbfffff]
 PCI: 0000:00:1a.0 reg 20 io port: [b800, b81f]
Comment 4 Leonid Podolny 2008-11-25 14:32:24 UTC
The exact patch that causes the ACPI to start in interrupt mode is 1004_linux-2.6.27.5.patch. 
Comment 5 Leonid Podolny 2008-11-26 12:57:45 UTC
Updated to git-sources-2.6.28_rc5-r4. ACPI starts in interrupt mode, but the battery seems fine. So basically, if we are not interested in solving this bug, we can just wait for the problem to go away when 2.6.28 is out.
Comment 6 Daniel Drake (RETIRED) gentoo-dev 2008-11-27 09:49:54 UTC
Similar to http://bugzilla.kernel.org/show_bug.cgi?id=12004 (which was supposedly fixed in 2.6.27.7)

Is the attachment in comment #2 from before or after the battery problem appeared during that session? (you said it takes 10-20 minutes)

In 2.6.27-r4, can you edit drivers/acpi/ec.c
change this line:
/* #define DEBUG */
to:
#define DEBUG

and enable CONFIG_PRINTK_TIME in your config, recompile/reboot, and attach dmesg output from after the error occurs

Also, please attach dmesg from 2.6.28
Comment 7 Leonid Podolny 2008-11-28 16:55:28 UTC
(In reply to comment #6)
> Similar to http://bugzilla.kernel.org/show_bug.cgi?id=12004 (which was
> supposedly fixed in 2.6.27.7)
> 
> Is the attachment in comment #2 from before or after the battery problem
> appeared during that session? (you said it takes 10-20 minutes)
> 
It is from before the problem appears. When the problem occurs, nothing new is added to dmesg.

> In 2.6.27-r4, can you edit drivers/acpi/ec.c
> change this line:
> /* #define DEBUG */
> to:
> #define DEBUG
> 
> and enable CONFIG_PRINTK_TIME in your config, recompile/reboot, and attach
> dmesg output from after the error occurs
> 
I will report back.

> Also, please attach dmesg from 2.6.28
> 
In 2.6.28 the problem also occurs, but much less frequently.
Comment 8 Daniel Drake (RETIRED) gentoo-dev 2008-11-28 17:10:22 UTC
OK, in that case it would be best to see the dmesg from 2.6.28-rcX rather than 2.6.27.
Comment 9 Daniel Drake (RETIRED) gentoo-dev 2008-11-28 17:11:02 UTC
to clarify: I mean dmesg while DEBUG is turned on, and both immediately after boot, *and* after the bug has appeared
Comment 10 Leonid Podolny 2008-11-28 18:25:01 UTC
Created attachment 173675 [details]
dmesg right after boot
Comment 11 Leonid Podolny 2008-11-28 18:25:37 UTC
Created attachment 173676 [details]
dmesg right after battery dissapeared
Comment 12 Sergey Ovcharenko 2008-11-28 20:57:06 UTC
Created attachment 173702 [details, diff]
Don't do transaction from GPE handler in poll mode. 

Please try this patch and tell us if it fixed the problem.
Comment 13 Leonid Podolny 2008-11-28 22:27:14 UTC
(In reply to comment #12)
> Created an attachment (id=173702) [edit]
> Don't do transaction from GPE handler in poll mode. 
> 
> Please try this patch and tell us if it fixed the problem.
> 

Sergey,
Do you mean, to revert this patch? Because my ec.c already has it applied, both in gentoo-sources-2.6.27-r4 and git-sources-2.6.28_rc5-r4.
Comment 14 Nick Loeve 2008-12-02 18:39:35 UTC
There is an upstream bug that looks very similar to your issue: http://bugzilla.kernel.org/show_bug.cgi?id=11892

There is a patch in the acpi tree: http://git.kernel.org/?p=linux/kernel/git/lenb/linux-acpi-2.6.git;a=commit;h=06cf7d3c7af902939cd1754abcafb2464060cba8 that supposedly fixes that issue, and is already included in 2.6.27-gentoo-r4 

There is one other fix queued in the ACPI tree that fixes a regression introduced with the patch Sergey mentions: http://git.kernel.org/?p=linux/kernel/git/lenb/linux-acpi-2.6.git;a=commit;h=7b4d469228a92a00e412675817cedd60133de38a

If you feel inclined it would be good to test with that patch.
Comment 15 Daniel Drake (RETIRED) gentoo-dev 2008-12-03 13:24:54 UTC
Created attachment 174161 [details, diff]
possible

Yes, please ignore the previous patch (you're right - it is already included) and apply this one to 2.6.27-r4. Does it help?
Comment 16 Daniel Drake (RETIRED) gentoo-dev 2008-12-06 10:31:43 UTC
Instead of the above patch, please just upgrade to gentoo-sources-2.6.27-r5
Comment 17 Leonid Podolny 2008-12-06 15:27:59 UTC
(In reply to comment #16)
> Instead of the above patch, please just upgrade to gentoo-sources-2.6.27-r5
> 

Daniel,
I just synced, and -r5 is not in the tree yet. Instead, I downloaded genpatches-2.6.27-7 from the genpatches home page, and applied them. The issue is still here.
Comment 18 Daniel Drake (RETIRED) gentoo-dev 2008-12-06 15:50:50 UTC
Alright, please file this bug upstream at http://bugzilla.kernel.org and post the new bug URL here when done.

Please be sure to make clear:
 - this is a regression introduced in 2.6.27.5 (2.6.27.4 worked OK)
 - it also exists in 2.6.28, but is harder to reproduce
 - please also duplicate comments #1, #2 and #3 on the upstream bug (working dmesg, non-working dmesg, and the differences you highlight)

Thanks!
Comment 19 Leonid Podolny 2008-12-09 22:21:14 UTC
(In reply to comment #18)
> Alright, please file this bug upstream at http://bugzilla.kernel.org and post
> the new bug URL here when done.
http://bugzilla.kernel.org/show_bug.cgi?id=12187

> 
> Please be sure to make clear:
>  - this is a regression introduced in 2.6.27.5 (2.6.27.4 worked OK)
>  - it also exists in 2.6.28, but is harder to reproduce
>  - please also duplicate comments #1, #2 and #3 on the upstream bug (working
> dmesg, non-working dmesg, and the differences you highlight)

The differences are not important, because in 2.6.28-rc5 with DEBUG uncommented, the driver starts in poll mode, and the problem still happens. 
See http://bugzilla.kernel.org/show_bug.cgi?id=12187#c3