Subject: Re: kern/29600: cbb(4) hangs on boot
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: FUKAUMI Naoki <naoki@fukaumi.org>
List: netbsd-bugs
Date: 03/12/2005 07:56:02
The following reply was made to PR kern/29600; it has been noted by GNATS.

From: FUKAUMI Naoki <naoki@fukaumi.org>
To: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
Cc: fun@naobsd.org, gnats-bugs@netbsd.org
Subject: Re: kern/29600: cbb(4) hangs on boot
Date: Sat, 12 Mar 2005 16:55:46 +0900

 At Sat, 12 Mar 2005 16:09:49 +0900,
 YAMAMOTO Takashi wrote:
 > >  		microtime(&before);
 > >  		s = splbio();
 > > -		while (pwrcycle == sc->sc_pwrcycle)
 > > -			tsleep(&sc->sc_pwrcycle, PWAIT, "pccpwr", 0);
 > > +		/* XXX: Set timeout to 200ms because power cycle event will be
 > > +		   never happened when attaching 16-bit card. */
 > > +		error = tsleep(&sc->sc_pwrcycle, PWAIT, "pccpwr", hz/5);
 > >  		splx(s);
 > 
 > is there any reason not to check sc_pwrcycle?
 
 We don't have any reason to wait value is changed in while() loop.
 
 tsleep() will be awakened if power cycle event occured. There is no
 reason to check sc_pwrcycle value.
 
 We should not wait (forever!) because wake() is never occured in some
 situation. (e.g. Ricoh controller & 16-bit card)
 
 It doesn't need to do "sc->sc_pwrcycle++;" in pccbbintr(), too.
 I forgot to remove this line in my patch, sorry.
 
 Maybe, we can use sc or another variable/function pointer instead of
 &sc->sc_pwrcycle as tsleep() identifier. And we can remove sc_pwrcycle
 in struct pccbb_softc.
 
 Regards,
 
 --
 FUKAUMI Naoki