Bug 15357 - hibernating wakes up sleeping harddrives
Summary: hibernating wakes up sleeping harddrives
Status: REOPENED
Alias: None
Product: IO/Storage
Classification: Unclassified
Component: Serial ATA (show other bugs)
Hardware: All Linux
: P1 low
Assignee: Jeff Garzik
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-02-19 13:10 UTC by znyqpcuq
Modified: 2016-03-19 17:01 UTC (History)
5 users (show)

See Also:
Kernel Version: 3.13
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description znyqpcuq 2010-02-19 13:10:21 UTC
i have two hdds in my system: one for normal work and a second one for backups.
the second harddrive is put to sleep after startup and is only accessed, when my automatic backup scripts work around midnight.
all partitions on aforesaid drive are unmounted, when it is not in use.

when i trigger hibernate, the typical cursor blinking starts and after a few seconds the second hard drive is waken up, all hibernation data is put on the other harddisk and the pc shuts down.
this wake up is clearly not related to the bios (there was a blacklisting patch to libata for a similar problem in 2008), but a kernel (libata? or other software) problem. something accesses the second harddrive in a way, that wakes it up unnecessarily, which potentially reduces its lifespan.

the harddrive in question is a seagate 7200.8 (ST3250823AS) and is attached to a ICH10 southbridge (8086:3a22) on my intel DG45ID mainboard. i use smartd to monitor the other hdd only. the kernel is a precompiled 2.6.32.8 vanilla AMD64 kernel (from http://kernel.ubuntu.com/~kernel-ppa/mainline/v2.6.32.8/), but the problem is not new/a regression. the system runs ubuntu 9.10. dmesg does not give any hints.

--
ameno
Comment 1 Tejun Heo 2010-02-23 02:17:20 UTC
Hmmm.... yeah, that's the drive waking up to process the drive shutdown sequence - FLUSH followed by STANDBY.  The driver has been intercepting command sequence and skipping those if the drive already seemed powered down in rather hacky way to work around buggy shutdown implementation.  The shutdown implementation has been updated and thus the hacky workaround code was removed last year.

The thing is that tracking device power state and buffer cleanliness from driver is messy and skipping FLUSH before cutting the power can be quite dangerous.  It would be ideal if the drive don't spin up if there's no data to flush but it seems many drives do.  At this point, I'm not quite sure what should be done about this.  I'll think more about it.

Thanks.
Comment 2 znyqpcuq 2010-02-26 14:04:43 UTC
and the reason why this does not happen on a normal shutdown is that then the driver is not responsible for flushing itself but userspace? (sorry for the stupid question, but i have no idea how this is implemented :)
Comment 3 Tejun Heo 2010-03-02 03:18:45 UTC
Hmmm.... not really, the sequence is about the same.  It issues FLUSH and then STANDBY.  So, even if the drive is in standby mode, it doesn't wake up during shutdown sequence?
Comment 4 znyqpcuq 2010-03-03 11:41:07 UTC
correct. im not sure it was like that in 2.6.32 (because i rarely shutdown), but it is for sure in 2.6.33 now. i tested it yesterday and i cant hear anything from the second hdd while shutting down, when it was in SLEEP mode before (hdparm -Y).
Comment 5 Tejun Heo 2010-03-03 11:50:23 UTC
Hmmm... Is the drive mounted?  If so, can you unmount it and see whether that makes any difference?

Thanks.
Comment 6 znyqpcuq 2010-03-03 20:26:01 UTC
the drive is never mounted, when i shutdown or hibernate.

the partition table looks like this:
Disk /dev/sdb: 250.1 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00049c61

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb2              32       30401   243947025   83  Linux

(i had a small partition in the beginning once and did not reclaim that space)
the entire sdb2 partition is a luks(dm)-encrypted ext3.
Comment 7 Phillip Susi 2013-11-10 02:25:06 UTC
From what I can see, when the drive is in STANDBY, it does not wake up, but in SLEEP, it does because the FLUSH and STANDBY can not be sent to the drive while it is in SLEEP mode.  My patches I posted to the mailing list recently fix this by faking the commands while the drive is in SLEEP mode.

http://marc.info/?l=linux-ide&m=138403101124092&w=2
Comment 8 Alan 2013-12-10 18:07:48 UTC
(if this is actually seen with a modern kernel please update the version!)
Comment 9 Phillip Susi 2013-12-10 18:22:36 UTC
As my recent comment indicated, it still applies to current git head and bugzilla won't let me edit the version or status.

Note You need to log in before you can comment on or make changes to this bug.