Bug 7303 - Dock driver: Scheduling while atomic BUG during docking.
Dock driver: Scheduling while atomic BUG during docking.
Product: ACPI
Classification: Unclassified
Component: Config-Hotplug
i386 Linux
: P2 normal
Assigned To: Kristen
Depends on:
  Show dependency treegraph
Reported: 2006-10-10 23:53 UTC by Stefan Schmidt
Modified: 2007-03-08 01:16 UTC (History)
2 users (show)

See Also:
Kernel Version: Linux fairlight 2.6.18-fairlight #1 PREEMPT Thu Sep 21 13:27:00
Tree: Mainline
Regression: ---

dmesg after docking (93.53 KB, text/plain)
2006-10-10 23:54 UTC, Stefan Schmidt
dmesg after docking a undocked laptop (74.30 KB, text/plain)
2006-10-14 07:22 UTC, Stefan Schmidt
dmesg with debug. (93.69 KB, text/plain)
2006-10-17 05:42 UTC, Stefan Schmidt
dock.c with debug. (19.79 KB, text/plain)
2006-10-17 05:43 UTC, Stefan Schmidt
.config (45.69 KB, text/plain)
2006-10-19 15:55 UTC, Stefan Schmidt
patch to switch from spinlock to mutex when hotplugging devices (1.96 KB, patch)
2006-10-26 17:17 UTC, Kristen
Details | Diff

Description Stefan Schmidt 2006-10-10 23:53:18 UTC
Distribution: Debian Unstable
Hardware Environment: Thinkpad T40p and ThinkPad Dock II
Software Environment: ACPI dock driver from vanilla 2.6.18
Problem Description: If I dock my notebook to the dockingstation, I get the
attached 'Scheduling while atomic BUG' in my dmesg.

I can still work with this machine afterwards.

Steps to reproduce: Dock the Thinkpad. I tested this with undocking first until
now. If you like, I can boot the notebook outside the dock, dock it and see if
it gives the same result.
Comment 1 Stefan Schmidt 2006-10-10 23:54:40 UTC
Created attachment 9204 [details]
dmesg after docking
Comment 2 Kristen 2006-10-11 10:08:23 UTC
I just want to make clear how to duplicate the problem.
1.  Boot laptop docked.
2.  Undock
3.  Dock

Or is it:
1.  Boot laptop undocked
2.  Dock

Comment 3 Stefan Schmidt 2006-10-11 10:49:27 UTC
Sorry for being somewhat unclear on my first report.

It's the first variant:
1.  Boot laptop docked.
2.  Undock
3.  Dock

If you like, i can test even the second variant. But earliest in three days, as
the dock is in my office and I'm at home the next two days.
Comment 4 Stefan Schmidt 2006-10-14 07:20:33 UTC
I can even reproduce the bug with the second scenario.

1. Boot laptop undocked.
2. Dock laptop.

I'll attach a scecond dmesg.
Comment 5 Stefan Schmidt 2006-10-14 07:22:40 UTC
Created attachment 9247 [details]
dmesg after docking a undocked laptop
Comment 6 Stefan Schmidt 2006-10-17 05:41:53 UTC
I add some ugly debug printk's to dock.c, to get a better overview where this
bug triggers.

The bug occurs inside hotplug_dock_devices(), between debug STEP 13 and 14.

printk(KERN_INFO PREFIX "STEP 13\n");

     * Now make sure that an acpi_device is created for each
     * dependent device, or removed if this is an eject request.
     * This will cause acpi_drivers to be stopped/started if they
     * exist
    list_for_each_entry(dd, &ds->dependent_devices, list) {
        printk(KERN_INFO PREFIX "STEP 14\n");

I have now idea about list_for_each_entry(). Hopefully this helps you to debug it.

I attach a dmesg and the modified dock.c for reference.

BTW, were you able to reproduce the bug?
Comment 7 Stefan Schmidt 2006-10-17 05:42:45 UTC
Created attachment 9283 [details]
dmesg with debug.
Comment 8 Stefan Schmidt 2006-10-17 05:43:46 UTC
Created attachment 9284 [details]
dock.c with debug.
Comment 9 Kristen 2006-10-17 09:35:09 UTC
Hi Stefan, 
Thanks for the additional debug output.  I have not had a chance to duplicate
the bug yet - I anticipate being able to spend time on this in a couple days. 
Thanks for your patience.

Comment 10 Kristen 2006-10-19 14:48:45 UTC
Hi Stefan, I was not able to reproduce - can you attach your .config please,
there is probably something I don't have quite the same.

Comment 11 Stefan Schmidt 2006-10-19 15:55:47 UTC
Created attachment 9311 [details]
Comment 12 Stefan Schmidt 2006-10-19 15:57:10 UTC
JFYI, I was able to reproduce this even with 2.6.19-rc2

Stefan Schmidt
Comment 13 Kristen 2006-10-25 15:26:30 UTC
I was finally able to duplicate the problem - it seems to only happen while in
preempt mode.  I will try to find out if this is a generic problem with acpi, or
specific to something that I'm doing wrong.
Comment 14 Stefan Schmidt 2006-10-25 15:36:27 UTC
Good to know. I began to think this is a local problem. ;)

Let me know if you have patches I should test.
Comment 15 Kristen 2006-10-26 17:17:55 UTC
Created attachment 9365 [details]
patch to switch from spinlock to mutex when hotplugging devices
Comment 16 Kristen 2006-10-26 17:18:31 UTC
Can you try out the patch I attached and see if it solves your problem?
Comment 17 Stefan Schmidt 2006-10-27 01:51:51 UTC
I will test your patch at the beginning of the next week, as I have the docking
station in my office.

Stefan Schmidt
Comment 18 Stefan Schmidt 2006-10-30 03:31:39 UTC
I tested it now. The origin prblem seems fixed. No bug message in dmesg anymore.

But I got another message in dmesg now. Not sure yet if this comes rom the patch:

ACPI: docking
IPv6 addrconf: prefix with wrong length 56
IPv6 addrconf: prefix with wrong length 56
ACPI Exception (pci_bind-0302): AE_NOT_FOUND, Unable to get data from device
DOCK [20060707]
ACPI: undocking
Comment 19 Kristen 2006-10-30 10:01:23 UTC
The message :
ACPI Exception (pci_bind-0302): AE_NOT_FOUND, Unable to get data from device

Is ok and is expected when you are hot plugging (i.e. docking) a device
that previously had not existed.  so, this seems to be working as far as I can tell.

I'll submit this fix.
Comment 20 Stefan Schmidt 2006-10-30 11:08:58 UTC
Ah, ok. The message was a bit confusing, as it talks about exeception.

I just saw your patch submit on lkml. Thanks for your work. I'm fine with it, so
you can close the bug.

Stefan Schmidt
Comment 21 Len Brown 2006-10-30 12:18:49 UTC
patch from comment #15 applied to acpi-test
Comment 22 Len Brown 2007-03-08 01:16:58 UTC
shipped in 2.6.20-rc2

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