linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHSET] libata: reimplement suspend/resume support and fix spindown on poweroff
@ 2007-05-04 19:26 Tejun Heo
  2007-05-04 19:27 ` [PATCH 1/2] libata: reimplement suspend/resume support using sdev->manage_start_stop Tejun Heo
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Tejun Heo @ 2007-05-04 19:26 UTC (permalink / raw)
  To: Jeff Garzik, Mark Lord, hancockr, cebbert, Alan Cox, emisca.ml,
	IDE/ATA development list, Stephen.Clark, fabio.comolli,
	a.p.zijlstra

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2007-05-11 20:39 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-04 19:26 [PATCHSET] libata: reimplement suspend/resume support and fix spindown on poweroff Tejun Heo
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

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).