Subject: Re: how to spin down a harddisk?
To: None <hubert.feyrer@informatik.fh-regensburg.de, port-i386@netbsd.org,>
From: Thor Lancelot Simon <tls@rek.tjls.com>
List: port-i386
Date: 08/01/2000 22:34:39
On Wed, Aug 02, 2000 at 04:15:16AM +0200, Hubert Feyrer wrote:
> On Tue, 1 Aug 2000, Manuel Bouyer wrote:
> > > in my notebook's /etc/apm/battery file, I run "atactl wd0 setidle 60".
> > > Now whenever the drive spins down, I see this on the console:
> > > 
> > > pciide0:0:0: lost interrupt
> > >         type: ata tc_bcount: 0 tc_skip: 0
> > > pciide0:0:0: intr with DRQ (st=0x58)
> > > wd0: transfer error, downgrading to Ultra-DMA mode 1
> > > wd0(pciide0:0:0): using PIO mode 4, Ultra-DMA mode 1 (using DMA data
> > > transfers)
> > > wd0a: device timeout writing fsbn 7515682 of 7515682-7515683 (wd0 bn
> > > 11708647; cn 11615 tn 11 sn 34), retrying
> > > wd0: soft error (corrected)
> > > 
> > > I could ignore the text, but the annoying thing is that this is also
> > > logged via syslog, and for that the drive needs spinning up again.
> > > The effect is that the drive spins up immediately after it's spun
> > > down. 
> > > 
> > > Is there a known cure to this problem?
> > 
> > The drive spins up to write something ... make sure you don't have anything
> > that writes to a file every minutes.
> 
> What it writes is the above error to syslog. It doesn't matter which time
> intercal I choose, it'll always spin down, and ~immediately spin up again.
> Given that we intentionally spin the drive down, couldn't we just inhibit
> the above errors?

Actually, I think there's a more serious bug here.

Since *we told* the hard disk to spin down, the fact that it's not ready the
next time we issue it a command shouldn't be an error.  Certainly, it should
not cause the DMA/PIO modes to be adjusted.  It seems to me we either need
to explicitly tell the drive to spin up, or if we can't do that, ignore the
fact that it's not ready so long as the first command we hand it after we
spin it down completes successfully within a reasonable timeout, where
"reasonable" takes into account that the drive had to spin up first.

-- 
Thor Lancelot Simon	                                      tls@rek.tjls.com
	"And where do all these highways go, now that we are free?"