Skip to contentSkip to conversation

Disk shock protection interferes with standby timers, please advise

DISCUSSION Elias Oltmanns 2 participants 3 messages Mar 6, 2013 – May 9, 2014 libata

lore
Share & tools
lore
#0 lore raw

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

#1 lore raw

Hi,

Quoted 9 lines · Elias Oltmanns

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,

Signature · 1 line
Tomáš Janoušek, a.k.a. Liskni_si, http://work.lisk.in/
#2 lore raw
Quoted 12 lines · Tomáš Janoušek

Hi,

Quoted 9 lines · Elias Oltmanns

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.

Quoted 4 lines

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