Subject: Re: Bare tsleep in dev/ic/wdc.c
To: Constantine Sapuntzakis <csapuntz@stanford.edu>
From: Manuel Bouyer <bouyer@antioche.lip6.fr>
List: tech-kern
Date: 07/18/1999 18:30:36
On Sat, Jul 17, 1999 at 12:42:35PM -0700, Constantine Sapuntzakis wrote:
> 
> >From wdc.c, around line 1021:
> 
> 		if (wdc_c->flags & AT_WAIT) {
> 			tsleep(wdc_c, PRIBIO, "wdccmd", 0);
> 			ret = WDC_COMPLETE;
> 		} else {
> 
> 
> Shouldn't that be:
> 
> 		if (wdc_c->flags & AT_WAIT) {
> 			while (!(wdc_c->flags & AT_DONE)) {
> 				tsleep(wdc_c, PRIBIO, "wdccmd", 0); 
> 			}
> 			ret = WDC_COMPLETE;
> 		} else {
> 	
> to prevent spurious wakeups from causing premature returns? I ran into
> this problem on boot-up.

How can a spurious wakeup happen ? The only place where wakeup() is called
on wdc_c is in __wdccommand_done(), and AT_DONE is set before ...

I'm certainly missing something but I'd like to know what :)


--
Manuel Bouyer, LIP6, Universite Paris VI.           Manuel.Bouyer@lip6.fr
--