From: Oliver Neukum <oliver@neukum.org>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Pavel Machek <pavel@ucw.cz>,
linux-usb-devel@lists.sourceforge.net,
James Bottomley <James.Bottomley@steeleye.com>,
linux-scsi@vger.kernel.org
Subject: Re: [linux-usb-devel] question on flushing buffers and spinning down disk
Date: Sat, 29 Sep 2007 22:06:16 +0200 [thread overview]
Message-ID: <200709292206.17377.oliver@neukum.org> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0709291428050.1094-100000@netrider.rowland.org>
Am Samstag 29 September 2007 schrieb Alan Stern:
> I disagree. That bug report shows that problems arise when we try to
> suspend a parent without making sure the children are suspended first.
> If the sd suspend method had already run then it would have been okay
> for the enclosure to cut power.
That is true. The question is who is to call the suspend method.
> > Suspension in a higher layer can have effects that are different to suspension
> > of all devices on a lower level. Therefore the higher level must ask the lower
> > level to prepare itself.
>
> When the lower level is suspended then it is supposed to be prepared
> for the higher layer to suspend. No additional preparation should be
> needed.
Yes.
If it returns from suspend without error a driver must keep that guarantee.
> (That's true for USB and SCSI. Other buses can have additional
> complications, like PCI with its multiple D states. But the principle
> remains the same.)
>
> > Ideally it would ask the lower level for permission to do an autosuspend. I'd
> > like to change the API so that you can do that. But I don't think that the
> > lower levels have to implement autosuspend on their own to have levels
> > above them support autosuspend. Can you summarize your requirements
> > for supporting autosuspend in the higher levels?
>
> It's very simple: The higher level can't autosuspend if doing so would
> cause harm to the lower level.
>
> There are two ways to avoid harm. One is for the lower level to be
> such that it can never be harmed, no matter what the higher level does.
> For example, a purely logical entity like a partition won't be harmed
> if the drive it belongs to is suspended. In fact we don't try to
> suspend partitions, and they don't even have drivers.
>
> The other way is for the lower level to be suspended already. That's
> how the autosuspend framework operates: the lower level autosuspends
> and tells the higher level that it is now safe for the higher level to
This is how the hub driver works.
> autosuspend. It's not supposed to work by the higher level announcing:
> "I want to autosuspend now, so all you lower guys had better get
> ready."
I see. And there's an appealing simplicity to it. But why insist that
this is the one true way?
> Even in the case of system suspend things don't work that way. We
> don't have higher-level drivers telling lower-level drivers to suspend.
> Rather, the PM core (acting on behalf of the user) tells _every_ driver
> to suspend -- in the correct order, of course.
True. And putting the notification into a driver is a kludge at best.
It simply was the only way I could come up with without moving
autosuspend into generic code.
Nevertheless, I am not convinced that autosuspend has to work
on the device level only.
> Now, how much extra work is involved in having the lower-level drivers
> implement autosuspend as opposed to having the higher-level driver ask
> permission? Not much more than adding the autosuspend timers.
> Everything else is needed anyway for supporting manual runtime suspend.
Move autosuspend into generic code and I'll certainly try to come up with
something better than what I wrote.
Regards
Oliver
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2007-09-29 20:05 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-18 8:32 question on flushing buffers and spinning down disk Oliver Neukum
2007-09-18 14:01 ` James Bottomley
2007-09-18 14:15 ` Oliver Neukum
2007-09-18 14:26 ` James Bottomley
2007-09-24 10:33 ` Oliver Neukum
2007-09-24 14:38 ` Alan Stern
2007-09-24 15:21 ` Oliver Neukum
2007-09-24 15:34 ` Alan Stern
2007-09-24 16:47 ` Oliver Neukum
2007-09-24 17:10 ` Alan Stern
2007-09-24 19:16 ` [linux-usb-devel] " Oliver Neukum
2007-09-24 19:39 ` Alan Stern
2007-09-24 20:00 ` [linux-usb-devel] " Oliver Neukum
2007-09-25 14:13 ` Alan Stern
2007-09-25 15:11 ` Oliver Neukum
2007-09-28 4:27 ` Greg KH
2007-09-28 7:02 ` Oliver Neukum
2007-09-28 19:33 ` Greg KH
2007-09-25 7:50 ` Oliver Neukum
2007-09-25 15:03 ` Alan Stern
2007-09-27 11:40 ` Oliver Neukum
2007-09-27 16:01 ` Alan Stern
2007-09-27 18:12 ` Oliver Neukum
2007-09-27 19:07 ` [linux-usb-devel] " Alan Stern
2007-09-27 19:26 ` Oliver Neukum
2007-09-27 20:26 ` Alan Stern
2007-09-27 20:54 ` Steve Calfee
2007-09-27 21:16 ` Alan Stern
2007-09-27 21:37 ` U. George
2007-09-28 8:17 ` [linux-usb-devel] " Oliver Neukum
2007-09-28 15:01 ` Alan Stern
2007-09-28 8:22 ` [linux-usb-devel] " Oliver Neukum
2007-09-28 21:11 ` Alan Stern
2007-09-28 21:47 ` Oliver Neukum
2007-09-29 15:56 ` Alan Stern
2007-09-29 16:12 ` [linux-usb-devel] " Oliver Neukum
2007-09-28 9:04 ` Oliver Neukum
2007-09-28 15:07 ` Alan Stern
2007-09-28 21:33 ` [linux-usb-devel] " Oliver Neukum
2007-09-29 16:38 ` Alan Stern
2007-09-29 17:52 ` Oliver Neukum
2007-09-29 19:06 ` Alan Stern
2007-09-29 20:06 ` Oliver Neukum [this message]
2007-09-29 20:56 ` Alan Stern
2007-09-29 21:03 ` 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=200709292206.17377.oliver@neukum.org \
--to=oliver@neukum.org \
--cc=James.Bottomley@steeleye.com \
--cc=linux-scsi@vger.kernel.org \
--cc=linux-usb-devel@lists.sourceforge.net \
--cc=pavel@ucw.cz \
--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