Bug 8709

Summary: regression: EmbeddedControl AE_TIME errors, /proc/acpi/battery/* not present
Product: ACPI Reporter: Piotr Keplicz (keplicz)
Component: ECAssignee: Alexey Starikovskiy (astarikovskiy)
Status: CLOSED CODE_FIX    
Severity: normal CC: acpi-bugzilla, kas, oryn, possebaer, vladimir.p.lebedev
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.22-rc7 Subsystem:
Regression: Yes Bisected commit-id:
Attachments: Full dmesg
output of acpidump
Add debugging printouts to EC init
dmesg with debugging printouts
Switch from boot_ec
dmesg with patch 12061
Re-install region handler
output of dmesg
One more attempt to fix all ASUS at once
output of dmesg with 12493
patch to make all ASUS happy number 3
dmesg with 12518
patch in 2.6.23-rc3-git9
patch number 4
dmesg with 12640
patch #5
patch #5a

Description Piotr Keplicz 2007-07-03 01:39:23 UTC
Most recent kernel where this bug did not occur:
Battery and other ACPI-related features used to work in 2.6.20

Distribution: Ubuntu (7.04 with 2.6.20 - works, alpha 7.10 with 2.6.22-rc - does not work)

Hardware Environment:
ASUS M6r

Problem Description:
2.6.22-rc kernels are unable to check battery status. 
The following errors show up in dmesg at boot:

ACPI: EC: acpi_ec_wait timeout, status = 255, expect_event = 2
ACPI: EC: input buffer is not empty, aborting transaction
ACPI Exception (evregion-0420): AE_TIME, Returned by Handler for [EmbeddedControl] [20070126]
ACPI Error (psparse-0537): Method parse/execution failed [\_SB_.PCI0.SBRG.EC0_.RDC3] (Node ddf07f04), AE_TIME
ACPI Error (psparse-0537): Method parse/execution failed [\ECIO] (Node ddf0975c), AE_TIME
ACPI Error (psparse-0537): Method parse/execution failed [\_SB_.PCI0.SBRG.EC0_.ACPS] (Node ddf07f68), AE_TIME
ACPI Error (psparse-0537): Method parse/execution failed [\ACPS] (Node ddf04c70), AE_TIME
ACPI Error (psparse-0537): Method parse/execution failed [\_SB_.PCI0.AC0_._PSR] (Node ddf07b80), AE_TIME
ACPI Exception (ac-0095): AE_TIME, Error reading AC Adapter state [20070126]
ACPI: EC: acpi_ec_wait timeout, status = 255, expect_event = 2
ACPI: EC: input buffer is not empty, aborting transaction
ACPI Exception (evregion-0420): AE_TIME, Returned by Handler for [EmbeddedControl] [20070126]
ACPI Exception (dswexec-0462): AE_TIME, While resolving operands for [OpcodeName unavailable] [20070126]
ACPI Error (psparse-0537): Method parse/execution failed [\_SB_.PCI0.SBRG.EC0_.SMBR] (Node ddf07d24), AE_TIME
ACPI Error (psparse-0537): Method parse/execution failed [\_SB_.PCI0.SBRG.EC0_.BIF0] (Node ddf07900), AE_TIME
ACPI Error (psparse-0537): Method parse/execution failed [\_SB_.PCI0.BAT0._BIF] (Node ddf07a2c), AE_TIME
ACPI Exception (battery-0147): AE_TIME, Evaluating _BIF [20070126]

This laptop experienced EC problems before (described in bug 4150 and bug 6111).
Comment 1 Piotr Keplicz 2007-07-03 01:40:02 UTC
Created attachment 11933 [details]
Full dmesg
Comment 2 Piotr Keplicz 2007-07-03 01:45:51 UTC
I discovered these problems when using Ubuntu's kernel, confirmed on latest vanilla 2.6.22-rc7.
Comment 3 Len Brown 2007-07-11 19:15:27 UTC
you mentioned that 2.6.20 worked properly, 
and that 2.6.22-rc7 is not working properly.
Can you check 2.6.21, or possibly bisect where the
issue started?
Comment 4 Len Brown 2007-07-11 19:15:50 UTC
also, please attach the output from acpidump
Comment 5 Alexey Starikovskiy 2007-07-11 20:53:16 UTC

*** This bug has been marked as a duplicate of bug 8598 ***
Comment 6 Piotr Keplicz 2007-07-13 09:19:53 UTC
Alexey, I don't think it's a duplicate of bug 8598. ECDT is found anyway, regardless of that patch being applied or not.

Len, 2.6.21.6 works fine. I'm about to "git bisect" now to find out more.
Comment 7 Piotr Keplicz 2007-07-13 09:33:10 UTC
Created attachment 12026 [details]
output of acpidump
Comment 8 Piotr Keplicz 2007-07-13 23:33:48 UTC
c0900c3512dc8fd0b37f8fbcebc7853ed9efff10 is first bad commit
commit c0900c3512dc8fd0b37f8fbcebc7853ed9efff10
Author: Alexey Starikovskiy <alexey.y.starikovskiy@intel.com>
Date:   Wed Mar 7 22:28:00 2007 +0300

    ACPI: EC: Clean ECDT and namespace parsing.

    Signed-off-by: Alexey Starikovskiy <alexey.y.starikovskiy@intel.com>
    Signed-off-by: Len Brown <len.brown@intel.com>

:040000 040000 6d47104a615f339049f2f9f6850716695cfa8a45 95606cf0a459c9ce18debc1c18e435c7d3202af0 M      drivers
Comment 9 Alexey Starikovskiy 2007-07-16 01:09:43 UTC
Created attachment 12048 [details]
Add debugging printouts to EC init

Could you please attach dmesg from a kernel with this patch applied?
Comment 10 Piotr Keplicz 2007-07-16 02:41:16 UTC
Created attachment 12050 [details]
dmesg with debugging printouts
Comment 11 Alexey Starikovskiy 2007-07-16 08:42:56 UTC
ok, this is not the same problem as 4150/6111 -- there is no error while starting EC from DSDT.
Comment 12 Alexey Starikovskiy 2007-07-17 03:21:05 UTC
Created attachment 12061 [details]
Switch from boot_ec

Please check if the attached patch helps.
Comment 13 Piotr Keplicz 2007-07-17 07:12:09 UTC
Created attachment 12065 [details]
dmesg with patch 12061

It didn't help, attached please find dmesg with this patch applied.
Comment 14 Alexey Starikovskiy 2007-07-18 02:32:09 UTC
This is strange, as this is the only functional change in the patch you've found with git bisect... Could you please check one more time that there is no problem before the c0900c... commit and there is one after it?
Comment 15 Piotr Keplicz 2007-07-18 08:57:28 UTC
I'm sorry, I must have made done something wrong.

Indeed, this patch helps! No more errors while booting, /proc/acpi/battery/BAT0/* show up again.

Thanks!
Comment 16 Alexey Starikovskiy 2007-07-18 11:56:53 UTC
Great! Thanks for report and diagnostics.
Comment 17 Len Brown 2007-07-25 23:23:24 UTC
Alexey, what shall we do with this patch?
It applies to 2.6.22, of course, but not 2.6.23.
Comment 18 Alexey Starikovskiy 2007-08-20 09:23:11 UTC
Please check that patch from 8909 does not break things again in 2.6.23-rc3.
Comment 19 Len Brown 2007-08-20 21:26:37 UTC
The good news is that the refreshed patch from comment #12
shipped in 2.6.23-rc3, so this bug is closed.

The bad news is that it caused the regression reported in bug # 8909.
Comment 20 Alexey Starikovskiy 2007-08-20 21:33:18 UTC
Please check comment #18
Comment 21 Piotr Keplicz 2007-08-21 11:22:50 UTC
I've tested up-to-date rev. 8eb891fc809b2300137bcd247025628c06c95a63, otherwise the patch from bug 8909 wouldn't apply.

Clean kernel boots and works fine indeed, no ACPI errors.

With the patch, the boot process hangs for 2 minutes doing /sbin/udevsettle. Not all of the services are able to start then, modprobe'ing ACPI-related modules is impossible. 
Comment 22 Alexey Starikovskiy 2007-08-21 11:52:15 UTC
Could you please send a dmesg from run with the patch? 
Comment 23 Alexey Starikovskiy 2007-08-21 12:22:32 UTC
Created attachment 12476 [details]
Re-install region handler

Could you please check if this patch on top of the patch from 8909 helps?
Comment 24 Piotr Keplicz 2007-08-21 13:03:07 UTC
Yes, with these two patches kernel works fine again. 
Comment 25 Alexey Starikovskiy 2007-08-21 14:39:52 UTC
Could you please test final patch from 8909?
Comment 26 Piotr Keplicz 2007-08-22 05:01:02 UTC
Created attachment 12484 [details]
output of dmesg

Sorry, my mistake again. When checking the reworked patch (not working) I realized, that earlier I missed the "install" step...

These 2 patches don't work, the boot process hangs in the same way.
Comment 27 Alexey Starikovskiy 2007-08-22 13:40:27 UTC
Created attachment 12493 [details]
One more attempt to fix all ASUS at once

Please test one more patch...
Comment 28 Piotr Keplicz 2007-08-23 03:18:02 UTC
Created attachment 12500 [details]
output of dmesg with 12493

With attachment 12493 [details] the system boots, but AE_TIME errors are back.
Comment 29 Alexey Starikovskiy 2007-08-23 21:23:38 UTC
Created attachment 12518 [details]
patch to make all ASUS happy number 3

Please test if this patch does not break your hardware.
Comment 30 Piotr Keplicz 2007-08-24 06:21:10 UTC
Created attachment 12519 [details]
dmesg with 12518

Boot process hangs at udevsettle, unable to load ACPI-related modules.
Comment 31 Alexey Starikovskiy 2007-08-24 09:35:11 UTC
but your dmesg shows EC was loaded without errors and all relevant ACPI modules (battery, thermal) loaded as well. Could it be that this kernel does not but because of some other reason?
Comment 32 Piotr Keplicz 2007-08-24 10:20:10 UTC
lsmod shows battery as loaded, even though it doesn't show up in dmesg. "modprobe battery" hangs. No entries in /proc/acpi/battery.

The system eventually boots, I can log in to a console, but X doesn't start automatically. HAL is unable to start.

Is there something more I can check?
Comment 33 Len Brown 2007-08-25 21:17:07 UTC
Created attachment 12540 [details]
patch in 2.6.23-rc3-git9

the patch in comment #12 has been reverted (attached)
from linux-2.6.23-rc3-git9 as it caused multiple regressions.
Comment 34 Thomas Schwarzgruber 2007-08-29 12:10:38 UTC
With the revert the bug described in http://bugzilla.kernel.org/show_bug.cgi?id=8598 is valid again (and a lot of doublettes of it ...) using 2.6.23-rc4.
I'm still able to apply the patch in comment 17 of 8598, with which my battery shows up again. But there is one new sideeffect of the patch: Fn+F7, Fn+F5, Fn+F6 (switch off lcd, make it brighter, make it darker) don't work now. 
I'm using a M6N from Asus.
Comment 35 Alexey Starikovskiy 2007-08-31 13:21:29 UTC
Created attachment 12640 [details]
patch number 4

Could you please try this patch on top of 2.6.23-rc4 (or later)?
Comment 36 Thomas Schwarzgruber 2007-09-01 10:40:20 UTC
I tried this one (on top of -rc4) and it works. Battery is there and Fn+Fx works again.
Thank you very much for the patch!
Comment 37 Piotr Keplicz 2007-09-01 13:55:35 UTC
Created attachment 12664 [details]
dmesg with 12640

The problems are still here, unfortunately.
Comment 38 Alexey Starikovskiy 2007-09-02 11:26:43 UTC
Created attachment 12672 [details]
patch #5

Please check if this patch works against -rc5
Comment 39 Alexey Starikovskiy 2007-09-02 12:46:45 UTC
Created attachment 12673 [details]
patch #5a

Need to keep handlers state.
Comment 40 Piotr Keplicz 2007-09-03 04:50:20 UTC
The machine works fine with 12673! Thank you very much.
Comment 41 Alexey Starikovskiy 2007-09-03 04:54:30 UTC
Thanks for your patience. Let's hope this patch will not break some other EC implementation...
Comment 42 Thomas Schwarzgruber 2007-09-03 11:49:13 UTC
It works for me too.
Comment 43 Len Brown 2007-09-05 16:54:01 UTC
patch in comment #39 added to acpi-test
Comment 44 Alex Hunsaker 2007-09-05 21:33:25 UTC
Hi Im over from http://bugzilla.kernel.org/show_bug.cgi?id=8909, patch #5a on 2.6.23-rc5 works for me
Comment 45 Jan "Yenya" Kasprzak 2007-09-30 15:46:02 UTC
I've just spent the evening bisecting the kernel sources trying to resolve ACPI errors on my ASUS m6r, just to find this bug report :-(. Git bisect got the same results as comment #8.

Patch from comment #39 (on top of 2.6.23-rc8) solved the problem for me. Please push it to the upstream kernel soon.
Comment 46 Jon Westgate 2007-10-21 02:24:51 UTC
(In reply to comment #0)
> Most recent kernel where this bug did not occur:
> Battery and other ACPI-related features used to work in 2.6.20
> 
> Distribution: Ubuntu (7.04 with 2.6.20 - works, alpha 7.10 with 2.6.22-rc -
> does not work)
> 
> Hardware Environment:
> ASUS M6r
> 
> Problem Description:
> 2.6.22-rc kernels are unable to check battery status. 
> The following errors show up in dmesg at boot:
> 
> ACPI: EC: acpi_ec_wait timeout, status = 255, expect_event = 2
> ACPI: EC: input buffer is not empty, aborting transaction
> ACPI Exception (evregion-0420): AE_TIME, Returned by Handler for
> [EmbeddedControl] [20070126]
> ACPI Error (psparse-0537): Method parse/execution failed
> [\_SB_.PCI0.SBRG.EC0_.RDC3] (Node ddf07f04), AE_TIME
> ACPI Error (psparse-0537): Method parse/execution failed [\ECIO] (Node
> ddf0975c), AE_TIME
> ACPI Error (psparse-0537): Method parse/execution failed
> [\_SB_.PCI0.SBRG.EC0_.ACPS] (Node ddf07f68), AE_TIME
> ACPI Error (psparse-0537): Method parse/execution failed [\ACPS] (Node
> ddf04c70), AE_TIME
> ACPI Error (psparse-0537): Method parse/execution failed
> [\_SB_.PCI0.AC0_._PSR]
> (Node ddf07b80), AE_TIME
> ACPI Exception (ac-0095): AE_TIME, Error reading AC Adapter state [20070126]
> ACPI: EC: acpi_ec_wait timeout, status = 255, expect_event = 2
> ACPI: EC: input buffer is not empty, aborting transaction
> ACPI Exception (evregion-0420): AE_TIME, Returned by Handler for
> [EmbeddedControl] [20070126]
> ACPI Exception (dswexec-0462): AE_TIME, While resolving operands for
> [OpcodeName unavailable] [20070126]
> ACPI Error (psparse-0537): Method parse/execution failed
> [\_SB_.PCI0.SBRG.EC0_.SMBR] (Node ddf07d24), AE_TIME
> ACPI Error (psparse-0537): Method parse/execution failed
> [\_SB_.PCI0.SBRG.EC0_.BIF0] (Node ddf07900), AE_TIME
> ACPI Error (psparse-0537): Method parse/execution failed
> [\_SB_.PCI0.BAT0._BIF]
> (Node ddf07a2c), AE_TIME
> ACPI Exception (battery-0147): AE_TIME, Evaluating _BIF [20070126]
> 
> This laptop experienced EC problems before (described in bug 4150 and bug
> 6111).
> 

(In reply to comment #45)
> I've just spent the evening bisecting the kernel sources trying to resolve
> ACPI
> errors on my ASUS m6r, just to find this bug report :-(. Git bisect got the
> same results as comment #8.
> 
> Patch from comment #39 (on top of 2.6.23-rc8) solved the problem for me.
> Please
> push it to the upstream kernel soon.
> 

I have the same problem using 2.6.23.1 on my Asus M6000.
Your patch fixed things for me too
Please can we get this pushed in the mainstream kernel soon :)
Comment 47 Len Brown 2007-10-25 13:57:13 UTC
patch based on comment #39
4c611060660f0de3e9b8f02df207312bc6f5c331
shipped in 2.6.24-rc1
closed.