linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <htejun@gmail.com>
To: Robert Hancock <hancockr@shaw.ca>
Cc: Jeff Garzik <jeff@garzik.org>,
	liml@rtr.ca, cebbert@redhat.com,
	Alan Cox <alan@lxorguk.ukuu.org.uk>,
	emisca.ml@gmail.com, linux-ide@vger.kernel.org,
	Stephen.Clark@seclark.us, fabio.comolli@gmail.com,
	a.p.zijlstra@chello.nl
Subject: Re: [PATCH] libata: skip FLUSH and STADNBYNOW1 during shutdown if device is already spun down
Date: Tue, 24 Apr 2007 11:22:00 +0900	[thread overview]
Message-ID: <462D69C8.5050201@gmail.com> (raw)
In-Reply-To: <462D4041.7030508@shaw.ca>

Robert Hancock wrote:
>> This patch makes libata skip FLUSH and STANDBYNOW1 during shutdown if
>> the drive is already spun down.  Note that whether FLUSH has been
>> performed is not checked.  This is because some userland shutdown(8)'s
>> only do STANDBYNOW1.  Transition to standby mode implies cache flush,
>> so this should be safe.
> 
> Are we sure this is true in all cases? The ATA spec doesn't explicitly
> say that STANDBY IMMEDIATE implies a cache flush. Granted it would be
> retarded for a drive to spin itself down with data still pending in the
> write cache, but firmware people have done some strange things..

I was somehow thinking the ATA spec requires cache flush on entering
STANDBY.  Can't find anything about it now, which means shutdown(8) on
my debian is broken.  :-(

>> +    /* Set spundown status.  Some userland tools use STANDBY
>> +     * instead of STANDBYNOW1.  Take both into account.
>> +     */
>> +    if (unlikely(qc->tf.command == ATA_CMD_STANDBY ||
>> +             qc->tf.command == ATA_CMD_STANDBYNOW1))
>> +        adev->flags |= ATA_DFLAG_SPUNDOWN;
> 
> Is checking for STANDBY really valid here? STANDBY does not do an
> immediate entry to standby mode, it only sets the standby timer.
> Therefore just because userspace issued a standby command, does not mean
> the drive is really spun down currently.

Heh heh, got you.  STANDBY does put the device into STANDBY mode
immediately.  It's STANDBY_IMMEDIATE + timer adjustment.

> Could we use CHECK POWER MODE to see if the drive is currently spun down
> rather than tracking whether a standby was already issued? That would
> handle the case above as well, we could tell if the drive had actually
> spun down on a timer or not.

Thought about that but that would require passing shutdown
STANDBY_IMMEDIATE to EH and do multi command sequence there.  It can be
done but I think it's too complex.

Gee...  We're in trouble.  It's just too dangerous to skip FLUSH if
STANDBY doesn't imply FLUSH and some dists don't do FLUSH in front of
STANDBY.  I think the best way would be implementing the original compat
kernel parameter and printing big fat warning message to tell the user
that their shutdown(8) needs to be updated.  Any better ideas?

-- 
tejun

      reply	other threads:[~2007-04-24  2:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-23 19:12 [PATCH 1/2] libata: reimplement suspend/resume support using sdev->manage_start_stop Tejun Heo
2007-04-23 19:12 ` [PATCH] libata: skip FLUSH and STADNBYNOW1 during shutdown if device is already spun down Tejun Heo
2007-04-23 23:24   ` Robert Hancock
2007-04-24  2:22     ` Tejun Heo [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=462D69C8.5050201@gmail.com \
    --to=htejun@gmail.com \
    --cc=Stephen.Clark@seclark.us \
    --cc=a.p.zijlstra@chello.nl \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=cebbert@redhat.com \
    --cc=emisca.ml@gmail.com \
    --cc=fabio.comolli@gmail.com \
    --cc=hancockr@shaw.ca \
    --cc=jeff@garzik.org \
    --cc=liml@rtr.ca \
    --cc=linux-ide@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).