Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 9 May 2004 10:53:56 +0200
From:      Bartek Marcinkiewicz <junior@p233.if.pwr.wroc.pl>
To:        freebsd-hackers@freebsd.org
Subject:   non-recursive mutex, sbc, pcm, kernel panic
Message-ID:  <20040509085356.GA15318@p233.if.pwr.wroc.pl>

next in thread | raw e-mail | index | archive | help
Hello,

I've just experienced kernel panic while trying
to play mp3 file. (My sound card: Creative Sound
Blaster 16, ISA, worked fine on older 5.x system).

While reading code:

sys/dev/sound/pcm/sound.c::snd_mtxcreate() creates 
non-recursive mutex.

But in sys/dev/sound/isa/sb16.c::sb_setup() we have:

sb_setup()
{

	sb_lock(sb);

	/* ... */

	sb_reset_dsp(sb);

	/* ... */
}

sb_reset_dsp() function locks this mutex again, causing 
panic with message: 
_mtx_lock_sleep: recursed on non-recursive mutex sbc0 @...

Is this known issue? Why this mutex should be non-recursive?
Attached patch makes it work again.

best regards, bm.

FreeBSD 5.2-CURRENT FreeBSD Sat Mar 27 18:25:15 CET 2004
sbc0: <Creative ViBRA16C> at port 0x388-0x38b,0x330-0x331,0x220-0x22f
irq 5 drq 5,1 on isa0
sbc0: [GIANT-LOCKED]
pcm0: <SB16 DSP 4.13> on sbc0

--- sound.c	Sun May  9 10:44:20 2004
+++ sound.c	Sun May  9 10:48:31 2004
@@ -75,7 +75,7 @@
 	m = malloc(sizeof(*m), M_DEVBUF, M_WAITOK | M_ZERO);
 	if (m == NULL)
 		return NULL;
-	mtx_init(m, desc, type, MTX_DEF);
+	mtx_init(m, desc, type, MTX_DEF | MTX_RECURSE);
 	return m;
 #else
 	return (void *)0xcafebabe;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040509085356.GA15318>