From: Stefan Richter <stefanr@s5r6.in-berlin.de>
To: linux1394-devel@lists.sourceforge.net
Cc: Alan Stern <stern@rowland.harvard.edu>,
Greg Kroah-Hartman <gregkh@suse.de>,
linux-kernel@vger.kernel.org
Subject: deadlock in "modprobe -r ohci1394" shortly after "modprobe ohci1394"
Date: Sun, 19 Nov 2006 01:12:09 +0100 [thread overview]
Message-ID: <455FA159.2080303@s5r6.in-berlin.de> (raw)
I just rediscovered a deadlock in drivers/ieee1394/nodemgr.c which I
thought didn't exist anymore. It's still there, it's just a matter of
timing to trigger this. Quoting myself from
http://bugzilla.kernel.org/show_bug.cgi?id=6706 :
------------------------------------------------------------------------
# modprobe ohci1394 && modprobe -r ohci1394
works.
# modprobe ohci1394 && sleep 1 && modprobe -r ohci1394
gets stuck in uninterruptible sleep on kthread_stop(). This is trying to
stop the knodemgrd which uninterruptibly sleeps on
bus_rescan_devices_helper() meanwhile.
Call trace of the modprobe -r context:
kthread_stop in kernel/kthread.c
nodemgr_remove_host in drivers/ieee1394/nodemgr.c
__unregister_host in drivers/ieee1394/highlevel.c
highlevel_remove_host in drivers/ieee1394/highlevel.c
hpsb_remove_host in drivers/ieee1394/hosts.c
ohci1394_pci_remove in drivers/ieee1394/ohci1394.c
pci_device_remove in pci/pci-driver.c
__device_release_driver in drivers/base/dd.c
driver_detach in drivers/base/dd.c
Call trace of the knodemgrd context:
bus_rescan_devices_helper in drivers/base/bus.c
bus_rescan_devices in drivers/base/bus.c
nodemgr_node_probe in drivers/ieee1394/nodemgr.c
nodemgr_host_thread in drivers/ieee1394/nodemgr.c
It seems the following is the culprit:
Since Linux 2.6.16, bus_rescan_devices_helper takes
down(&dev->parent->sem) if a parent device exists. This is true for all
devices that are managed by nodemgr. (FireWire ud's have ud's or ne's as
parent, and FireWire ne's have hosts as parent.) And yes, the call in
driver_detach to __device_release_driver is enclosed in down(&dev->sem).
------------------------------------------------------------------------
The relevant change to bus_rescan_devices_helper in 2.6.16 is
http://kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=bf74ad5bc41727d5f2f1c6bedb2c1fac394de731
> commit bf74ad5bc41727d5f2f1c6bedb2c1fac394de731
> Author: Alan Stern <stern@rowland.harvard.edu>
> Date: Thu Nov 17 16:54:12 2005 -0500
>
> [PATCH] Hold the device's parent's lock during probe and remove
>
> This patch (as604) makes the driver core hold a device's parent's lock
> as well as the device's lock during calls to the probe and remove
> methods in a driver. This facility is needed by USB device drivers,
> owing to the peculiar way USB devices work:
[...]
> I have not tested this patch for conflicts with other subsystems. As
> far as I can see, the only possibility of conflict would lie in the
> bus_rescan_devices pathway, and it seems pretty remote. Nevertheless,
> it would be good for this to get a lot of testing in -mm.
Yes, it's pretty remote but there is indeed one if I'm not entirely
mistaken.
Right now I don't see a sane fix but I will have a few nights sleep over
it...
--
Stefan Richter
-=====-=-==- =-== =--==
http://arcgraph.de/sr/
next reply other threads:[~2006-11-19 0:12 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-19 0:12 Stefan Richter [this message]
2006-11-19 14:23 ` Stefan Richter
2006-11-19 19:54 ` Alan Stern
2006-11-19 21:55 ` Stefan Richter
2006-11-20 19:31 ` Alan Stern
2006-11-20 20:45 ` Stefan Richter
2006-11-20 21:28 ` Alan Stern
2006-11-21 0:21 ` Stefan Richter
2006-11-21 0:49 ` Alan Stern
2006-11-21 8:05 ` Stefan Richter
2006-11-21 21:50 ` [PATCH] ieee1394: nodemgr: fix deadlock in shutdown Stefan Richter
2006-11-22 2:02 ` Alan Stern
2006-11-22 20:09 ` Stefan Richter
2006-11-20 3:41 ` deadlock in "modprobe -r ohci1394" shortly after "modprobe ohci1394" Dmitry Torokhov
2006-11-20 19:18 ` Alan Stern
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=455FA159.2080303@s5r6.in-berlin.de \
--to=stefanr@s5r6.in-berlin.de \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux1394-devel@lists.sourceforge.net \
--cc=stern@rowland.harvard.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®