Bug 38782

Summary: Doubled AC adapter crashes ac module on Dell Inspiron 1090.
Product: ACPI Reporter: Jan-Matthias Braun (jan_braun)
Component: BIOSAssignee: acpi_bios
Status: CLOSED INVALID    
Severity: normal CC: lenb, tianyu.lan
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.39 Subsystem:
Regression: No Bisected commit-id:
Attachments: My experiment leading to a usable ac adapter on my box, skipping the first ac adapter.
dmidecode output. (With just one power supply?)
acpidump std hex output
acpidump --binary output
DSDT.dsl

Description Jan-Matthias Braun 2011-07-04 19:58:54 UTC
The system tries to register two ac adapters with the second creation of
/class/power_supply/ACAD' in power_supply_register leading to an error with
a backtrace in dmesg (appended below).
Subsequently every (un-)plugging of the power supply will crash the system
as will the unload of the ac module.

The sytem is a Dell Inspiron Duo (Inspiron 1090), BIOS A05 04/18/201.


Steps taken to analyze the problem
==================================

I have modified the ac module to only use one of the two ac adapters,
skipping the other one using a return 0 right after entering acpi_ac_add.
Using this hack the system is not crashing anymore and the module may be
unloaded. The differences in behavior are described below.


Using the first ACAD
--------------------

The system is not crashing, but no acpi events are emitted. As a consequence
neither the laptop-mode-tool nor any other client is reacting on power
plugging.

linux # cat /sys/class/power_supply/ACAD/device/path
\_SB_.ACAD

linux # acpi_listen
battery PNP0C0A:00 00000080 00000001
battery PNP0C0A:00 00000080 00000001

linux # ls /sys/devices/LNXSYSTM\:00/device\:00/PNP0A08\:00/device\:02/
ACPI0003:01


Using the second ACAD
---------------------

Using the second ac adapter everything is working as expected. The system is
getting acpi events and user space tools are reacting as expected.
Only powertop has no power usage estimate.

linux # cat /sys/class/power_supply/ACAD/device/path
\_SB_.PCI0.LPC_.ACAD

linux # acpi_listen
ac_adapter ACPI0003:01 00000080 00000000
battery PNP0C0A:00 00000080 00000001
ac_adapter ACPI0003:01 00000080 00000001
battery PNP0C0A:00 00000080 00000001

linux # ls /sys/devices/LNXSYSTM\:00/device\:00/PNP0A08\:00/device\:02/
ACPI0003:01


dmesg from module insertion
===========================

kernel: [ 9726.860299] ACPI: AC Adapter [ACAD] (off-line)
kernel: [ 9726.921164] ------------[ cut here ]------------
kernel: [ 9726.921186] WARNING: at fs/sysfs/dir.c:455 sysfs_add_one+0x8d/0xa3()
kernel: [ 9726.921194] Hardware name: Inspiron 1090
kernel: [ 9726.921201] sysfs: cannot create duplicate filename '/class/power_supply/ACAD'
kernel: [ 9726.921209] Modules linked in: ac(+) mcs7830 usbnet mii lsm303c lsm303a snd_seq snd_seq_device bnep rfcomm snd_hda_codec_conexant ath9k snd_hda_intel snd_hda_codec mac80211 snd_hwdep ath9k_common snd_pcm ath9k_hw ath ath3k snd_timer btusb cfg80211 bluetooth snd soundcore snd_page_alloc
kernel: [ 9726.921288] Pid: 26367, comm: insmod Tainted: G        W   2.6.39-gentoo-r2 #3
kernel: [ 9726.921296] Call Trace:
kernel: [ 9726.921314]  [<ffffffff8103c15b>] ? warn_slowpath_common+0x78/0x8c
kernel: [ 9726.921328]  [<ffffffff8103c215>] ? warn_slowpath_fmt+0x46/0x4c
kernel: [ 9726.921342]  [<ffffffff8111c335>] ? sysfs_add_one+0x8d/0xa3
kernel: [ 9726.921355]  [<ffffffff8111ca6a>] ? sysfs_do_create_link+0x100/0x1a3
kernel: [ 9726.921370]  [<ffffffff8131aeb3>] ? device_add+0x1ff/0x565
kernel: [ 9726.921386]  [<ffffffff8123d04d>] ? kobject_set_name+0x3c/0x42
kernel: [ 9726.921401]  [<ffffffff813eca86>] ? power_supply_register+0xb7/0x101
kernel: [ 9726.921420]  [<ffffffffa0197276>] ? acpi_ac_add+0xcd/0x113 [ac]
kernel: [ 9726.921435]  [<ffffffff812a2338>] ? acpi_device_probe+0x42/0x10d
kernel: [ 9726.921449]  [<ffffffff8131d0b7>] ? driver_probe_device+0xa8/0x138
kernel: [ 9726.921462]  [<ffffffff8131d196>] ? __driver_attach+0x4f/0x6f
kernel: [ 9726.921474]  [<ffffffff8131d147>] ? driver_probe_device+0x138/0x138
kernel: [ 9726.921487]  [<ffffffff8131c38e>] ? bus_for_each_dev+0x48/0x74
kernel: [ 9726.921501]  [<ffffffff8131ca38>] ? bus_add_driver+0xb3/0x203
kernel: [ 9726.921516]  [<ffffffffa0006000>] ? 0xffffffffa0005fff
kernel: [ 9726.921528]  [<ffffffff8131d63c>] ? driver_register+0x8d/0xf5
kernel: [ 9726.921540]  [<ffffffffa0006000>] ? 0xffffffffa0005fff
kernel: [ 9726.921556]  [<ffffffffa000601f>] ? acpi_ac_init+0x1f/0x1000 [ac]
kernel: [ 9726.921568]  [<ffffffff810002e9>] ? do_one_initcall+0x79/0x12c
kernel: [ 9726.921583]  [<ffffffff81066fd2>] ? sys_init_module+0xd9/0x224
kernel: [ 9726.921599]  [<ffffffff8153c37b>] ? system_call_fastpath+0x16/0x1b
kernel: [ 9726.921609] ---[ end trace 17817954cf45fdc3 ]---
kernel: [ 9726.981193] ACPI: AC Adapter [ACAD] (off-line)


Side note
=========

In acpi_ac_add I would expect the check on result to be inside the ifdef.

#ifdef CONFIG_ACPI_PROCFS_POWER
	result = acpi_ac_add_fs(device);
#endif
	if (result)
		goto end;
Comment 1 Jan-Matthias Braun 2011-07-04 20:05:04 UTC
Created attachment 64602 [details]
My experiment leading to a usable ac adapter on my box, skipping the first ac adapter.

Not marked as patch, as nobody would like to patch his system this way.
Comment 2 Jan-Matthias Braun 2011-07-04 20:26:13 UTC
Created attachment 64612 [details]
dmidecode output. (With just one power supply?)
Comment 3 Lan Tianyu 2011-07-12 06:01:53 UTC
Please attach the output of acpidump.
Comment 4 Jan-Matthias Braun 2011-07-13 20:52:27 UTC
Created attachment 65472 [details]
acpidump std hex output
Comment 5 Jan-Matthias Braun 2011-07-13 20:53:53 UTC
Created attachment 65482 [details]
acpidump --binary output

Hi!

Thanks for looking into this.

Added acpidump in std. readable text format as well as the binary dump.
Comment 6 Lan Tianyu 2011-07-14 02:16:12 UTC
Is there new version Bios?

From the acpidump, I find the first ACAD is redundant. I attach the DSDT where the first ACAD is removed. Please override the DSDT in the kernel and test it again. 

http://www.lesswatts.org/projects/acpi/overridingDSDT.php
Comment 7 Lan Tianyu 2011-07-14 02:17:00 UTC
Created attachment 65542 [details]
DSDT.dsl
Comment 8 Jan-Matthias Braun 2011-07-14 13:02:40 UTC
No, I already updated the Bios, but this did not change the situation. All dumps in this bug report are from the newest Bios revision.

Your patched DSDT works like a charm. I reset my ac.c and changed the .config accordingly.
Thanks a lot. But I guess that this means I will use your DSDT up to the point Dell is fixing their Bios?
Comment 9 Lan Tianyu 2011-07-15 01:51:21 UTC
Yeah. It's the bios issue.