Bug 15318

Summary: ACPI/ata regression with hotplugging the dvd drive
Product: ACPI Reporter: Maciej Rutecki (maciej.rutecki)
Component: Config-HotplugAssignee: acpi_config-hotplug
Status: CLOSED CODE_FIX    
Severity: normal CC: acpi-bugzilla, dariush, maciej.rutecki, rjw, rui.zhang
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.33-rc6 Subsystem:
Regression: No Bisected commit-id:
Bug Depends on:    
Bug Blocks: 14885    
Attachments: modified lockdep patch from http://bugzilla.kernel.org/show_bug.cgi?id=14553#c5
debug patch
full dmesg output
debug patch 2

Description Maciej Rutecki 2010-02-15 19:22:19 UTC
Subject    : ACPI/ata regression with hotplugging the dvd drive
Submitter  : Dariush Forouher <dariush@forouher.de>
Date       : 2010-02-13 16:31
Message-ID : 4B76D3E7.6000904@forouher.de
References : http://marc.info/?l=linux-kernel&m=126607873824718&w=2

This entry is being used for tracking a regression from 2.6.32.  Please don't
close it until the problem is fixed in the mainline.
Comment 1 Zhang Rui 2010-02-22 06:19:26 UTC
hmmm, is this a duplicate of bug #14553?

Dariush,
with the patches mentioned in http://bugzilla.kernel.org/show_bug.cgi?id=14553#c5 applied, the lockdep warning goes away, does the hotplug issue still exist?
Comment 2 Dariush Forouher 2010-02-22 22:02:22 UTC
Ok. I applied the patch you mentioned (it didn't apply cleanly on 2.6.33-rc8, but I hope I fixed it up right. I attached it so you can check if you want.)

The lockdep warning vanishes if I apply the patch. The bug itself remains, though.

Interestingly, I had some problems reproducing the bug this time. After some looking around, I managed to reproduce it, but only after downgrading my gcc:

Debian upgraded the gcc in testing a couple of weeks ago from

"gcc (Debian 4.3.4-6) 4.3.4"

to

"gcc-4.4 (Debian 4.4.2-9) 4.4.3 20100108 (prerelease)"

I did some tests to see if the bug may be related to the different gcc versions. So I compiled 2.6.33-rc8 - with and w/o the lockdep patch on the new as well as the old compiler. 

These are the results:
- Using gcc-4.4 the bug occurs NOT
- Using gcc-4.3 the bug occurs

The bug is totally independent of applying the lockdep patch from the other bugzilla entry.

2.6.32 doesn't have the bug with either gcc version.

So it seems that something in 2.6.33 introduced this bug when compiling the kernel specifically with the older gcc 4.3.
Comment 3 Dariush Forouher 2010-02-22 22:04:30 UTC
Created attachment 25167 [details]
modified lockdep patch from http://bugzilla.kernel.org/show_bug.cgi?id=14553#c5

the patch from http://bugzilla.kernel.org/show_bug.cgi?id=14553#c5, modified to apply on top of 2.6.33-rc8. Doesn't fix the bug, just makes the lockdep warning disappear.
Comment 4 Zhang Rui 2010-02-24 03:04:50 UTC
Created attachment 25178 [details]
debug patch

please apply this patch in the non-working kernel.
and attach the dmesg output after inserting the dvd drive.
Comment 5 Dariush Forouher 2010-02-24 10:33:18 UTC
Created attachment 25191 [details]
full dmesg output

This is the dmesg output when inserting or removing the dvd drive:

[   86.960161] Notification 0x1 to device \_SB_.PCI0.IDE1.PRI_.MAST
[   86.960622] Notification 0x1 to device \_SB_.PCI0.IDE1.PRI_
Comment 6 Zhang Rui 2010-02-25 02:21:02 UTC
Created attachment 25204 [details]
debug patch 2

so this is not an interrupts issue.
It seems that this is a dock driver regression.
please apply this debug patch on top of the previous one and attach the dmesg output after inserting the dock.
Comment 7 Dariush Forouher 2010-02-25 08:49:39 UTC
Here it is:

[   88.140973] Notification 0x1 to device \_SB_.PCI0.IDE1.PRI_.MAST
[   88.141116] Rui: in acpi_dock_notifier_calli, event 1
[   88.141435] Notification 0x1 to device \_SB_.PCI0.IDE1.PRI_
[   88.141438] Rui: in acpi_dock_notifier_calli, event 1
[   88.141680] Rui: in dock_notify, ds->flags 0x812fdba5, event 1
[   88.141682] Rui: event 1, dock_in_progress: yes
Comment 8 Zhang Rui 2010-02-26 03:05:46 UTC
(In reply to comment #7)
> Here it is:
> 
> [   88.140973] Notification 0x1 to device \_SB_.PCI0.IDE1.PRI_.MAST
> [   88.141116] Rui: in acpi_dock_notifier_calli, event 1
> [   88.141435] Notification 0x1 to device \_SB_.PCI0.IDE1.PRI_
> [   88.141438] Rui: in acpi_dock_notifier_calli, event 1
> [   88.141680] Rui: in dock_notify, ds->flags 0x812fdba5, event 1
> [   88.141682] Rui: event 1, dock_in_progress: yes

please attach the output of "grep . /sys/bus/acpi/drivers/*/*/path", in both working and non-working kernel.

can you apply these two debug patches on a working kernel and attach the dmesg output after the same test?
Comment 9 Dariush Forouher 2010-02-26 09:46:14 UTC
good kernel: 2.6.33-rc8 - gcc-4.4

[  134.064615] Notification 0x1 to device \_SB_.PCI0.IDE1.PRI_.MAST
[  134.064620] Rui: in acpi_dock_notifier_calli, event 1
[  134.064689] Notification 0x1 to device \_SB_.PCI0.IDE1.PRI_
[  134.064692] Rui: in acpi_dock_notifier_calli, event 1
[  134.064816] Rui: in dock_notify, ds->flags 0x0, event 1
[  134.064818] Rui: event 1, dock_in_progress: no
[  134.064822] ACPI: \_SB_.PCI0.IDE1.PRI_.MAST - docking
[  134.067139] ata4: exception Emask 0x10 SAct 0x0 SErr 0x0 action 0xe frozen
[  134.067142] ata4: ACPI event
[  134.067181] ata4: soft resetting link
[  134.257469] ata4.00: ATAPI: TSSTcorp DVD+/-RW TS-L632H, D200, max UDMA/33
[  134.314448] ata4.00: configured for UDMA/33
[  134.373120] ata4: EH complete
[  134.415512] scsi 3:0:0:0: CD-ROM            TSSTcorp DVD+-RW TS-L632H D200 PQ: 0 ANSI: 5
[  134.565491] sr0: scsi3-mmc drive: 6x/24x writer cd/rw xa/form2 cdda tray
[  134.565503] Uniform CD-ROM driver Revision: 3.20
[  134.565857] sr 3:0:0:0: Attached scsi CD-ROM sr0
[  134.566804] sr 3:0:0:0: Attached scsi generic sg1 type 5

% grep . /sys/bus/acpi/drivers/*/*/path
/sys/bus/acpi/drivers/ac/ACPI0003:00/path:\_SB_.AC__
/sys/bus/acpi/drivers/battery/PNP0C0A:00/path:\_SB_.BAT0
/sys/bus/acpi/drivers/battery/PNP0C0A:01/path:\_SB_.BAT1
/sys/bus/acpi/drivers/button/PNP0C0C:00/path:\_SB_.PBTN
/sys/bus/acpi/drivers/button/PNP0C0D:00/path:\_SB_.LID_
/sys/bus/acpi/drivers/button/PNP0C0E:00/path:\_SB_.SBTN
/sys/bus/acpi/drivers/pci_link/PNP0C0F:00/path:\_SB_.PCI0.LNKA
/sys/bus/acpi/drivers/pci_link/PNP0C0F:01/path:\_SB_.PCI0.LNKB
/sys/bus/acpi/drivers/pci_link/PNP0C0F:02/path:\_SB_.PCI0.LNKC
/sys/bus/acpi/drivers/pci_link/PNP0C0F:03/path:\_SB_.PCI0.LNKD
/sys/bus/acpi/drivers/pci_link/PNP0C0F:04/path:\_SB_.PCI0.LNKE
/sys/bus/acpi/drivers/pci_link/PNP0C0F:05/path:\_SB_.PCI0.LNKF
/sys/bus/acpi/drivers/pci_link/PNP0C0F:06/path:\_SB_.PCI0.LNKG
/sys/bus/acpi/drivers/pci_link/PNP0C0F:07/path:\_SB_.PCI0.LNKH
/sys/bus/acpi/drivers/pci_root/PNP0A03:00/path:\_SB_.PCI0
/sys/bus/acpi/drivers/processor/LNXCPU:00/path:\_PR_.CPU0
/sys/bus/acpi/drivers/processor/LNXCPU:01/path:\_PR_.CPU1
/sys/bus/acpi/drivers/thermal/LNXTHERM:01/path:\_TZ_.THM_
/sys/bus/acpi/drivers/video/LNXVIDEO:01/path:\_SB_.PCI0.VID_




bad kernel: 2.6.33-rc8 - gcc-4.3

[   88.878950] Notification 0x1 to device \_SB_.PCI0.IDE1.PRI_.MAST
[   88.879093] Rui: in acpi_dock_notifier_calli, event 1
[   88.879422] Notification 0x1 to device \_SB_.PCI0.IDE1.PRI_
[   88.879425] Rui: in acpi_dock_notifier_calli, event 1
[   88.879625] Rui: in dock_notify, ds->flags 0x812fdba5, event 1
[   88.879627] Rui: event 1, dock_in_progress: yes

% grep . /sys/bus/acpi/drivers/*/*/path
/sys/bus/acpi/drivers/ac/ACPI0003:00/path:\_SB_.AC__
/sys/bus/acpi/drivers/battery/PNP0C0A:00/path:\_SB_.BAT0
/sys/bus/acpi/drivers/battery/PNP0C0A:01/path:\_SB_.BAT1
/sys/bus/acpi/drivers/button/PNP0C0C:00/path:\_SB_.PBTN
/sys/bus/acpi/drivers/button/PNP0C0D:00/path:\_SB_.LID_
/sys/bus/acpi/drivers/button/PNP0C0E:00/path:\_SB_.SBTN
/sys/bus/acpi/drivers/pci_link/PNP0C0F:00/path:\_SB_.PCI0.LNKA
/sys/bus/acpi/drivers/pci_link/PNP0C0F:01/path:\_SB_.PCI0.LNKB
/sys/bus/acpi/drivers/pci_link/PNP0C0F:02/path:\_SB_.PCI0.LNKC
/sys/bus/acpi/drivers/pci_link/PNP0C0F:03/path:\_SB_.PCI0.LNKD
/sys/bus/acpi/drivers/pci_link/PNP0C0F:04/path:\_SB_.PCI0.LNKE
/sys/bus/acpi/drivers/pci_link/PNP0C0F:05/path:\_SB_.PCI0.LNKF
/sys/bus/acpi/drivers/pci_link/PNP0C0F:06/path:\_SB_.PCI0.LNKG
/sys/bus/acpi/drivers/pci_link/PNP0C0F:07/path:\_SB_.PCI0.LNKH
/sys/bus/acpi/drivers/pci_root/PNP0A03:00/path:\_SB_.PCI0
/sys/bus/acpi/drivers/processor/LNXCPU:00/path:\_PR_.CPU0
/sys/bus/acpi/drivers/processor/LNXCPU:01/path:\_PR_.CPU1
/sys/bus/acpi/drivers/thermal/LNXTHERM:01/path:\_TZ_.THM_
/sys/bus/acpi/drivers/video/LNXVIDEO:01/path:\_SB_.PCI0.VID_
Comment 10 Zhang Rui 2010-03-01 05:48:18 UTC
please make sure this patch is applied in your 2.6.33-rc8 kernel.

commit 49c6fb2e41d41c4c0c5c753b6960bc81fe658d20
Author: Alex Chiang <achiang@hp.com>
Date:   Mon Feb 1 10:35:18 2010 -0700

    ACPI: dock: properly initialize local struct dock_station in dock_add()
    
    Commit fe06fba2 (ACPI: dock: add struct dock_station * directly
    to platform device data) changed dock_add() to use the
    platform_device_register_data() API.
    
    We passed that interface a stack variable, which is kmemdup'ed
    and assigned to the device's platform_data pointer.
    
    Unfortunately, whatever random garbage is in the stack variable
    gets coped during the kmemdup, and that leads to broken behavior.
    
    Explicitly zero out the structure before passing it to the API.
    
    This fixes the T41 docking button issue:
    http://bugzilla.kernel.org/show_bug.cgi?id=15000
    
    Cc: stable@kernel.org
    Reported-by: Chris Mason <chris.mason@oracle.com>
    Signed-off-by: Alex Chiang <achiang@hp.com>
    Signed-off-by: Len Brown <len.brown@intel.com>

diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c
index bbc2c13..b2586f5 100644
--- a/drivers/acpi/dock.c
+++ b/drivers/acpi/dock.c
@@ -935,6 +935,7 @@ static int dock_add(acpi_handle handle)
        struct platform_device *dd;
 
        id = dock_station_count;
+       memset(&ds, 0, sizeof(ds));
        dd = platform_device_register_data(NULL, "dock", id, &ds, sizeof(ds));
        if (IS_ERR(dd))
                return PTR_ERR(dd);
Comment 11 Dariush Forouher 2010-03-02 08:58:55 UTC
Yes, this patch fixes the problem. I see that the patch is already included in 2.6.33...

Thanks for your help!

cheers
Dariush

[   99.389240] Notification 0x1 to device \_SB_.PCI0.IDE1.PRI_.MAST
[   99.389370] Rui: in acpi_dock_notifier_calli, event 1
[   99.389664] Notification 0x1 to device \_SB_.PCI0.IDE1.PRI_
[   99.389666] Rui: in acpi_dock_notifier_calli, event 1
[   99.389889] Rui: in dock_notify, ds->flags 0x0, event 1
[   99.389892] Rui: event 1, dock_in_progress: no
[   99.389910] ACPI: \_SB_.PCI0.IDE1.PRI_.MAST - docking
[   99.390963] ata4: exception Emask 0x10 SAct 0x0 SErr 0x0 action 0xe frozen
[   99.390966] ata4: ACPI event
[   99.391015] ata4: soft resetting link
[   99.580783] ata4.00: ATAPI: TSSTcorp DVD+/-RW TS-L632H, D200, max UDMA/33
[   99.637802] ata4.00: configured for UDMA/33
[   99.697331] ata4: EH complete
[   99.739642] scsi 3:0:0:0: CD-ROM            TSSTcorp DVD+-RW TS-L632H D200 PQ: 0 ANSI: 5
[   99.889518] sr0: scsi3-mmc drive: 6x/24x writer cd/rw xa/form2 cdda tray
[   99.889523] Uniform CD-ROM driver Revision: 3.20
[   99.890666] sr 3:0:0:0: Attached scsi CD-ROM sr0
[   99.891818] sr 3:0:0:0: Attached scsi generic sg1 type 5
Comment 12 Zhang Rui 2010-03-02 09:07:48 UTC
great.
Bug closed.