Bug 11930

Summary: 2.6.27 regression - Battery not detected when EC switches to poll mode
Product: ACPI Reporter: churchmice (firefoxelectric)
Component: ECAssignee: ykzhao (yakui.zhao)
Status: CLOSED PATCH_ALREADY_AVAILABLE    
Severity: normal CC: acpi-bugzilla, firefoxelectric
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.27-r2 Subsystem:
Regression: Yes Bisected commit-id:
Attachments: acpi dump
dmesg of 2.6.27-r2
dmesg of tuxonice-2.6.25-r7
ec.c from tuxonice-2.6.25-r7
ec.c from gentoo-sources-2.6.27-r2
output of lspci -vv
dmesg of 2.6.27-r2 with ec.c borrowed from tuxonice-2.6.25.-r7
dmesg of patched ec.c
dmesg from the ec.c patch provided by Alexey Starikovskiy

Description churchmice 2008-11-01 02:27:52 UTC
Latest working kernel version: < 2.6.26 
Earliest failing kernel version: 2.6.26
Distribution: Gentoo 
Hardware Environment: Benq S41 notebook with Core2Duo T7100 and Nvidia GM 8600  
Software Environment: Gentoo ~X86 
Problem Description: 
After upgrade to gentoo-sources-2.6.27-r2, which corresponds to vanilla kernel 2.6.27.4, my battery can no longer be detected.
There do exists a /proc/acpi/battery/BAT1 entry, but  when I issue the command 
"cat info", it says no, so does the "cat state" command. Obviously, my battery is not detected by the new kernel.
I remember it is working correctly with tuxonice-sources-2.6.25-r7 which corresponding to vanilla kernel 2.6.25.11.
Thanks to dmesg, i could see the difference between the two kernels, and found that :
1. in tuxonice-2.6.25-r7, it says 
[quote]
ACPI: EC: Look up EC in DSDT
ACPI: BIOS _OSI(Linux) query ignored via DMI
ACPI: Interpreter enabled
ACPI: (supports S0 S3 S4 S5)
ACPI: Using IOAPIC for interrupt routing
ACPI: EC: GPE = 0x17, I/O: command/status = 0x66, data = 0x62
ACPI: EC: driver started in poll mode
....
ACPI: EC: non-query interrupt received, switching to interrupt mode
[/quote]
2. in 2.6.27-r2, it says
[quote]
ACPI: Using IOAPIC for interrupt routing
ACPI: EC: GPE storm detected, disabling EC GPE
ACPI: EC: GPE = 0x17, I/O: command/status = 0x66, data = 0x62
ACPI: EC: driver started in poll mode
[/quote]

Comparing the two, I suspect the problems lies that the new kernel makes my computer started in poll mode while the old kernel makes my computer started in interrupt mode, and my computer works in interrupt mode.
So I make an experiment: i copyed  acpi/drivers/ec.c from tuxoince-sources-2.6.25-r7 and replace the same file in 2.6.27-r2, recompiled the kernel and boot, this time using 2.6.27-r2 kernel with ec.c borrowed from 2.6.25-r7, my battery is back.
So i am wondering if you could patch the ec.c in 2.6.27-r2 a little so that it could work with my computer. Thank you very much.
Below is a list of related debug information.

Steps to reproduce:
Comment 1 churchmice 2008-11-01 02:30:23 UTC
Created attachment 18565 [details]
acpi dump
Comment 2 churchmice 2008-11-01 02:31:13 UTC
Created attachment 18566 [details]
dmesg of 2.6.27-r2
Comment 3 churchmice 2008-11-01 02:32:04 UTC
Created attachment 18567 [details]
dmesg of tuxonice-2.6.25-r7
Comment 4 churchmice 2008-11-01 02:32:43 UTC
Created attachment 18568 [details]
ec.c from tuxonice-2.6.25-r7
Comment 5 churchmice 2008-11-01 02:33:24 UTC
Created attachment 18569 [details]
ec.c from gentoo-sources-2.6.27-r2
Comment 6 churchmice 2008-11-01 02:36:45 UTC
Created attachment 18570 [details]
output of lspci -vv
Comment 7 churchmice 2008-11-01 02:38:25 UTC
Created attachment 18571 [details]
dmesg of 2.6.27-r2  with ec.c borrowed from tuxonice-2.6.25.-r7
Comment 8 ykzhao 2008-11-02 17:31:17 UTC
Hi, Churchmice
    On your laptops there exists the following warning message:
    >ACPI: EC: GPE storm detected, disabling EC GPE
    Will you please try the latest kernel(2.6.28-rc2) and see whether the problem still exists?
    Thanks.
Comment 9 churchmice 2008-11-03 02:12:43 UTC
(In reply to comment #8)
> Hi, Churchmice
>     On your laptops there exists the following warning message:
>     >ACPI: EC: GPE storm detected, disabling EC GPE
>     Will you please try the latest kernel(2.6.28-rc2) and see whether the
> problem still exists?
>     Thanks.
> 
vanilla 2.6.28-rc2 fixed this problem.
Thank you for your work.
Comment 10 ykzhao 2008-11-03 06:39:14 UTC
Thanks for the test. 
Will you please try the patch set in http://bugzilla.kernel.org/show_bug.cgi?id=11930#C1,2,3,4 and see whether the problem still exists?
    As there is another problem about EC driver on the 2.6.28-rc2 kernel, it will be great if you can try the patch set.
   Thanks.
Comment 11 churchmice 2008-11-03 07:02:41 UTC
(In reply to comment #10)
> Thanks for the test. 
> Will you please try the patch set in
> http://bugzilla.kernel.org/show_bug.cgi?id=11930#C1,2,3,4 and see whether the
> problem still exists?
>     As there is another problem about EC driver on the 2.6.28-rc2 kernel, it
> will be great if you can try the patch set.
>    Thanks.
> 
There is some problem with the link you provided above.
I can not find the patch, will you please double check the link?
I am patch the 2.6.27-4 kernel with the ec.c from 2.6.28-rc2, and that works great.
PS: From the name i can tell you are chinese, so do I.
Comment 12 ykzhao 2008-11-03 08:03:16 UTC
It is my fault. And I am sorry that I give the incorrect address in comment #10.
   The patch set is in 
   http://bugzilla.kernel.org/show_bug.cgi?id=11896#C1,2,3,4
   Thanks.

 
Comment 13 churchmice 2008-11-03 08:29:32 UTC
(In reply to comment #12)
> It is my fault. And I am sorry that I give the incorrect address in comment
> #10.
>    The patch set is in 
>    http://bugzilla.kernel.org/show_bug.cgi?id=11896#C1,2,3,4
>    Thanks.
> 
> 
> 
I applied the four patches you created one by one, recompiled the kernel ( still using 2.6.27-r2, only ec.c is patched). After reboot, it keeps popping noisy information "
DB->get: method not permitted before handle's open method

The battery is detected correctly, only with so much annoying messages.
Below is my dmesg.
Comment 14 churchmice 2008-11-03 08:30:31 UTC
Created attachment 18636 [details]
dmesg of patched ec.c
Comment 15 churchmice 2008-11-03 08:43:48 UTC
(In reply to comment #12)
> It is my fault. And I am sorry that I give the incorrect address in comment
> #10.
>    The patch set is in 
>    http://bugzilla.kernel.org/show_bug.cgi?id=11896#C1,2,3,4
>    Thanks.
> 
> 
> 
sorry, the 
"DB->get:method not permitted before handle's open method" is another bug which is not regarded for this bug report.
I tried tuxonice-sources-2.6.25-r7,and the same warning message reappears. I remember i have updated the system, so it must be brought by one of the updated package, i will figure which it is. 
As far as this bug is concerned, the patch you provided works fine with my machine. Great job.
Comment 16 churchmice 2008-11-03 09:02:04 UTC
(In reply to comment #12)
> It is my fault. And I am sorry that I give the incorrect address in comment
> #10.
>    The patch set is in 
>    http://bugzilla.kernel.org/show_bug.cgi?id=11896#C1,2,3,4
>    Thanks.
> 
> 
> 
sorry, the 
"DB->get:method not permitted before handle's open method" is another bug which is not regarded for this bug report.
I tried tuxonice-sources-2.6.25-r7,and the same warning message reappears. I remember i have updated the system, so it must be brought by one of the updated package, i will figure which it is. 
As far as this bug is concerned, the patch you provided works fine with my machine. Great job.
Comment 17 churchmice 2008-11-03 09:05:56 UTC
Confirmed. 
The "DB->get:method not permitted before handle's open method" is due to sys-libs/ncurses-5.7. After downloaded to sys-libs/ncurses-5.6-r2, the annonying messages disappeared.
In a word, the patched worked, at least on my machine.
I am now trying from Alexey Starikovskiy, hope it works also.
   	
Comment 18 churchmice 2008-11-03 09:09:35 UTC
(In reply to comment #12)
> It is my fault. And I am sorry that I give the incorrect address in comment
> #10.
>    The patch set is in 
>    http://bugzilla.kernel.org/show_bug.cgi?id=11896#C1,2,3,4
>    Thanks.
> 
> 
> 

The patch from Alexey Starikovskiy  works too, but with some extra delay ( approximately 5s),and some annoyning messages. See the output of dmesg for detailed illustration.
What shall I do next ?
Comment 19 churchmice 2008-11-03 09:10:14 UTC
Created attachment 18638 [details]
dmesg from the ec.c patch provided by Alexey Starikovskiy
Comment 20 Len Brown 2008-11-03 19:18:10 UTC
per comment #9
> vanilla 2.6.28-rc2 fixed this problem.
> Thank you for your work.

this bug report is closed.

re: tests for patches in bug 11986,
please comment in bug 11986

> ACPI: EC: non-query interrupt received, switching to interrupt mode
> __ratelimit: 40 callbacks suppressed

this is not good and should be pointed out in that bug report.