Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Jul 2010 23:10:03 GMT
From:      Alexander Best <arundel@freebsd.org>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: kern/140752: [ata] [patch] HDD power-off procedure is not clean
Message-ID:  <201007292310.o6TNA3ID026287@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/140752; it has been noted by GNATS.

From: Alexander Best <arundel@freebsd.org>
To: bug-followup@freebsd.org
Cc:  
Subject: Re: kern/140752: [ata] [patch] HDD power-off procedure is not clean
Date: Thu, 29 Jul 2010 23:03:14 +0000

 i'm forwarding this message i got from warren which might be helpful to anybody
 working on this pr in the future.
 
 cheers.
 alex
 
 ---------- Forwarded message ----------  
 From: Warren Block <wblock@wonkity.com>
 Date: 2010/3/6
 Subject: Summary: Re: Spin down HDD after disk sync or before power off
 To: Oliver Fromme <olli@lurza.secnetix.de>
 Cc: freebsd-hackers@freebsd.org, alexbestms@wwu.de, jkim@freebsd.org
 
 
 Just wanted to followup with a summary before all vestiges of what I learned evaporate from my memory.  My apologies for the lateness.
 
 1. Existing FreeBSD ata-disk code does not explicitly park the hard drive heads on shutdown.  So the power loss causes an emergency park, which sounds bad and is bad for the heads.
 
 2. There are a limited number of powerup/powerdown or maybe spinup/spindown cycles for a drive.  Not sure what causes the wear.
 
 3. FreeBSD doesn't park heads at reboot, either, but that's good because of #2.
 
 4. FreeBSD's suspend code does call STANDBY_IMMEDIATE to park heads.
 
 5. I couldn't tell if the STANDBY_IMMEDIATE in a reboot actually spun the drive down.  It may be that the hardware reset happens so quickly after the standby that it doesn't matter.  Or maybe it brakes very quietly.  Possibly different brands do different things.  I can think of ways to check, like measuring motor current, but don't have the equipment to try that.
 
 6. Ond?ej Majerech suggested checking NetBSD's method of spinning the drive down.  I did, and they have a direct way of telling the difference between reboot and shutdown, somewhat differently from FreeBSD.
 
 7. I actually waded hip-deep through magic C code and made a powerdown event handler for ata-disk.c.  It compiled and even seemed to work, although I don't trust it.
 
 8. Alexander Motin has an updated CAM version of the ATA system which will eventually replace the existing one.  In -CURRENT, anyway.  He was kind enough to look at my event handler.  My understanding is that he is looking at implementing the head parking/standby mechanism in that new code.
 
 Conclusions:
 
 If you rarely power down a system with FreeBSD, it may not matter, and reboots with the existing code should not be a problem.
 
 If you power down a system from FreeBSD often, the patch in http://docs.freebsd.org/cgi/getmsg.cgi?fetch=233916+0+archive/2010/freebsd-hackers/20100131.freebsd-hackers is still the lowest-impact version, although it calls STANDBY_IMMEDIATE for both reboot and shutdown.
 
 I don't have evidence either way as to whether the standby followed by a reboot causes as much wear as a cold spinup/spindown cycle, or whether that is more of a problem than emergency head parks.
 
 -Warren Block * Rapid City, South Dakota USA
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201007292310.o6TNA3ID026287>