Subject: Re: ltsleep while cold
To: Jason Thorpe <thorpej@shagadelic.org>
From: john heasley <heas@shrubbery.net>
List: tech-kern
Date: 02/02/2005 14:59:10
Wed, Feb 02, 2005 at 02:51:57PM -0800, Jason Thorpe:
> 
> On Feb 2, 2005, at 12:14 PM, Martin Husemann wrote:
> 
> >        /* the wakeup for this is in kbd_was_reset(). */
> >        error = tsleep((caddr_t)&ks->kbd_id, PZERO | PCATCH, devopn, 
> >hz);
> >
> >While cold, the (l)tsleep does only bounce spl to give interrupts a 
> >chance,
> >but does not cause any serious delay.
> >
> >Now there are several ways to work around/fix this:
> >
> > 1) remove the wakeup, adjust spl() and just turn the tsleep into a 
> >delay(),
> >    then restore spl.
> 
> Is there actually a wakeup() for this?  If so, then it must be testing 
> some condition.  The "after tsleep" case should also test the same 
> condition, to guard against spurious wakeups.

there is a wakeup.  a for() loop for N retries plus a value that the reset
code handler can use to indicate that it received a response which may be
that the keyboard failed it's self-test would be a good solution.

side note, the tsleep should timeout after KBD_RESET_TIMO (ms), not hz.