All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Brownell <david-b@pacbell.net>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Greg Kroah-Hartman <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:14:17 -0800	[thread overview]
Message-ID: <200412220814.17414.david-b@pacbell.net> (raw)
In-Reply-To: <41C905C0.9000705@pobox.com>

On Tuesday 21 December 2004 9:27 pm, Jeff Garzik wrote:
> > There's no guarantee that suspend() and resume() methods
> > are only called during system-wide suspend and resume.
> 
> That is precisely the reason why I am concerned.  If it was only during 
> system-wide resume, the impact of the very-long mdelay() would be more 
> difficult to notice.
> 
> You also ignored my question :)

I didn't ignore it; I answered it with a question!  If you had
answered mine, you'd have had the answer to yours ... :)

One way another task can be active during resume is with sysfs:
"echo -n 0 > /sys/devices/.../power/state", after similar selective
suspend of the device.  That's uncommon for now, primarily useful
for unit-testing driver suspend/resume.  Plus, its design is
currently borked; the pm core code doesn't bother to suspend
children of the device first.  But I do expect that selective
suspend/resume should work in Linux; it's not reasonable to design
the pm framework otherwise.

But in any case, while it'd be difficult to notice that mdelay()
in current systems (since selective suspend/resume is still rare)
it'd clearly be wrong to assume that resume() methods don't need
to have mutual exclusion during their critical sections.


> If the PCI layer is calling the resume method for a PCI device while 
> simultaneously calling the suspend method, that's a PCI layer problem.

I never suggested such a scenario.  Though that would be another
case where such critical sections matter, like the remove() method.


> Similarly, If the USB layer is calling into your driver while you are 
> resuming, something is broken and it ain't your locking.

Which gets back to the question I asked you:  if not the lock in
question, what's ensuring that everything behaves right?

As I said originally, I don't much like long udelays, but
at least it's clearly correct in terms of mutual exclusion.
You've not shown any solution that's equivalently correct.

- Dave

      parent reply	other threads:[~2004-12-22 16:14 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
2004-12-22 16:35               ` Benjamin Herrenschmidt
2004-12-22 16:14           ` David Brownell [this message]

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=200412220814.17414.david-b@pacbell.net \
    --to=david-b@pacbell.net \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.