Disk spin down issue on shut down/suspend to disk
Quoted 16 lines · Tejun Heo
Quoted 15 lines · Mark Lord
Heh.. I haven't instrumented it yet, but I did discover a bit more about it:
The Power-Off_Retract_Count incrmenents *only* when there's data in the on-drive write-cache. So if I haven't written anything significantly large before suspending, then it often does NOT increment the retract counter.
But if I copy a couple of multi-MB files around and then suspend (to RAM), the retract count gets incremented.
So I've now just stuck "hdparm -F
/dev/sda" into my suspend script, and that cures the problem completely for me. "-F" does aFLUSH_CACHE, and requires a recent copy of hdparm.
Quoted 8 lines
Quoted 5 lines
Perhaps libata should also do a
FLUSH_CACHEbefore any STANDBYNOW command, prior to entering STR, which is what my script is currently now doing..I'll instrument libata and see what the current sequence is.
Hmmmm.. libata should issue FLUSH CACHE on STR too.
sd_suspend()andsd_shutdown()are pretty similar after all.
IMHO, this is a mess because we are essentially trying to work around firmware bugs, which may only be solved by having the kernel load a user-supplied shutdown sequence, instead of hardcoding it into the kernel.
Thanks!
--
Al