[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5167A953.1020900@acm.org>
Date: Fri, 12 Apr 2013 08:27:31 +0200
From: Bart Van Assche <bvanassche@....org>
To: Neil Horman <nhorman@...driver.com>
CC: David Miller <davem@...emloft.net>, netdev@...r.kernel.org,
Ingo Molnar <mingo@...hat.com>
Subject: Re: [PATCH RFC] spinlock: split out debugging check from spin_lock_mutex
On 04/11/13 21:14, Neil Horman wrote:
> This resulted from my commit ca99ca14c which introduced a mutex_trylock
> operation in a path that could execute in interrupt context. When mutex
> debugging is enabled, the above warns the user when we are in fact exectuting in
> interrupt context.
>
> I think this is a false positive however. The check is intended to catch users
> who might be issuing sleeping calls in irq context, but the use of mutex_trylock
> here is guaranteed not to sleep.
>
> We could fix this by replacing the DEBUG_LOCK_WARN_ON check in spin_lock_mutex
> with a __might_sleep call in the appropriate parent mutex operations, but for
> the sake of effiency (which It seems is why the check was put in the spin lock
> code only when debug is enabled), lets split the spin_lock_mutex call into two
> components, where the outer component does the debug checking. Then
> mutex_trylock can just call the inner part as its callable from irq context
> safely.
Sorry but I'm not yet convinced that it's safe to invoke mutex_trylock()
from IRQ context. Please have a look at the implementation of
mutex_set_owner(), which is invoked by mutex_trylock().
mutex_set_owner() stores the value of the "current" pointer into
lock->owner. The value of "current" does not have a meaning in IRQ context.
Bart.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists