From owner-freebsd-bugs@FreeBSD.ORG Thu Jul 29 23:10:03 2010 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 91BA81065678 for ; Thu, 29 Jul 2010 23:10:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 5DDFB8FC18 for ; Thu, 29 Jul 2010 23:10:03 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id o6TNA39P026288 for ; Thu, 29 Jul 2010 23:10:03 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id o6TNA3ID026287; Thu, 29 Jul 2010 23:10:03 GMT (envelope-from gnats) Date: Thu, 29 Jul 2010 23:10:03 GMT Message-Id: <201007292310.o6TNA3ID026287@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Alexander Best Cc: Subject: Re: kern/140752: [ata] [patch] HDD power-off procedure is not clean X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Alexander Best List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jul 2010 23:10:03 -0000 The following reply was made to PR kern/140752; it has been noted by GNATS. From: Alexander Best 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 Date: 2010/3/6 Subject: Summary: Re: Spin down HDD after disk sync or before power off To: Oliver Fromme 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