Subject: Re: 1.5S vs sparc/MP
To: None <eeh@netbsd.org>
From: Simon J. Gerraty <sjg@quick.com.au>
List: tech-smp
Date: 02/26/2001 11:29:40
> Watchdog reset is actually a mis-nomer.  It's not a 
> typical watchdog timer.  

Thanks for the explaination Eduardo.

FWIW, since I didn't like the idea of all those sema_v ops being done
before the simplelock had been initialized, I revised my usage, such
that I initialize the semaphore at the start of each call to
smp_*flush*() and disabled it at the end.  The sema_{p,v} operations
simply return if the semaphore is not initialized.

I don't get a watchdog reset anymore...  and I _think_ I get past the
point where it used to panic...  I now get:

sema_init(0xf02b10dc, 0, cache_flush)
sema_v(0xf02b10dc) == 1
sema_p(0xf02b10dc) == 0
sema_v(0xf02b10dc) == 1
sema_p(0xf02b10dc) == 0
sema_setflags(0xf02b10dc, 0)
sema_v(0xf02b10dc) == 1
panic: lockmgr: release of unlocked lock!
Stopped in pid 1 (init) at      cpu_Debugger+0x4:       jmpl            [%o7 + 0
x8], %g0
db{0}> trace
lockmgr(0xf0293838, 0x400006, 0xfffffffe, 0xf0203c00, 0xf0203c00, 0xf0786f00) at
 lockmgr+0xcd4
start_init(0xf61de000, 0xf0291400, 0xf022a2e0, 0xf61e4000, 0x0, 0x2763d0) at sta
rt_init+0x220
proc_trampoline(0x0, 0x0, 0x0, 0x0, 0x0, 0x0) at proc_trampoline
db{0}> 

At least we are in init :-)

Anyway, this is a bit odd.  The above init, v, p, v, p, setflags, v
has been repeated many times up to this point.  The last sema_v()
above is called by sema_setflags() - if he's being asked to shut the
semaphore down ((flags & SEMAF_VALID) == 0), he loops doing sema_v()'s
to ensure no-one is sleeping on the semaphore.  Of course no one is at
this point... hmmm I guess sema_v() should only call wakeup_one() if
the count has just reached 0 - otherwise no one should be sleeping on
the semaphore.

--sjg