linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Elias Oltmanns <eo@nebensachen.de>
To: Tejun Heo <tj@kernel.org>, Jeff Garzik <jgarzik@pobox.com>,
	Aaron Lu <aaron.lu@intel.com>
Cc: linux-ide@vger.kernel.org, "Tomáš Janoušek" <tomi@nomi.cz>
Subject: Disk shock protection interferes with standby timers, please advise
Date: Thu, 07 Mar 2013 00:16:00 +0100	[thread overview]
Message-ID: <876214glvz.fsf@denkblock.local> (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

             reply	other threads:[~2013-03-06 23:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-06 23:16 Elias Oltmanns [this message]
2014-05-03 21:21 ` Disk shock protection interferes with standby timers, please advise Tomáš Janoušek
2014-05-09  7:07   ` Elias Oltmanns

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=876214glvz.fsf@denkblock.local \
    --to=eo@nebensachen.de \
    --cc=aaron.lu@intel.com \
    --cc=jgarzik@pobox.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=tj@kernel.org \
    --cc=tomi@nomi.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).