Bug 10431 - surprise undock hangs system, ethernet recognition issues on dock/undock - Sony Vaio VGN SZ483N laptop
Summary: surprise undock hangs system, ethernet recognition issues on dock/undock - So...
Status: CLOSED PATCH_ALREADY_AVAILABLE
Alias: None
Product: ACPI
Classification: Unclassified
Component: Config-Hotplug (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Shaohua
URL:
Keywords:
: 10432 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-04-09 05:40 UTC by S V N Vishwanathan
Modified: 2008-10-24 23:25 UTC (History)
6 users (show)

See Also:
Kernel Version: 2.6.25-rc8
Subsystem:
Regression: ---
Bisected commit-id:


Attachments
Decompiled dsdt (212.79 KB, text/plain)
2008-04-09 05:42 UTC, S V N Vishwanathan
Details
Output of lspci -vvnn (13.99 KB, text/plain)
2008-04-09 05:43 UTC, S V N Vishwanathan
Details
Output of dmidecode (6.13 KB, text/plain)
2008-04-09 05:43 UTC, S V N Vishwanathan
Details
dmesg output (35.79 KB, text/plain)
2008-04-09 05:43 UTC, S V N Vishwanathan
Details
/var/log/kern.log (149.72 KB, application/octet-stream)
2008-04-09 05:44 UTC, S V N Vishwanathan
Details
The script I use to dock (463 bytes, application/x-sh)
2008-04-09 05:44 UTC, S V N Vishwanathan
Details
config used to build the kernel (79.59 KB, text/plain)
2008-04-09 05:46 UTC, S V N Vishwanathan
Details
debug patch (422 bytes, patch)
2008-05-06 01:13 UTC, Shaohua
Details | Diff
a slightly modified patch (742 bytes, patch)
2008-05-06 19:07 UTC, Shaohua
Details | Diff

Description S V N Vishwanathan 2008-04-09 05:40:52 UTC
Latest working kernel version: None

Earliest failing kernel version: 2.6.25-rc8 

Distribution: Ubuntu Hardy Heron (8.04) Beta. Also fails with vanilla kernel 

Hardware Environment: Sony Vaio VGN SZ483N laptop + the corresponding docking station

Software Environment: N/A

Problem Description:

I compiled the kernel from git following instructions from here: https://wiki.ubuntu.com/KernelTeam/GitKernelBuild

Scenario 1: I boot the machine outside the dock. If I now dock it the ethernet adapter on the docking station is not recognized. 

Scenario 2: I boot the machine on the dock. The ethernet adapter on the docking station is recognized. If I now undock after pressing the undock button and redock again the ethernet adapter is not recognized.

Scenario 3: I boot the machine on the dock. The ethernet adapter on the docking station is recognized. If I now undock without pressing the undock button then the machine hangs and requires a hard reset.

Scenario 4: I boot the machine outside the dock and suspend it. If I now place it on the dock and resume then the ethernet adapter on the dock is recognized.  

Steps to reproduce:

As above

Docking and undocking works flawlessly under Windows Vista. 

The same buggy behavior is observed under Freebsd (see http://lists.freebsd.org/pipermail/freebsd-acpi/2008-March/004693.html). On the freebsd-mobile mailing list it was suggested that the  \_SB.DOCK._STA method always seems to return zero (i.e. dock status method indicates that the system is undocked all the time) (see http://lists.freebsd.org/pipermail/freebsd-acpi/2008-March/004699.html).

The attached script dock.sh scans the pci bus and powers them on. This seems to restore network connectivity after a redock but the in use LED on the dock does not light up. Furthermore /sys/devices/platform/dock.0/docked still contains a 0. Some discussion about the script can be found at http://ubuntuforums.org/showthread.php?t=666757

Please let me know if you need any further information.
Comment 1 S V N Vishwanathan 2008-04-09 05:42:26 UTC
Created attachment 15693 [details]
Decompiled dsdt
Comment 2 S V N Vishwanathan 2008-04-09 05:43:05 UTC
Created attachment 15694 [details]
Output of lspci -vvnn
Comment 3 S V N Vishwanathan 2008-04-09 05:43:27 UTC
Created attachment 15695 [details]
Output of dmidecode
Comment 4 S V N Vishwanathan 2008-04-09 05:43:50 UTC
Created attachment 15696 [details]
dmesg output
Comment 5 S V N Vishwanathan 2008-04-09 05:44:19 UTC
Created attachment 15697 [details]
/var/log/kern.log
Comment 6 S V N Vishwanathan 2008-04-09 05:44:56 UTC
Created attachment 15698 [details]
The script I use to dock
Comment 7 S V N Vishwanathan 2008-04-09 05:46:19 UTC
Created attachment 15699 [details]
config used to build the kernel
Comment 8 Jan Becicka 2008-04-10 00:25:17 UTC
I have very same problem with VGN-SZ71XN/C and docking station.
Comment 9 Adrian Cox 2008-04-10 04:39:04 UTC
I also have a docking problem (http://bugzilla.kernel.org/show_bug.cgi?id=10432), as do other Ubuntu users (https://bugs.launchpad.net/bugs/41091).

In my Dell the dock device's _STA method always returns 0 when I compile the kernel with CONFIG_SLUB, but returns the correct value when I compile with CONFIG_SLAB. It might be worthwhile to compile your kernel with CONFIG_SLAB, to see if this bug is a duplicate.
Comment 10 S V N Vishwanathan 2008-04-10 23:48:23 UTC
BTW there is a ubuntu bug report for this bug (https://bugs.launchpad.net/ubuntu/+source/linux/+bug/194617). I don't think this bug is related to 10432. I have no hard freezes while docking and undocking if the acpiphp module is loaded. The hard freeze happens only if acpiphp module is not loaded. The main issue is that the PCI network card is not detected on docking in certain cases. 
Comment 11 Adrian Cox 2008-04-11 00:57:55 UTC
The reason I thought it could be related is the common feature: the _STA method on the dock device returns a false zero. The Dell then freezes because it receives a continuous stream of ACPI events until the kernel responds by calling the _DCK method.  It looks as if the Vaio only sends a single ACPI event, and thus doesn't freeze.
Comment 12 Shaohua 2008-05-06 01:13:02 UTC
Created attachment 16039 [details]
debug patch

can you please try attached patch? It appears we should do _DCK first in hotplug.
Comment 13 S V N Vishwanathan 2008-05-06 04:00:45 UTC
I tested it and it works. Thanks!

Scenario 1 and 2 are resolved. But Scenario 3 still remains. The sky2 driver still causes the machine to hard freeze if the machine is undocked without pressing the undock button.
Comment 14 Shaohua 2008-05-06 19:06:35 UTC
*** Bug 10432 has been marked as a duplicate of this bug. ***
Comment 15 Shaohua 2008-05-06 19:07:38 UTC
Created attachment 16054 [details]
a slightly modified patch

please try the slightly modified patch.
Comment 16 Shaohua 2008-05-06 19:08:49 UTC
re comment #13: I guess scenario 3 doesn't work for windows too?
Comment 17 Adrian Cox 2008-05-07 01:26:44 UTC
I've tested the latest patch on my Dell D600, and it cures my docking issue.

There is one minor issue - even with the extra test on acpi_bus_get_device(), the Dell still sometimes goes down the dock() path when undocking:

Press eject request button on dock:
[  296.446486] ACPI: \_SB_.PCI0.PCIE.GDCK - undocking
Remove laptop from dock:
[  298.836494] usb 4-6: USB disconnect, address 6
[  298.836552] usb 4-6.3: USB disconnect, address 7
[  299.471014] tg3: eth0: Link is down.
[  300.267710] ACPI: \_SB_.PCI0.PCIE.GDCK - docking
[  300.269420] ACPI: Unable to dock!

What's curious is that this doesn't happen every time. The error appears to be harmless, and I can still dock and undock the laptop afterwards.
Comment 18 S V N Vishwanathan 2008-05-07 01:33:59 UTC
Scenario 3 works perfectly for Windows vista Ultimate and also under DesktopBSD 1.6 (it suffers from the other scenarios though). 
Comment 19 Shaohua 2008-05-07 01:56:45 UTC
re comment #17: does the patch in http://bugzilla.kernel.org/show_bug.cgi?id=7812 help the undocking case?

re comment #18: this scenario is surprise remove, I don't think linux drivers can handle it, proberly we will not support it.
Comment 20 Adrian Cox 2008-05-08 07:37:57 UTC
The patch in http://bugzilla.kernel.org/show_bug.cgi?id=7812 doesn't change the behaviour at all.   I still get the "Unable to dock!" message when I remove the laptop.

Looking at the code, there seems to be only one sequence of events that can cause this:
1. I remove the laptop.
2. The Dell BIOS sends ACPI_NOTIFY_BUS_CHECK.
3. acpi_bus_get_device() succeeds.
4. dock() executes the _DCK method without seeing a failure.
5. dock_present() is false, because the laptop is genuinely not in the dock.

I suspect that step 2 is a harmless BIOS bug.
Comment 21 Adrian Cox 2008-08-04 03:33:56 UTC
Shaohua - do you have any plans to submit this fix into the mainline kernel?
Comment 22 Zhang Rui 2008-09-23 20:47:16 UTC
patches are shipped to acpi test branch.
Comment 23 Len Brown 2008-10-24 23:25:56 UTC
shipped in linux-2.6.28-rc1
closed

commit 8b59560a3baf2e7c24e0fb92ea5d09eca92805db
Author: Shaohua Li <shaohua.li@intel.com>
Date:   Thu Aug 28 10:02:03 2008 +0800

    ACPI: dock: avoid check _STA method

Note You need to log in before you can comment on or make changes to this bug.