mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jesse Stockall <stockall@magma.ca>
To: Stefano Rivoir <s.rivoir@gts.it>
Cc: Andrew Morton <akpm@osdl.org>, linux-kernel@vger.kernel.org
Subject: Re: 2.6.7-mm7
Date: Fri, 09 Jul 2004 07:45:07 -0400	[thread overview]
Message-ID: <1089373506.8067.7.camel@homer.blizzard.org> (raw)
In-Reply-To: <40EE732C.5020404@gts.it>

On Fri, 2004-07-09 at 06:27, Stefano Rivoir wrote:
> 
> It seems that hotplug "subsystem" is having problems (I use debian/sid), 
> because it stucks during
> 
> /sbin/modprobe -s -q ehci_hcd
> 
> Note that I'm seeing this after a /etc/init.d/hotplug start (after a 
> successfull boot), but just before I had a kernel oops (see attached 
> file) when issuing a /etc/init.d/hotplug stop.

Hi

This is a known issue that appeared in 2.6.7-mm6. See below for a
temporary fix. Check the [2.6.7-mm6 -  USB problems] thread on
linux-usb-devel@lists.sourceforge.net for more info.

Jesse

<-- msg from Alan Stern -->

This patch fixes a problem with my recent set of locking changes for
USB.
The problem is that rw-semaphores don't have the semantics I need.  I
need
something where, if the semaphore is locked for reading and a writer is
waiting for the lock, another reader will be granted a readlock
immediately.  That's because there are several places where a thread
holding the readlock will acquire the readlock again, in a nested or
recursive fashion.  If a writer is waiting for the first readlock to be
released, the standard semantics will yield deadlock.

This patch implements those alternate semantics by putting writers on a 
separate wait queue.  It's a little bit awkward and has a definite 
roll-you-own flavor, but it works.  Please apply.

Alan Stern



Signed-off-by: Alan Stern <stern@rowland.harvard.edu>

===== drivers/usb/core/usb.c 1.281 vs edited =====
--- 1.281/drivers/usb/core/usb.c        Wed Jun 30 09:44:26 2004
+++ edited/drivers/usb/core/usb.c       Wed Jul  7 15:47:23 2004
@@ -64,6 +64,7 @@
                        /* Not honored on modular build */
 
 static DECLARE_RWSEM(usb_all_devices_rwsem);
+static DECLARE_WAIT_QUEUE_HEAD(usb_all_devices_wqh);
 
 
 static int generic_probe (struct device *dev)
@@ -933,6 +934,7 @@
 {
        up(&udev->serialize);
        up_read(&usb_all_devices_rwsem);
+       wake_up(&usb_all_devices_wqh);
 }
 
 /**
@@ -940,10 +942,15 @@
  *
  * This is necessary when registering a new driver or probing a bus,
  * since the driver-model core may try to use any usb_device.
+ *
+ * Unfortunately we have to use a separate wait queue, because we need
+ * to make sure that a thread waiting for a writelock won't block other
+ * threads from acquiring a readlock.
  */
 void usb_lock_all_devices(void)
 {
-       down_write(&usb_all_devices_rwsem);
+       wait_event(usb_all_devices_wqh,
+                       down_write_trylock(&usb_all_devices_rwsem));
 }
 
 /**
@@ -952,6 +959,7 @@
 void usb_unlock_all_devices(void)
 {
        up_write(&usb_all_devices_rwsem);
+       wake_up(&usb_all_devices_wqh);
 }

-- 
Jesse Stockall <stockall@magma.ca>


  parent reply	other threads:[~2004-07-09 11:47 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-09  6:50 2.6.7-mm7 Andrew Morton
2004-07-09  8:15 ` 2.6.7-mm7 Stefano Rivoir
2004-07-09  9:41   ` 2.6.7-mm7 Andrew Morton
2004-07-09 10:27     ` 2.6.7-mm7 Stefano Rivoir
2004-07-09 10:32       ` 2.6.7-mm7 Stefano Rivoir
2004-07-09 11:45       ` Jesse Stockall [this message]
2004-07-09 18:54         ` 2.6.7-mm7 Andrew Morton
2004-07-09 19:52           ` 2.6.7-mm7 Jesse Stockall
2004-07-09 20:00             ` 2.6.7-mm7 Andrew Morton
2004-07-09 22:21               ` 2.6.7-mm7 Greg KH
2004-07-09 19:56           ` 2.6.7-mm7 Alan Stern
2004-07-09 10:32 ` 2.6.7-mm7 Jurgen Kramer
2004-07-09 10:39   ` 2.6.7-mm7 Andrew Morton
2004-07-09 11:16     ` 2.6.7-mm7 Jurgen Kramer
2004-07-09 14:40   ` 2.6.7-mm7 Felipe Alfaro Solana
2004-07-09 16:40     ` 2.6.7-mm7 Jurgen Kramer
2004-07-09 11:44 ` 2.6.7-mm7 Michael Geithe
2004-07-09 22:15   ` 2.6.7-mm7 Greg KH
2004-07-10  0:07     ` 2.6.7-mm7 Michael Geithe
2004-07-09 20:38 ` 2.6.7-mm7 Joseph Fannin
2004-07-09 21:11   ` 2.6.7-mm7 Andrew Morton
2004-07-14 22:01     ` 2.6.7-mm7 Tom Rini
2004-07-17 16:17     ` 2.6.7-mm7 Paul Mackerras
2004-07-17 19:19       ` 2.6.7-mm7 Joseph Fannin
2004-07-09 21:04 ` 2.6.7-mm7 William Lee Irwin III
2004-07-09 22:11   ` 2.6.7-mm7 William Lee Irwin III
2004-07-09 22:14   ` 2.6.7-mm7 Andrew Morton
2004-07-09 22:24     ` 2.6.7-mm7 James Bottomley
2004-07-09 23:40       ` 2.6.7-mm7 Andrew Morton
2004-07-10  2:47         ` 2.6.7-mm7 James Bottomley
2004-07-10  4:34 ` 2.6.7-mm7 Joshua Kwan
2004-07-10  4:40   ` 2.6.7-mm7 Joshua Kwan
2004-07-10 18:29 ` 2.6.7-mm7 Diego Calleja García
2004-07-10 20:04 ` 2.6.7-mm7 Marcin Gibuła
2004-07-10 20:10   ` 2.6.7-mm7 Marcin Gibuła
2004-07-10 20:27   ` 2.6.7-mm7 Andrew Morton
2004-07-10 20:32     ` 2.6.7-mm7 Marcin Gibuła
2004-07-11  4:19 ` 2.6.7-mm7 Dax Kelson
2004-07-11  4:40   ` 2.6.7-mm7 Andrew Morton
2004-07-10  6:21 2.6.7-mm7 Zoltan Boszormenyi
     [not found] <A6974D8E5F98D511BB910002A50A6647615FFB70@hdsmsx403.hd.intel.com>
2004-07-11  2:23 ` 2.6.7-mm7 Len Brown
2004-07-11 10:23   ` 2.6.7-mm7 Thomas Svedberg
2004-07-11 15:49     ` 2.6.7-mm7 Zoltan Boszormenyi
     [not found] <A6974D8E5F98D511BB910002A50A6647615FFA5D@hdsmsx403.hd.intel.com>
2004-07-11  2:34 ` 2.6.7-mm7 Len Brown
2004-07-11 18:32   ` 2.6.7-mm7 Michael Geithe
     [not found] <A6974D8E5F98D511BB910002A50A6647615FFA8A@hdsmsx403.hd.intel.com>
2004-07-11  2:36 ` 2.6.7-mm7 Len Brown

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=1089373506.8067.7.camel@homer.blizzard.org \
    --to=stockall@magma.ca \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=s.rivoir@gts.it \
    /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®