linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <htejun@gmail.com>
To: Jeff Garzik <jeff@garzik.org>, Mark Lord <lkml@rtr.ca>,
	hancockr@shaw.ca, cebbert@redhat.com,
	Alan Cox <alan@lxorguk.ukuu.org.uk>,
	emisca.ml@gmail.com,
	IDE/ATA development list <linux-ide@vger.kernel.org>,
	Stephen.Clark@seclark.us, fabio.comolli@gmail.com,
	a.p.zijlstra@chello.nl
Subject: [PATCHSET] libata: reimplement suspend/resume support and fix spindown on poweroff
Date: Fri, 04 May 2007 21:26:36 +0200	[thread overview]
Message-ID: <463B88EC.1080304@gmail.com> (raw)

Hello,

This is another take at using sdev->manage_start_stop to reimplement
suspend/resume and fix spindown on poweroff.  As Robert pointed out in
the other thread[1], sadly, ATA spec does NOT require cache flush on
standby and some distros don't flush cache prior to put the drive into
standby mode during shutdown.  This means that we can't skip cache flush
in the kernel shutdown path because data loss is possible.  Also, we
just can't switch to new method because there are drives which spin up
if told to spin down while it's already spun down.

So, that leaves us with migrating to new behavior (kernel side
sync/shutdown) while maintaining backward compatibility.  This patchset
tries to do that by supplying a scheduled-to-be-removed module parameter
libata.spindown_compat which defaults to 1.  When set, it makes libata
skip spindown during shutdown sequence thus maintaining the old behavior
of issuing only cache flush on shutdown.

So, distros should update their shutdown(8) to do the followings.

  * Check whether /sys/modules/libata/parameters/spindown_compat
    exists.  If it does, write 0 to it.

  * For each libata harddisk {
	* Check whether /sys/class/scsi_disk/h:c:i:l/manage_start_stop
	  exists.  Iff it doesn't, synchronize cache and spin the disk
	  down as before.
  }

If shutdown(8) does the above, nothing will change on older kernels
(some drives will spin up and have to do emergency unload but they
aren't too many) and everything should work properly on kernels with
spindown_compat or later ones which won't have it.  If shutdown(8) isn't
updated, the kernel will behave the same way as older kernels would.

To accelerate userland update, if shutdown(8) isn't updated
(spindown_compat not cleared), libata will complain loudly about it,
point the user to http://linux-ata.org/shutdown.html (which should be
written) and pause for 5 seconds during shutdown.  Hopefully, this makes
the users bug distros sufficiently so that userland tools can be updated
quickly.  Note that the pausing happens only during shutdown not during
reboot or suspend, so it shouldn't be too much of annoyance.

This change requires sdev->manage_start_stop updates from scsi-misc-2.6.
 The merged git tree can be found at...

  http://htj.dyndns.org/git/?p=libata-tj.git;a=shortlog;h=spindown
  git://htj.dyndns.org/libata-tj spindown

Thanks.

-- 
tejun

[1] http://thread.gmane.org/gmane.linux.ide/18167

             reply	other threads:[~2007-05-04 19:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-04 19:26 Tejun Heo [this message]
2007-05-04 19:27 ` [PATCH 1/2] libata: reimplement suspend/resume support using sdev->manage_start_stop Tejun Heo
2007-05-10  1:42   ` Jeff Garzik
2007-05-11 12:09     ` Tejun Heo
2007-05-11 20:39       ` Jeff Garzik
2007-05-04 19:28 ` [PATCH 2/2] libata: implement libata.spindown_compat Tejun Heo
2007-05-06 20:11 ` [PATCHSET] libata: reimplement suspend/resume support and fix spindown on poweroff Fabio Comolli
2007-05-06 20:24   ` Tejun Heo
2007-05-06 21:29   ` Fabio Comolli

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=463B88EC.1080304@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=linux-ide@vger.kernel.org \
    --cc=lkml@rtr.ca \
    /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).