Subject: Re: IDE standby timeout
To: Dave Sainty <>
From: Ken Hornstein <>
List: current-users
Date: 01/20/1999 11:38:16
(Okay, I'm behind).

>It's very cool being able to set IDE idle and standby time via the new
>atactl command (Thanks Ken).

You're welcome :-)

>But it's a pain that whenever you set the timeout on the drive, it
>also immediately takes the action, so setting the standby timeout will
>also immediately put the drive in standby mode.

As amazingly stupid as it sounds, yes, that's exactly how it works,
which just reinforces in my mind how stupid ATA/IDE is in general.
For example, you have one byte to set a timeout values.  The timeout
value table from the ATA draft shows this:

0x00		Timeout disabled
0x01-0xf0	(value * 5) secounds
0x0f1-0xfb	((value - 240) * 30) minutes
0xfc		21 minutes (huh?)
0xfd		Period between 8 and 12 hours (What??)
0xfe		Reserved
0xff		21 minutes 15 seconds (??What??)

The last 3 entries are what boggle my mind.  I simply cannot imagine
how they made it into a specification.

>Looking at a copy of the ATA-2 draft, this is exactly how it works,
>and you cannot set the timeout without the action.  I'm suspicious
>that this is a sneaky way to force the OS to do the work for any more
>complex scheme.

I personally think it's simply the stupidity of the ATA crowd in general,
but that's just me :-)

>That said, it may be beneficial for the drivers to eb aware of when
>the drive is in standby mode anyway, so it can perhaps spin it back up
>without generating an error:
>pciide0:0:0: Bus-Master DMA error: missing interrupt, status=0x21
>wd0a: DMA error reading fsbn 4127984 of 4127984-4127999 (wd0 bn 4128047; cn 4095 tn
> 4 sn 35), retrying
>wd0: soft error (corrected)

Well, we could simply convince Manuel to change the driver to "ignore" the
first missing interrupt error if it gets corrected the second time :-)

>What I would like to be able to do is change the timeout dynamically
>without the action taking effect immediately.  I would like the drive
>driver to track the idle time of the drive, and then if it reaches the
>specified timeout, issue the stadby command itself, rather than
>relying on the drive to do the job.

This is a good idea, and I thought about it myself.

If we did this, it would be applicable to SCSI drives as well, which
would be great.  And I _believe_ the that current disk statistics
is good enough to do a generic timeout mechanism (you could do it
in disk_busy() and disk_unbusy()).  So I think it's certainly possible
and maybe even desirable.  The downside is, of course, there's a lot of
work to do, because this involves changing the generic interface layer
(and I'm not sure yet what's a good way to communicate "sleeps" from
upper layers to lower ... and what if there are different kind of
sleep events?  ATA has several.)

In my defense, I think that atactl is still useful even if we had
this feature, as it turns out there are lot of things you can control
on ATA/IDE devices, so I don't consider it wasted work.