Date: Sun, 24 Oct 2010 19:47:57 +0300 From: Alexander Motin <mav@FreeBSD.org> To: Alexander Best <arundel@freebsd.org> Cc: freebsd-hackers@freebsd.org, Oliver Fromme <olli@lurza.secnetix.de>, freebsd-scsi@freebsd.org Subject: Re: Summary: Re: Spin down HDD after disk sync or before power off Message-ID: <4CC4633D.4070605@FreeBSD.org> In-Reply-To: <20101024011854.GB78293@freebsd.org> 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>
next in thread | previous in thread | raw e-mail | index | archive | help
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 <arundel@freebsd.org> 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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4CC4633D.4070605>