netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg KH <gregkh@suse.de>
To: Satyam Sharma <satyam.sharma@gmail.com>
Cc: Jiri Kosina <jikos@jikos.cz>,
	Marcel Holtmann <marcel@holtmann.org>,
	Jeremy Fitzhardinge <jeremy@goop.org>,
	maxk@qualcomm.com, bluez-devel@lists.sourceforge.net,
	Cedric Le Goater <clg@fr.ibm.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	netdev@vger.kernel.org
Subject: Re: 2.6.21-rc7: BUG: sleeping function called from invalid context at net/core/sock.c:1523
Date: Sun, 13 May 2007 02:20:52 -0700	[thread overview]
Message-ID: <20070513092052.GA11249@suse.de> (raw)
In-Reply-To: <a781481a0705110629n7c7130c1x3a89fa958b271f20@mail.gmail.com>

On Fri, May 11, 2007 at 06:59:31PM +0530, Satyam Sharma wrote:
>  [1] This is the first problem point. However, I didn't find any reason
>  why this particular driver's .disconnect() couldn't sleep. In fact, a
>  comment in include/linux/usb.h:811 says:
> 
>  "The probe() and disconnect() methods are called in a context where
>  they can sleep, but they should avoid abusing the privilege. Most
>  work to connect to a device should be done when the device is opened,
>  and undone at the last close. The disconnect code needs to address
>  concurrency issues with respect to open() and close() methods, as
>  well as forcing all pending I/O requests to complete (by unlinking
>  them as necessary, and blocking until the unlinks complete)."
> 
>  I'm assuming the comment is not obsolete, of course, but although the
>  first sentence says .disconnect() shouldn't abuse the privilege to
>  sleep, the last sentence makes it quite evident that we are _allowed_
>  to do so anyway, and that is how things are (with the hci_usb driver,
>  at least, I didn't check the .remove() or .disconnect() functions of other
>  USB drivers, however).

Yes, this is true, you are running in thread context for .disconnect of
usb drivers, so you can sleep if you need to, but you will block all
other device's disconnect and probe functions while you do.  So, it's
good to try to not abuse this if possible.

thanks,

greg k-h

  reply	other threads:[~2007-05-14  1:42 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <462D1B09.9050005@goop.org>
     [not found] ` <Pine.LNX.4.64.0704232257090.20657@twin.jikos.cz>
2007-04-24  3:30   ` 2.6.21-rc7: BUG: sleeping function called from invalid context at net/core/sock.c:1523 Herbert Xu
2007-04-24  7:59     ` Jiri Kosina
     [not found]   ` <Pine.LNX.4.64.0704261625410.20657@twin.jikos.cz>
2007-05-11 13:29     ` Satyam Sharma
2007-05-13  9:20       ` Greg KH [this message]
2007-05-16  9:29       ` Jiri Kosina
2007-05-16 11:36         ` Satyam Sharma
2007-05-16 11:45           ` Marcel Holtmann
2007-05-16 11:56             ` Satyam Sharma
2007-05-16 11:59               ` Satyam Sharma
2007-05-16 12:16                 ` Marcel Holtmann
2007-05-16 12:19                   ` Jiri Kosina
2007-05-16 23:03                     ` Jiri Kosina
2007-05-16 23:16                       ` David Miller
2007-05-16 23:20                         ` Jiri Kosina
2007-05-17  6:04                           ` Marcel Holtmann

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=20070513092052.GA11249@suse.de \
    --to=gregkh@suse.de \
    --cc=bluez-devel@lists.sourceforge.net \
    --cc=clg@fr.ibm.com \
    --cc=jeremy@goop.org \
    --cc=jikos@jikos.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcel@holtmann.org \
    --cc=maxk@qualcomm.com \
    --cc=netdev@vger.kernel.org \
    --cc=satyam.sharma@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).