From owner-freebsd-hackers@FreeBSD.ORG Sun May 9 01:51:24 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E128916A4CF for ; Sun, 9 May 2004 01:51:21 -0700 (PDT) Received: from p233.if.pwr.wroc.pl (p233.if.pwr.wroc.pl [156.17.68.170]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7A63143D2D for ; Sun, 9 May 2004 01:51:21 -0700 (PDT) (envelope-from junior@p233.if.pwr.wroc.pl) Received: from junior by p233.if.pwr.wroc.pl with local (Exim 4.32) id 1BMk4K-00040K-Uo for freebsd-hackers@freebsd.org; Sun, 09 May 2004 10:53:56 +0200 Date: Sun, 9 May 2004 10:53:56 +0200 To: freebsd-hackers@freebsd.org Message-ID: <20040509085356.GA15318@p233.if.pwr.wroc.pl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.5.1+cvs20040105i From: Bartek Marcinkiewicz Subject: non-recursive mutex, sbc, pcm, kernel panic X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 May 2004 08:51:24 -0000 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: at port 0x388-0x38b,0x330-0x331,0x220-0x22f irq 5 drq 5,1 on isa0 sbc0: [GIANT-LOCKED] pcm0: 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;