Subject: Re: kern/37508: After jmcneill-pm, disks are switched to standby before rebooting
To: None <joerg@NetBSD.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org,>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: netbsd-bugs
Date: 12/10/2007 16:50:02
The following reply was made to PR kern/37508; it has been noted by GNATS.

From: Manuel Bouyer <bouyer@antioche.eu.org>
To: Juan RP <juan@xtrarom.org>
Cc: gnats-bugs@NetBSD.org
Subject: Re: kern/37508: After jmcneill-pm, disks are switched to standby before rebooting
Date: Mon, 10 Dec 2007 17:46:09 +0100

 On Mon, Dec 10, 2007 at 05:32:54PM +0100, Juan RP wrote:
 > On Mon, 10 Dec 2007 16:23:59 +0100
 > Manuel Bouyer <bouyer@antioche.eu.org> wrote:
 > 
 > > On Sun, Dec 09, 2007 at 09:35:00PM +0000, juan@xtrarom.org wrote:
 > > > >Number:         37508
 > > > >Category:       kern
 > > > >Synopsis:       After jmcneill-pm, disks are switched to standby before rebooting
 > > > >Confidential:   no
 > > > >Severity:       serious
 > > > >Priority:       high
 > > > >Responsible:    kern-bug-people
 > > > >State:          open
 > > > >Class:          sw-bug
 > > > >Submitter-Id:   net
 > > > >Arrival-Date:   Sun Dec 09 21:35:00 +0000 2007
 > > > >Originator:     juan@xtrarom.org
 > > > >Release:        NetBSD 4.99.41
 > > > >Organization:
 > > > Juan Romero Pardines	- The NetBSD Project
 > > > http://plog.xtrarom.org	- NetBSD/pkgsrc news in Spanish
 > > > >Environment:
 > > > System: NetBSD sasha 4.99.41 NetBSD 4.99.41 (Nocturno-nodbg) #70: Sun Dec 9 22:24:17 CET 2007 juan@sasha:/home/juan/build/i386/obj/sys/arch/i386/compile/Nocturno-nodbg i386
 > > > Architecture: i386
 > > > Machine: i386
 > > > >Description:
 > > > 
 > > > 	After the jmcneill-pm branch has been merged in, issuing a reboot
 > > > 	call will switch the IDE disks to standby/sleep mode before the system
 > > > 	is rebooted... that's unacceptable for me because that means a longer
 > > > 	time in the BIOS that is waiting for disk initialization.
 > > 
 > > That's also inacceptable because this means shortened life for the
 > > disks. They have a limited start/stop cycle count, and for some of them
 > > (the older ones, or some of the ones designed for 24x7 usage) it isn't that
 > > high. 
 > 
 > So the driver now does:
 > 
 > +static bool
 > +wd_suspend(device_t dv)
 > +{
 > +       struct wd_softc *sc = device_private(dv);
 > +
 > +       wd_flushcache(sc, AT_WAIT | AT_POLL);
 > +       wd_standby(sc, AT_WAIT | AT_POLL);
 > +
 > +       return true;
 >  }
 > 
 > This would be ok when you are suspending/resuming but not when rebooting or
 > powering down the system!
 
 It may be OK for a power down (there is even a PR for this: kern/32766:
 some macppc systems rely on the system doing the wd_standby() before powering
 down, the firmware doesn't do it). But it's definitively not OK
 for a reboot, or a halt without power down.
 
 From the discussion about the PR mentionned above, it came that we should
 not spin down a drive on reboot or halt without -p, and an extra argument to
 the PM callbacks is needed. 
 
 -- 
 Manuel Bouyer, LIP6, Universite Paris VI.           Manuel.Bouyer@lip6.fr
      NetBSD: 26 ans d'experience feront toujours la difference
 --