linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Disk shock protection interferes with standby timers, please advise
@ 2013-03-06 23:16 Elias Oltmanns
  2014-05-03 21:21 ` Tomáš Janoušek
  0 siblings, 1 reply; 3+ messages in thread
From: Elias Oltmanns @ 2013-03-06 23:16 UTC (permalink / raw)
  To: Tejun Heo, Jeff Garzik, Aaron Lu; +Cc: linux-ide, Tomáš Janoušek

Hi there,

Tomás Janousek has reported that the standby timer of his notebook hd is
not properly reenabled after a shock protection event. This is the
scenario:
1. Standby timer is initialised using hdparm -S ... and everything works
   as expected.
2. Until disk heads are being unloaded due to a shock protection event.
   Standby is prevented for as long as the request to unload_heads had
   indicated – still as expected.
3. The current implementation of shock protection issues a Check Power
   Mode command once the imminent danger is over. This was meant
   specifically to reenable the standby timer and used to work on the
   Hitachi drive I used for testing at the time. Alas, for some drives,
   including a Western Digital I have here at my disposal, that is not
   enough and they keep spinning until any command *but* Check Power
   Mode or Idle Immediate with Unload Feature is received.

Now, the ATA7 spec states that after receiving an Idle Immediate with
Unload Feature (section 6.20.10):

--8<---------------cut here---------------start------------->8---
The device shall stay at Low Power Idle mode, shall not go into Standby
mode and shall not load the head(s) onto the media until receiving a new
command.
[...]
The device shall retain data
in the write cache and resume writing the cached data onto the media
after receiving a Software Reset, a Hardware Reset, or any new command
except Idle Immediate with Unload Feature.
--8<---------------cut here---------------end--------------->8---

But then it says about the Check Power Mode command (section 6.8.8):

--8<---------------cut here---------------start------------->8---
The Check Power Mode command shall not cause the device to change power
or affect the operation of the Standby timer.
--8<---------------cut here---------------end--------------->8---

Hence, we should issue another command when the drive is not in standby
already in order to reenable the standby timer. Tomás suggested issuing
an Idle Immediate when Check Power Mode indicates that the disk is not
in standby already. Most obligingly, he even provided a patch to be
found at
<https://github.com/liskin/patches/blob/master/hacks/linux-3.3_hdaps-unprevent-standby.patch>.

My WD drive, however, gives a distinctly audible click when Idle
Immediate is issued after an Idle Immediate with Unload Feature. I rather
suspect that the heads are actively loaded again, which is undesirable.
This can easily be tested, even without applying Tomás' patch, by
executing the following commands:

# hdparm -S 1 /dev/sda
[disk spins down after 5 seconds]
# hdparm --idle-immediate /dev/sda
[spins up again]
# hdparm --idle-unload /dev/sda
[keeps spinning until another command reaches disk, reenabling standby timer]
# hdparm -C /dev/sda
[reenables standby timer depending on disk model/manufacturer]
# hdparm --idle-immediate /dev/sda
[definitely reenables standby timer but also loads heads (click sound)]

On the other hand,

# hdparm -I /dev/sda

also reenables the standby timer yet leaves the heads alone. So my
question is this: Can anyone give some advice as to what command what be
suitable to be issued instead of Idle Immediate when the shock
protection timeout has elapsed? Basically, it should be cheap, cause no
“mechanical action”, and be anything *but* Check Power Mode.

Thanks for your help in advance,

Elias

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

* Re: Disk shock protection interferes with standby timers, please advise
  2013-03-06 23:16 Disk shock protection interferes with standby timers, please advise Elias Oltmanns
@ 2014-05-03 21:21 ` Tomáš Janoušek
  2014-05-09  7:07   ` Elias Oltmanns
  0 siblings, 1 reply; 3+ messages in thread
From: Tomáš Janoušek @ 2014-05-03 21:21 UTC (permalink / raw)
  To: Elias Oltmanns; +Cc: Tejun Heo, Jeff Garzik, Aaron Lu, linux-ide

Hi,

On Thu, Mar 07, 2013 at 12:16:00AM +0100, Elias Oltmanns wrote:
> On the other hand,
> 
> # hdparm -I /dev/sda
> 
> also reenables the standby timer yet leaves the heads alone. So my
> question is this: Can anyone give some advice as to what command what be
> suitable to be issued instead of Idle Immediate when the shock
> protection timeout has elapsed? Basically, it should be cheap, cause no
> “mechanical action”, and be anything *but* Check Power Mode.

Well, it does not reenable the standby timer on my ST9500420AS drive, so that
isn't a universal solution either.  And since so few people care about this
problem, this doesn't seem to be worth a quirk database or something like
that.  I'll just keep applying the patch, then.  :-)

Regards,
-- 
Tomáš Janoušek, a.k.a. Liskni_si, http://work.lisk.in/

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

* Re: Disk shock protection interferes with standby timers, please advise
  2014-05-03 21:21 ` Tomáš Janoušek
@ 2014-05-09  7:07   ` Elias Oltmanns
  0 siblings, 0 replies; 3+ messages in thread
From: Elias Oltmanns @ 2014-05-09  7:07 UTC (permalink / raw)
  To: Tomáš Janoušek; +Cc: Tejun Heo, Jeff Garzik, Aaron Lu, linux-ide

On 03 May 2014, Tomáš Janoušek wrote:
> Hi,
> On Thu, Mar 07, 2013 at 12:16:00AM +0100, Elias Oltmanns wrote:
>> On the other hand,
>> 
>> # hdparm -I /dev/sda
>> 
>> also reenables the standby timer yet leaves the heads alone. So my
>> question is this: Can anyone give some advice as to what command what be
>> suitable to be issued instead of Idle Immediate when the shock
>> protection timeout has elapsed? Basically, it should be cheap, cause no
>> “mechanical action”, and be anything *but* Check Power Mode.
> 
> Well, it does not reenable the standby timer on my ST9500420AS drive, so that
> isn't a universal solution either.  And since so few people care about this
> problem, this doesn't seem to be worth a quirk database or something like
> that.  I'll just keep applying the patch, then.  :-)

It might be an idea to raise this issue with Peter FP Zhang from Lenovo
who is actively participating in discussions on the linux thinkpad
mailing list. May be, he can ask the right people what command sequence
is used by the Windows driver on those newer machines, but then, may be
not. Unfortunately, I haven't got the resources to follow up on this
right now.

Regards,

Elias

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

end of thread, other threads:[~2014-05-09  7:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-06 23:16 Disk shock protection interferes with standby timers, please advise Elias Oltmanns
2014-05-03 21:21 ` Tomáš Janoušek
2014-05-09  7:07   ` Elias Oltmanns

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