From owner-freebsd-current@FreeBSD.ORG Wed Jun 8 14:20:47 2005 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D30EA16A41C for ; Wed, 8 Jun 2005 14:20:47 +0000 (GMT) (envelope-from fli+freebsd-current@shapeshifter.se) Received: from mail.hamnpolare.net (manticore.shapeshifter.se [212.37.5.30]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6CA8F43D49 for ; Wed, 8 Jun 2005 14:20:46 +0000 (GMT) (envelope-from fli+freebsd-current@shapeshifter.se) Received: from localhost (localhost [127.0.0.1]) by mail.hamnpolare.net (Postfix) with ESMTP id 63E421A6F0 for ; Wed, 8 Jun 2005 16:20:41 +0200 (CEST) Received: from mail.hamnpolare.net ([127.0.0.1]) by localhost (manticore.shapeshifter.se [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 54595-08 for ; Wed, 8 Jun 2005 16:20:40 +0200 (CEST) Received: from biocandy.shapeshifter.se (h99n2fls32o270.telia.com [217.210.25.99]) by mail.hamnpolare.net (Postfix) with ESMTP id 1417B1A6D5 for ; Wed, 8 Jun 2005 16:20:40 +0200 (CEST) Received: by biocandy.shapeshifter.se (Postfix, from userid 1001) id B282A427E; Wed, 8 Jun 2005 16:20:39 +0200 (CEST) Date: Wed, 8 Jun 2005 16:20:39 +0200 From: Fredrik Lindberg To: freebsd-current@freebsd.org Message-ID: <20050608142039.GA776@shapeshifter.se> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2.1i X-Virus-Scanned: at mail.hamnpolare.net Subject: _mtx_lock_sleep: recursed on non-recursive mutex pcm0 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Jun 2005 14:20:48 -0000 Hi When trying to play sound from two different sources at the same time I get an instant panic with the following message panic: _mtx_lock_sleep: recursed on non-recursive mutex pcm0 @ /usr/src/sys/dev/sound/pcm/sound.c:381 This is with a (AC97) on a few hours old current and with sound and snd_ich compiled staticly into the kernel. It only occurs when hw.snd.autovchans is set to a number greater than 1. Backtrace #0 doadump () at pcpu.h:165 #1 0xc059674a in boot (howto=260) at /usr/src/sys/kern/kern_shutdown.c:397 #2 0xc0596ab8 in panic ( fmt=0xc07d07d0 "_mtx_lock_sleep: recursed on non-recursive mutex %s @ %s:%d\n") at /usr/src/sys/kern/kern_shutdown.c:553 #3 0xc058cc08 in _mtx_lock_sleep (m=0xc1be9bc0, td=0xc20d8190, opts=0, file=0x0, line=0) at /usr/src/sys/kern/kern_mutex.c:447 #4 0xc058c8eb in _mtx_lock_flags (m=0x0, opts=0, file=0xc07c5c1a "/usr/src/sys/dev/sound/pcm/sound.c", line=381) at /usr/src/sys/kern/kern_mutex.c:273 #5 0xc0506dfc in pcm_chn_create (d=0xc1979a00, parent=0x0, cls=0x0, dir=2, devinfo=0x0) at /usr/src/sys/dev/sound/pcm/sound.c:381 #6 0xc0508a52 in vchan_create (parent=0xc1bf0180) at /usr/src/sys/dev/sound/pcm/vchan.c:265 #7 0xc05067a4 in pcm_chnalloc (d=0xc1979a00, direction=1, pid=628, chnum=-1) at /usr/src/sys/dev/sound/pcm/sound.c:193 #8 0xc0500a8d in dsp_open (i_dev=0xc1a99c00, flags=2, mode=8192, td=0xc20d8190) at /usr/src/sys/dev/sound/pcm/dsp.c:275 #9 0xc053e38b in devfs_open (ap=0xeebb8a54) at /usr/src/sys/fs/devfs/devfs_vnops.c:881 #10 0xc0792fbc in VOP_OPEN_APV (vop=0x0, a=0xeebb8a54) at vnode_if.c:373 #11 0xc06089c2 in vn_open_cred (ndp=0xeebb8bc4, flagp=0xeebb8cc4, cmode=0, cred=0xc20a5900, fdidx=6) at vnode_if.h:198 #12 0xc0608543 in vn_open (ndp=0x0, flagp=0x0, cmode=0, fdidx=0) at /usr/src/sys/kern/vfs_vnops.c:91 #13 0xc0600668 in kern_open (td=0xc20d8190, path=0x0, pathseg=UIO_USERSPACE, flags=2, mode=0) at /usr/src/sys/kern/vfs_syscalls.c:986 #14 0xc0600556 in open (td=0x0, uap=0xeebb8d04) at /usr/src/sys/kern/vfs_syscalls.c:952 The content of frame 5 yields the following (kgdb) f 5 #5 0xc0506dfc in pcm_chn_create (d=0xc1979a00, parent=0x0, cls=0x0, dir=2, devinfo=0x0) at /usr/src/sys/dev/sound/pcm/sound.c:381 381 snd_mtxlock(d->lock); d->lock is initialized as a non-recursive mutex in snd_mtxcreate (sound.c:78) called from pcm_register (sound.c:655). While the following patch fixes the panic and let me play sound from different sources at the same time without any problems, I'm really not sure this is the correct solution since the mutex was initialized as a non-recursive mutex but recursion happens anyway. Perhaps somebody with more experience in the sound system could look at this. --- sound.c.orig Wed Jun 8 16:07:32 2005 +++ sound.c Wed Jun 8 15:32:19 2005 @@ -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; Fredrik Lindberg