Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 May 2008 19:33:05 +0800
From:      Ariff Abdullah <ariff@FreeBSD.org>
To:        Kostik Belousov <kostikbel@gmail.com>
Cc:        freebsd-current@freebsd.org, d@delphij.net
Subject:   Re: /dev/soiund/pcm/dsp.c: uma_zalloc with non-sleepable lock held
Message-ID:  <20080526193305.63459394.ariff@FreeBSD.org>
In-Reply-To: <20080526091756.GF21317@deviant.kiev.zoral.com.ua>
References:  <483A58D9.4090400@delphij.net> <20080526155514.221a210e.ariff@FreeBSD.org> <20080526091756.GF21317@deviant.kiev.zoral.com.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.

--Multipart=_Mon__26_May_2008_19_33_05_+0800_6eJ8.9+k.5aFGSab
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit

On Mon, 26 May 2008 12:17:56 +0300
Kostik Belousov <kostikbel@gmail.com> wrote:
> On Mon, May 26, 2008 at 03:55:14PM +0800, Ariff Abdullah wrote:
> > On Sun, 25 May 2008 23:29:45 -0700
> > Xin LI <delphij@delphij.net> wrote:
[...]
> > 
> > It is something new. Let me examine it first.
> 
> Not quite. You cannot hold a mutex over the destroy_dev(), because
> the destroy_dev() may sleep. It was not very common situation,
> because it requires another thread still in the driver methods to
> trigger the problem. Now, because the malloc() is called
> unconditionally in the destroy_dev() since rev. 1.212, the problem
> gets hit regularly.
> 

I see. It's quite new to me since I haven't examine things thoroughly
since past few weeks. Thanks.

Xin Li, try this patch.


--
Ariff Abdullah
FreeBSD

... Recording in stereo is obviously too advanced
    and confusing for us idiot ***** users :P ........

--Multipart=_Mon__26_May_2008_19_33_05_+0800_6eJ8.9+k.5aFGSab
Content-Type: text/x-diff;
 name="dsp.c.diff"
Content-Disposition: attachment;
 filename="dsp.c.diff"
Content-Transfer-Encoding: 7bit

Index: src/sys/dev/sound/pcm/dsp.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/sound/pcm/dsp.c,v
retrieving revision 1.108
diff -u -r1.108 dsp.c
--- src/sys/dev/sound/pcm/dsp.c	11 Apr 2008 15:26:25 -0000	1.108
+++ src/sys/dev/sound/pcm/dsp.c	26 May 2008 11:26:54 -0000
@@ -661,7 +661,14 @@
 			 * process.
 			 */
 			(void)snd_clone_release(i_dev);
+
+			/*
+			 * destroy_dev() might sleep, so release pcm lock
+			 * here and rely on pcm cv serialization.
+			 */
+			pcm_unlock(d);
 			(void)snd_clone_unref(i_dev);
+			pcm_lock(d);
 		}
 		PCM_RELEASE(d);
 	}

--Multipart=_Mon__26_May_2008_19_33_05_+0800_6eJ8.9+k.5aFGSab--



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