From owner-freebsd-hackers@FreeBSD.ORG Fri Jan 29 22:38:54 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AAAC7106566C for ; Fri, 29 Jan 2010 22:38:54 +0000 (UTC) (envelope-from wblock@wonkity.com) Received: from wonkity.com (wonkity.com [67.158.26.137]) by mx1.freebsd.org (Postfix) with ESMTP id 458738FC18 for ; Fri, 29 Jan 2010 22:38:53 +0000 (UTC) Received: from wonkity.com (localhost [127.0.0.1]) by wonkity.com (8.14.3/8.14.3) with ESMTP id o0TMcrOM047233; Fri, 29 Jan 2010 15:38:53 -0700 (MST) (envelope-from wblock@wonkity.com) Received: from localhost (wblock@localhost) by wonkity.com (8.14.3/8.14.3/Submit) with ESMTP id o0TMcq5b047230; Fri, 29 Jan 2010 15:38:53 -0700 (MST) (envelope-from wblock@wonkity.com) Date: Fri, 29 Jan 2010 15:38:52 -0700 (MST) From: Warren Block To: Alexander Best In-Reply-To: Message-ID: References: User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.3 (wonkity.com [127.0.0.1]); Fri, 29 Jan 2010 15:38:53 -0700 (MST) Cc: freebsd-hackers@freebsd.org Subject: Re: Spin down HDD after disk sync or before power off X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Jan 2010 22:38:54 -0000 On Wed, 27 Jan 2010, Alexander Best wrote: > i believe the sound you hear is due to the emergency unload sequence. i'm not > 100% sure, but i think after applying the patch the sound is gone. i recently > replaced my old IDE hdd (which made a very loud "click!" during shutdown) with > a new SATA hdd. the new one is very quiet and so it's not that easy to > recognise any changes in the spin down procedure. > > would be very nice if you could try the patch on one of the notebooks you're > referring to in order to see if the patch makes a difference. Based on followups to this thread, here's the modified patch I've tested: --- sys/dev/ata/ata-disk.c.orig 2010-01-28 10:47:57.000000000 -0700 +++ sys/dev/ata/ata-disk.c 2010-01-28 11:49:32.000000000 -0700 @@ -191,6 +191,10 @@ { struct ata_device *atadev = device_get_softc(dev); + if (atadev->param.support.command2 & ATA_SUPPORT_POWERMGT) + ata_controlcmd(dev, ATA_STANDBY_IMMEDIATE, 0, 0, 0); + return 0; + if (atadev->param.support.command2 & ATA_SUPPORT_FLUSHCACHE) ata_controlcmd(dev, ATA_FLUSHCACHE, 0, 0, 0); return 0; This uses the POWERMGT bit and adds it before the existing code. On a desktop system with an 80G drive, it's hard to tell if there's an audible difference. On an Acer notebook with a WD drive, it does change the sound. Without the patch, the drive shutdown sounds like power has been pulled, with a GLINK! head park followed by a decreasing-pitch spindown whir. With the patch, there's a quieter glink with nearly no spindown whir. Because this is subjective, I recorded the shutdown sounds with a microphone underneath the notebook hard drive: http://wonkity.com/~wblock/sounds/unpatchedglink.wav http://wonkity.com/~wblock/sounds/patchedglink.wav Can't speak to the safety of this, but it definitely sounds better. -Warren Block * Rapid City, South Dakota USA