Subject: Re: test of new powerdown facility
To: Erik E. Fair <fair@clock.org>
From: Jason Thorpe <thorpej@nas.nasa.gov>
List: port-sparc
Date: 06/09/1998 10:36:33
[ I've CC'd tech-kern, because there is an MI kernel issue here.  Please
  direct all follow-ups to tech-kern.  --thorpej ]

On Tue, 9 Jun 1998 04:29:05 -0700 
 "Erik E. Fair" <fair@clock.org> wrote:

 > I tested the powerdown option to halt(8) this evening on my SPARC Classic
 > build system. It worked - the system powered down, with the word: "WAR" (I
 > think it was trying to say, "WARNING: cannot determine keyboard type"
 > because I use a serial console).

Cool!

 > Alas, it apparently did not allow enough time for the disks to flush before
 > removing power; fsck had some work to do on the root filesystem after
 > reboot, despite the "syncing disks ... done" message.

Ick :(

 > I hasten to point out that I have a Quantum Fireball 1080S in this beast,
 > and this may be a HDA cache-flush issue; Apple had this problem with these
 > disks a few years ago. Is there an explicit SCSI command to force a disk to
 > flush its cache to permanent storage?

I think there is, but I can't remember for certain... this would be good
for a shutdownhook... each SCSI disk could register one, and ensure that
it has flushed its cache.

The only worry would be to make sure that a device's shutdown hook runs
before its parent's shutdown hook runs (for obvious reasons).  While our
shutdown hook code does not actually enforce strict dependencies, it happens
to always work because shutdown hooks are added to the head of the list,
and children are always attached after a parent, so the last device attached
will be at the head of the list, and so on.

So, if there is indeed a "commit to stable storage" SCSI command, it should
be very straight-forward to implement such a shutdown hook.  Any takers?  :-)

Jason R. Thorpe                                       thorpej@nas.nasa.gov
NASA Ames Research Center                            Home: +1 408 866 1912
NAS: M/S 258-5                                       Work: +1 650 604 0935
Moffett Field, CA 94035                             Pager: +1 650 428 6939