[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4D8933A8.8080607@codeaurora.org>
Date: Tue, 22 Mar 2011 16:41:28 -0700
From: David Collins <collinsd@...eaurora.org>
To: Steven Rostedt <rostedt@...dmis.org>
CC: Liam Girdwood <lrg@...mlogic.co.uk>,
Mark Brown <broonie@...nsource.wolfsonmicro.com>,
linux-arm-msm@...r.kernel.org, linux-kernel@...r.kernel.org,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...e.hu>
Subject: Re: Deadlock scenario in regulator core
On 03/22/2011 04:19 PM, Steven Rostedt wrote:
>
> Looks to me that the mutex_lock() in _notifier_call_chain needs to be a
> mutex_lock_nested().
>
> The "_nested()" versions are when you have the same type of mutex taken
> but belonging to two different instances. Like you have here:
>
> blocking_notifier_call_chain(&rdev->notifier, event, NULL);
>
> /* now notify regulator we supply */
> list_for_each_entry(_rdev, &rdev->supply_list, slist) {
> mutex_lock(&_rdev->mutex);
> _notifier_call_chain(_rdev, event, data);
> mutex_unlock(&_rdev->mutex);
> }
>
> The rdev->mutex is already held, so we don't need to take it to call the
> blocking_notifier_call_chain() with the rdev->notifier. But then the
> list of rdev's in the rdev->supply_list are different instances but we
> are still taking the same type of lock. lockdep treats all instances of
> the same lock the same, so to lockdep this looks like a deadlock. To
> teach lockdep that this is a different instance, simply use
> mutex_lock_nested() instead.
>
> -- Steve
>
>
There seem to be very few uses of mutex_lock_nested() in the kernel. Most
of them use subclass = SINGLE_DEPTH_NESTING. Would this be sufficient for
usage in the regulator core in _notifier_call_chain (and perhaps other
places) or should some other subclass be used?
Thanks,
David
--
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists