Subject: port-sh3/35971: Mutex error on SH3 DIAGNOSTIC kernels
To: None <port-sh3-maintainer@netbsd.org, gnats-admin@netbsd.org,>
From: None <tsutsui@ceres.dti.ne.jp>
List: netbsd-bugs
Date: 03/11/2007 00:45:00
>Number:         35971
>Category:       port-sh3
>Synopsis:       Mutex error panic on SH3 DIAGNOSTIC kernels
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    port-sh3-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Mar 11 00:45:00 +0000 2007
>Originator:     Izumi Tsutsui
>Release:        NetBSD 4.99.13
>Organization:
>Environment:
NetBSD 4.99.13 (LANTANK) #6: Sun Mar 11 02:28:53 JST 2007
        tsutsui@mirage:/usr/src/sys/arch/landisk/compile/LANTANK
Model: I-O DATA LANDISK
Architecture: sh3
Machine: landisk
>Description:

landisk (and dreamcast) kernels with option DIAGNOSTIC get
the following panic (right after interrupts are enabled?):
---
 :
obio0 at mainbus0
btn0 at obio0 irq 12: USL-5P Button
pwrsw0 at obio0 irq 11: Power Switch
Kernelized RAIDframe activated
Mutex error: mutex_spin_retry: locking against myself

lock address : 0x000000008c3c6d8c
current cpu  :                  0
current lwp  : 000000000000000000
owner field  : 0x0000000038002000 wait/spin:                1/128

panic: lock error
Stopped at      netbsd:cpu_Debugger+0x6:        mov     r14, r15
db> tr
cpu_Debugger() at netbsd:panic+0xa6
panic() at netbsd:lockdebug_abort+0x40
lockdebug_abort() at netbsd:mutex_abort+0x4e
mutex_abort() at netbsd:mutex_spin_retry+0xe
mutex_spin_retry() at netbsd:sched_lock_idle+0x24
sched_lock_idle() at netbsd:cpu_switch_search+0x1a
cpu_switch_search() at netbsd:cpu_switch+0x24
cpu_switch() at 0
db> 
---

It's the first sched_lock_idle() in sys/arch/sh3/sh3/locore_c.c.

>How-To-Repeat:
Build kernel with options DIAGNOSTIC and boot it on landisk or dreamcast.

The panic is also reproducible on gxemul emulating dreamcast:
ftp://ftp.netbsd.org/pub/NetBSD/packages/pkgsrc/emulators/gxemul/README.html
http://gavare.se/gxemul/gxemul-stable/doc/dreamcast.html

>Fix:
N/A