All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Bottomley <James.Bottomley@HansenPartnership.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: "Salyzyn, Mark" <mark_salyzyn@adaptec.com>,
	Matthew Wilcox <matthew@wil.cx>,
	Oliver Neukum <oliver@neukum.name>,
	SCSI development list <linux-scsi@vger.kernel.org>
Subject: RE: SCSI dynamic power management
Date: Tue, 20 Nov 2007 08:53:07 -0600	[thread overview]
Message-ID: <1195570387.3131.12.camel@localhost.localdomain> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0711191405160.3005-100000@iolanthe.rowland.org>


On Mon, 2007-11-19 at 14:16 -0500, Alan Stern wrote:
> On Mon, 19 Nov 2007, James Bottomley wrote:
> 
> > > Here's how it will work: scsi_prep_state_check() will see that the
> > > device is in a suspended state (probably a substate of SDEV_QUIESCE).  
> > > The return value will depend on the type of suspend:
> > > 
> > > 	For manual suspend or system suspend, the routine simply 
> > > 	returns BLKPREP_KILL.
> > > 
> > > 	For autosuspend, the routine will submit a workqueue request
> > > 	to autoresume the device and will return BLKPREP_DEFER.
> > > 
> > > The trick is somehow to allow the START-STOP UNIT commands get past 
> > > this filter.  Is this what the REQ_PREEMPT flag is intended for?
> > 
> > Um, that model is pretty host centric ... we wouldn't be able to use
> > that for power management of shared devices like SAS/SATA devices in an
> > expander or FC devices.  The basic problem with power management of
> > external devices (whether shared or not) is that it's not just what the
> > host did to them, it's also what the environment or administrator did to
> > them.
> 
> Well, think of this as "idle-device" management rather than power 
> management.

Sure ... but surely that's a subset of proper power management?

> It's no more host-centric than the existing code in sd_suspend().  
> When I mentioned sending START-STOP UNIT commands above, that was a bit
> sloppy.  What the code would actually do is call the high-level
> driver's suspend method, which would then send the appropriate commands
> to the device.  (Or maybe the code would simply call scsi_bus_suspend.)  
> If sending START-STOP UNIT during a suspend is host-centric then
> sd_suspend() is already guilty.

Ah, but if you look, sd_suspend by default doesn't do anything ... it
has to be enabled on a per device basis by the manage_start_stop
attribute ... that's precisely because we can't have the sd ULD idling a
SAN device when others are trying to use it.

> Regarding this thread's original question, the best idea I've come up
> with so far is to store an extra flag in the scsi_device structure
> indicating that a suspend or resume transition is underway.  When the
> flag is set, commands with REQ_PREEMPT would be accepted.  If the
> device is "suspended" and the flag is clear, then commands would be
> delayed or killed in the prep function regardless of REQ_PREEMPT.  This 
> scheme could potentially let unwanted commands go through, but I 
> haven't been able to think of anything more suitable.

I don't understand why you want to do this.  Power management is a
layered issue on SCSI, divided (as always) into host, device and
transport.  The idle you're talking about is a pure device thing, so it
can be managed by the ULD (and currently is).  When a unit is stopped,
it automatically returns correct NOT_READY sense to most commands.  The
sd_done post processing could decide to wake the device and retry or
return an error without ever troubling the mid layer or even block for
anything.    All the hooks are already in sd, why does this now need to
go into block (unless there's some longer scheme for incorporating the
transport and other elements into this?)

James



  parent reply	other threads:[~2007-11-20 14:53 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-19 15:36 SCSI dynamic power management Alan Stern
2007-11-19 15:46 ` Matthew Wilcox
2007-11-19 15:57   ` Alan Stern
2007-11-19 16:14     ` Salyzyn, Mark
2007-11-19 16:46       ` Alan Stern
2007-11-19 16:53         ` James Bottomley
2007-11-19 19:16           ` Alan Stern
2007-11-19 19:18             ` Matthew Wilcox
2007-11-19 19:48               ` Alan Stern
2007-11-20 14:53             ` James Bottomley [this message]
2007-11-20 15:07               ` Oliver Neukum
2007-11-20 15:21                 ` James Bottomley
2007-11-20 15:36                   ` Oliver Neukum
2007-11-20 15:42                     ` James Bottomley
2007-11-20 16:02                       ` Alan Stern
2007-11-20 16:15                         ` James Bottomley
2007-11-20 19:03                           ` Alan Stern
2007-11-21 12:56     ` Jens Axboe
2007-11-20 14:38 ` Douglas Gilbert
2007-11-20 15:49   ` Alan Stern
     [not found] <4741AFEA.8000408@emulex.com>
2007-11-19 16:00 ` Alan Stern

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=1195570387.3131.12.camel@localhost.localdomain \
    --to=james.bottomley@hansenpartnership.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mark_salyzyn@adaptec.com \
    --cc=matthew@wil.cx \
    --cc=oliver@neukum.name \
    --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 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.