Re: /dev/soiund/pcm/dsp.c: uma_zalloc with non-sleepable lock held

From: Kostik Belousov <kostikbel_at_gmail.com>
Date: Mon, 26 May 2008 16:48:50 +0300
On Mon, May 26, 2008 at 03:41:25PM +0200, Ed Schouten wrote:
> * Kostik Belousov <kostikbel_at_gmail.com> wrote:
> > 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 was looking around, but I couldn't find it. Isn't there some kind of
> macro that does something like this:
> 
> | void
> | myfunction(void)
> | {
> | 	THREAD_CANNOT_HOLD_ANY_NONSLEEPABLE_LOCKS_HERE;
> | 
> | 	...
> | }
> 
> I know we have THREAD_NO_SLEEPING(), but that just does the opposite. I
> think we could greatly improve our warnings if we could add these
> macro's throughout the source code.

I believe this is spelled
WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, "Some msg");

Received on Mon May 26 2008 - 11:49:11 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:31 UTC