From owner-freebsd-scsi@FreeBSD.ORG Sun Oct 24 17:17:23 2010 Return-Path: Delivered-To: freebsd-scsi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 586BF106566B for ; Sun, 24 Oct 2010 17:17:23 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-fx0-f54.google.com (mail-fx0-f54.google.com [209.85.161.54]) by mx1.freebsd.org (Postfix) with ESMTP id D2EDD8FC20 for ; Sun, 24 Oct 2010 17:17:22 +0000 (UTC) Received: by fxm17 with SMTP id 17so2187275fxm.13 for ; Sun, 24 Oct 2010 10:17:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :x-enigmail-version:content-type; bh=8HbT/8wjLYDKQ4gbAw/dwjwKz7rZmFdieUsSTG73IpE=; b=w6lXSgoQzN8RkQhyRDVAjJ2QTpb3b+yLgScLUjwONxXXBakfK13UY+6fD3uG32xbg9 JNu9yCCRoq1omFD6n4qEiTqzF3bV1/amQSS+QBQRBbFUdpPkcqMYs4Ue9eplP43IVkrr 8/SzMnrLHcOgyyAmM9SvLt9Gwbc2qnXHc+4TI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:x-enigmail-version:content-type; b=nEFAECasUY1fCNa00NmndSuV8QiOCZvCIvovvbJ2hOp2uAFQ5smF1BPZ/lcFbj0/oW YX43BZNSRHBm3G9Ean2fJ+/qrDtE7Za27A6A9mkCbtUo1qM70Ns2EUNnyzxeUiHo12h7 sYcET1xYb6qiGY8PkGQ20iSzNVLFW+bW6DbTw= Received: by 10.102.247.20 with SMTP id u20mr3526997muh.34.1287938881818; Sun, 24 Oct 2010 09:48:01 -0700 (PDT) Received: from mavbook2.mavhome.dp.ua (pc.mavhome.dp.ua [212.86.226.226]) by mx.google.com with ESMTPS id a25sm2437595fab.13.2010.10.24.09.47.59 (version=SSLv3 cipher=RC4-MD5); Sun, 24 Oct 2010 09:48:00 -0700 (PDT) Sender: Alexander Motin Message-ID: <4CC4633D.4070605@FreeBSD.org> Date: Sun, 24 Oct 2010 19:47:57 +0300 From: Alexander Motin User-Agent: Thunderbird 2.0.0.23 (X11/20091212) MIME-Version: 1.0 To: Alexander Best References: <201009161742.24228.tijl@coosemans.org> <201009161619.o8GGJAmv035378@lurza.secnetix.de> <20101018155944.GA12425@freebsd.org> <868w1r92rf.fsf@ds4.des.no> <20101021122110.GA65490@freebsd.org> <86zku77mj6.fsf@ds4.des.no> <20101021130730.GA72290@freebsd.org> <86r5fj7gin.fsf@ds4.des.no> <20101024011854.GB78293@freebsd.org> In-Reply-To: <20101024011854.GB78293@freebsd.org> X-Enigmail-Version: 0.96.0 Content-Type: multipart/mixed; boundary="------------030609010706040704060309" Cc: freebsd-hackers@freebsd.org, Oliver Fromme , freebsd-scsi@freebsd.org Subject: Re: Summary: Re: Spin down HDD after disk sync or before power off X-BeenThere: freebsd-scsi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SCSI subsystem List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Oct 2010 17:17:23 -0000 This is a multi-part message in MIME format. --------------030609010706040704060309 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 8bit Alexander Best wrote: > On Thu Oct 21 10, Dag-Erling Smørgrav wrote: >> Alexander Best writes: >>> no need to get upset. you asked where i found the information regarding the >>> wear impact of spinning down disks and i gave you the answer. >> I am upset by your claim that "doing spin downs upon reboot might be >> even worse than not doing spindowns upon shutdown", because you should >> know better, and following your advice could damage people's hardware. > > well...since currently hdds don't spindown during shutdown the current behavior > is in fact damaging hardware. i don't quite understand why this hasn't been > fixed yet. the patch is available and known to work. it won't cause any > problems with SCSI devices like mav's current implementation, since the > spindown code is limited to ATA devices. > > instead of talking and talking somebody should drop the changes into HEAD! Comparing two ways implementing spindown, I've recalled that both of them using xpt_polled_action() method, which depends on working controller polling operation. So they could be almost equaly not good. But the method present in HEAD now is more universal. Looking on fact that need of spindown is not so obvious for SCSI devices (in SAN environments), we can just make kern.cam.power_down tunable a bitmask of supported protocols for now. Patch is attached. But there is still question that stops me from going one way or another now. Where all this this things should be done properly: in peripheral driver, as proposed (then it have to be duplicated in da and ada drivers and possibly some others), or at the transport level, as present, independent from drivers? I am not sure, but have feeling that tape drives (for example) may also benefit from head parking before powering down. -- Alexander Motin --------------030609010706040704060309 Content-Type: text/plain; name="spindown3.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="spindown3.patch" --- cam_xpt.c.prev 2010-09-22 07:52:38.000000000 +0300 +++ cam_xpt.c 2010-10-24 18:50:13.000000000 +0300 @@ -153,7 +153,7 @@ static struct xpt_softc xsoftc; TUNABLE_INT("kern.cam.boot_delay", &xsoftc.boot_delay); SYSCTL_INT(_kern_cam, OID_AUTO, boot_delay, CTLFLAG_RDTUN, &xsoftc.boot_delay, 0, "Bus registration wait time"); -static int xpt_power_down = 0; +static int xpt_power_down = 1; TUNABLE_INT("kern.cam.power_down", &xpt_power_down); SYSCTL_INT(_kern_cam, OID_AUTO, power_down, CTLFLAG_RW, &xpt_power_down, 0, "Power down devices on shutdown"); @@ -4646,11 +4646,16 @@ xpt_shutdown_dev(struct cam_ed *device, return (1); if (device->protocol == PROTO_ATA) { + if ((xpt_power_down & 1) == 0) + return (1); /* Only power down device if it supports power management. */ if ((device->ident_data.support.command1 & ATA_SUPPORT_POWERMGT) == 0) return (1); - } else if (device->protocol != PROTO_SCSI) + } else if (device->protocol == PROTO_SCSI) { + if ((xpt_power_down & 2) == 0) + return (1); + } else return (1); xpt_compile_path(&path, --------------030609010706040704060309--