Subject: Re: couldn't ping cpus
To: Manuel Bouyer <bouyer@antioche.lip6.fr>
From: Jason R Thorpe <thorpej@wasabisystems.com>
List: port-sparc
Date: 01/20/2003 08:30:55
On Mon, Jan 20, 2003 at 03:19:48PM +0100, Manuel Bouyer wrote:

 > On Mon, Jan 20, 2003 at 02:21:53AM +0100, Paul Kranenburg wrote:
 > > > Can't the second trace give a hint ?
 > > 
 > > Yes.. it's kqueue_scan() entering tsleep() at splhigh(). It shouldn't
 > > be doing that.
 > 
 > Sure. I added a splx(s) before the tsleep(), and s=splhight() after, and
 > my box passed the make -j4 obj
 > it's now building the toolchain.

That fix is not correct.  That opens up a race condition where the
interrupt which wakes up could come in before the process goes to
sleep.

The correct fix is to use splsched() instead of splhigh(); things that
interrupt higher than splsched() are not supposed to use wakeup, select,
or signals anyway (they'd have to use an additional soft interrupt if
they wanted to do so).

-- 
        -- Jason R. Thorpe <thorpej@wasabisystems.com>