public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Brownell <david-b@pacbell.net>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Jeff Garzik <jgarzik@pobox.com>,
	Linux Kernel list <linux-kernel@vger.kernel.org>,
	Greg KH <greg@kroah.com>, Linus Torvalds <torvalds@osdl.org>
Subject: Re: [PATCH] USB: fix Scheduling while atomic warning when resuming.
Date: Wed, 22 Dec 2004 08:16:42 -0800	[thread overview]
Message-ID: <200412220816.42350.david-b@pacbell.net> (raw)
In-Reply-To: <1103716768.28670.61.camel@gaston>

On Wednesday 22 December 2004 3:59 am, Benjamin Herrenschmidt wrote:
> 
> > Similarly, If the USB layer is calling into your driver while you are 
> > resuming, something is broken and it ain't your locking.
> 
> Actually, the later isn't broken, something may well call into the
> higher level USB drivers while resuming, but indeed, those shouldn't
> send any URB down the stack when the bus is suspended, and the EHCI
> driver should drop incoming URBs as well until fully resumed.

Well, not "drop" like the network layer might, but report an error;
if the bus is suspended, so are all its devices and drivers.  When
a USB device is suspended, all its endpoint queues should be empty.
(And devices can be suspended without the bus being suspended...)

Such checks should be part of usbcore, not just one HCD, but we're
still working towards better interfaces there.  It's excessively
painful to write HCDs.


> I think the lock here is only needed to protect the HCD state
> transitions David, no ?

State transitions and access to hardware.  There are a few other
code paths that can trigger state transitions then, like rmmod.
And Alan's pointed out that we'll be wanting autoresume mechanisms,
so that parent hubs implicitly wake up as needed.

One thing we don't have right now is a per-HCD spinlock that
usbcore has access to.  Periodically I wonder whether such a
lock might help sort some of these issues out.


> All we need is make sure that we don't let 
> things get queued (or call into EHCI code path that will end up
> touch the HW) while suspended.

That lock protects all HCD code paths that touch HW,
As well as the state transitions.  I don't recall that
any other state transitions require such a long delay,
except maybe initialization (which happens before the
upper levels of the USB stack see the controller).

- Dave

  reply	other threads:[~2004-12-22 16:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200412220103.iBM13wS0002158@hera.kernel.org>
2004-12-22  3:48 ` [PATCH] USB: fix Scheduling while atomic warning when resuming Jeff Garzik
2004-12-22  4:22   ` David Brownell
2004-12-22  4:46     ` Jeff Garzik
2004-12-22  4:59       ` David Brownell
2004-12-22  5:27         ` Jeff Garzik
2004-12-22 11:59           ` Benjamin Herrenschmidt
2004-12-22 16:16             ` David Brownell [this message]
2004-12-22 16:35               ` Benjamin Herrenschmidt
2004-12-22 16:14           ` David Brownell

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=200412220816.42350.david-b@pacbell.net \
    --to=david-b@pacbell.net \
    --cc=benh@kernel.crashing.org \
    --cc=greg@kroah.com \
    --cc=jgarzik@pobox.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /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