From: David Collins <collinsd@codeaurora.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Liam Girdwood <lrg@slimlogic.co.uk>,
Mark Brown <broonie@opensource.wolfsonmicro.com>,
linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@elte.hu>
Subject: Re: Deadlock scenario in regulator core
Date: Tue, 22 Mar 2011 16:41:28 -0700 [thread overview]
Message-ID: <4D8933A8.8080607@codeaurora.org> (raw)
In-Reply-To: <1300835998.14261.13.camel@gandalf.stny.rr.com>
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.
next prev parent reply other threads:[~2011-03-22 23:41 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-22 22:02 Deadlock scenario in regulator core David Collins
2011-03-22 22:31 ` Mark Brown
2011-03-22 23:30 ` David Collins
2011-03-22 23:45 ` Mark Brown
2011-03-22 22:37 ` Steven Rostedt
2011-03-22 23:08 ` David Collins
2011-03-22 23:19 ` Steven Rostedt
2011-03-22 23:41 ` David Collins [this message]
2011-03-23 0:07 ` Steven Rostedt
2011-03-23 0:11 ` Mark Brown
2011-03-25 10:55 ` Peter Zijlstra
2011-03-23 0:01 ` Mark Brown
2011-03-23 0:38 ` Steven Rostedt
2011-03-23 10:42 ` Mark Brown
2011-03-25 10:59 ` Peter Zijlstra
2011-03-22 22:43 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4D8933A8.8080607@codeaurora.org \
--to=collinsd@codeaurora.org \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lrg@slimlogic.co.uk \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.