From owner-p4-projects@FreeBSD.ORG Fri Jan 19 17:14:30 2007 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id B172716A40B; Fri, 19 Jan 2007 17:14:30 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7E43316A406; Fri, 19 Jan 2007 17:14:30 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe01.swip.net [212.247.154.1]) by mx1.freebsd.org (Postfix) with ESMTP id DE08113C441; Fri, 19 Jan 2007 17:14:29 +0000 (UTC) (envelope-from hselasky@c2i.net) X-Cloudmark-Score: 0.000000 [] Received: from [193.217.102.48] (account mc467741@c2i.net HELO [10.0.0.249]) by mailfe01.swip.net (CommuniGate Pro SMTP 5.0.12) with ESMTPA id 368855214; Fri, 19 Jan 2007 18:14:28 +0100 From: Hans Petter Selasky To: "Attilio Rao" Date: Fri, 19 Jan 2007 18:14:03 +0100 User-Agent: KMail/1.7 References: <200701191656.l0JGuPu7025321@repoman.freebsd.org> <3bbf2fe10701190858v4fbdf5ct5fd39c6e16f2a10d@mail.gmail.com> In-Reply-To: <3bbf2fe10701190858v4fbdf5ct5fd39c6e16f2a10d@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200701191814.04201.hselasky@c2i.net> Cc: perforce@freebsd.org Subject: Re: PERFORCE change 113164 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Jan 2007 17:14:31 -0000 On Friday 19 January 2007 17:58, Attilio Rao wrote: > 2007/1/19, Hans Petter Selasky : > > http://perforce.freebsd.org/chv.cgi?CH=113164 > > > > Change 113164 by hselasky@hselasky_mini_itx on 2007/01/19 16:56:15 > > > > The sound mutex needs to allow recursion, else the > > new "uaudio" will not work. > > > > Affected files ... > > > > .. //depot/projects/usb/src/sys/dev/sound/pcm/sound.c#3 edit > > > > Differences ... > > > > ==== //depot/projects/usb/src/sys/dev/sound/pcm/sound.c#3 (text+ko) ==== > > > > @@ -78,7 +78,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; > > Recursed mutexes very often are symptomatic of some some bug... > it is the case? why the mutex is recursed? > Because my system shares the lock with the "pcm channel" of the sound system. That means it uses "c->lock" (see below) to protect the isochronous USB transfers. The problem is that my USB callback calls "chn_intr()" which also locks the same lock. Maybe this should be addressed by Ariff A. ? void chn_intr(struct pcm_channel *c) { CHN_LOCK(c); c->interrupts++; if (c->direction == PCMDIR_PLAY) chn_wrintr(c); else chn_rdintr(c); CHN_UNLOCK(c); } --HPS