Subject: Re: yamt-idlelwp fallout for mips/cobalt?
To: None <ad@NetBSD.org>
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
List: port-cobalt
Date: 05/24/2007 23:57:44
ad@NetBSD.org wrote:

> > With options LOCKDEBUG:
> > ---
> > Setting date via ntp.
> > Starting rpcbind.
> > Starting ypbind.
> > Mounting all filesystems...
> > Mutex error: lockdebug_wantlock: locking against myself
> > 
> > lock address : 0x00000000802f35c0 type     :               spin
> > shared holds :                  0 exclusive:                  1
> > shares wanted:                  0 exclusive:                  1
> > current cpu  :                  0 last held:                  0
> > current lwp  : 0x000000008fc95000 last held: 0x000000008fc95700
> > last locked  : 0x0000000080171dbc unlocked : 0x000000008016b7d0
> > owner field  : 000000000000000000 wait/spin:                0/1
> > 
> > panic: LOCKDEBUG
> > Stopped in pid 249.1 (nfsio) at netbsd:cpu_Debugger+0x4:        jr      ra
> >                 bdslot: nop
> > db> 
> > ---
> > 0x80171dbc is in ltsleep() and 0x8016b7d0 is in sleepq_wake().
> 
> I wonder, is this is from an interrupt handler and are the masks are being
> set up properly? E.g. IPL_STATCLOCK should also block IPL_CLOCK.. I'll take
> a look when I have a moment. Another possibility is that cpu_switchto is
> returning the wrong value, but it does work on MIPS1 and most of the code
> is common.

Here is (probably) a proper trace (with some ugly hacked kernel):
---
boot device: wd0
root on wd0a dumps on wd0b
root file system type: ffs
Thu May 24 14:31:29 GMT 2007
swapctl: adding /dev/wd0b as swap device at priority 0
Checking for botched superblock upgrades:Mutex error: lockdebug_wantlock: locking against myself

lock address : 0x00000000802f51e0 type     :               spin
shared holds :                  0 exclusive:                  1
shares wanted:                  0 exclusive:                  1
current cpu  :                  0 last held:                  0
current lwp  : 0x000000008fc95540 last held: 0x000000008fc95700
last locked  : 0x0000000080170bb4 unlocked : 0x0000000080170c4c
owner field  : 000000000000000000 wait/spin:                0/1

panic: LOCKDEBUG
Stopped in pid 47.1 (sh) at     netbsd:cpu_Debugger+0x4:        jr      ra
                bdslot: nop
db> tr
cpu_Debugger+4 (8fffe000,802ce630,d,0) ra 8018bde8 sz 0
panic+180 (8fffe000,802ce630,d,0) ra 80184344 sz 48
lockdebug_abort1+70 (8fffe000,802ce630,d,0) ra 80184e68 sz 32
lockdebug_wantlock+1dc (8fffe000,802ce630,d,0) ra 8015ddc8 sz 40
mutex_vector_enter+188 (8fffe000,802ce630,d,0) ra 8016b5ac sz 48
sleepq_remove+114 (8fffe000,802ce630,d,0) ra 8016b8b0 sz 32
sleepq_unsleep+4c (8fffe000,802ce630,d,0) ra 80179dbc sz 32
softclock+30c (8fffe000,802ce630,d,0) ra 8020efd4 sz 40
softintr_dispatch+d4 (100,802ce630,d,0) ra 8020e304 sz 56
cpu_intr+98 (100,802ce630,d,0) ra 801f7bb4 sz 56
mips3_KernIntr+84 (cc6f0000,3edc9f,3edc5f,0) ra 801f81a0 sz 128
mips3_VCEI+10 (cc6f0000,3edc9f,3edc5f,0) ra 0 sz 0
User-level: pid 47.1
db> 
---

I'll check softintr code on cobalt, or around
options MIPS3_ENABLE_CLOCK_INTR.

(BTW, it might be better to make all lockdebug_*()
 functions non static for debugging..)
---
Izumi Tsutsui