From: Ingo Molnar <mingo@elte.hu>
To: Gautham R Shenoy <ego@in.ibm.com>
Cc: Andrew Morton <akpm@osdl.org>,
linux-kernel@vger.kernel.org, torvalds@osdl.org,
davej@redhat.com, dipankar@in.ibm.com, vatsa@in.ibm.com
Subject: Re: CPUFREQ-CPUHOTPLUG: Possible circular locking dependency
Date: Fri, 1 Dec 2006 09:55:02 +0100 [thread overview]
Message-ID: <20061201085502.GA29060@elte.hu> (raw)
In-Reply-To: <20061201014313.GA25074@in.ibm.com>
* Gautham R Shenoy <ego@in.ibm.com> wrote:
> Consider a case where we have three locks A, B and C.
> We have very clear locking rule inside the kernel that lock A *should*
> be acquired before acquiring either lock B or lock C.
>
> At runtime lockdep detects the two dependency chains,
> A --> B --> C
>
> and
>
> A --> C --> B.
>
> Does lockdep issue a circular dependency warning for this ?
> It's quite clear from the locking rule that we cannot have a
> circular deadlock, since A acts as a mutex for B->C / C->B callpath.
>
> Just curious :-) [ Well, I might encounter such a scenario in an attempt
> to make cpufreq cpu-hotplug safe! ]
yes, lockdep will warn about this. Will you /ever/ have a B->C or C->B
dependency without A being taken first?
if not then my suggestion would be to just lump 'B' and 'C' into a
single lock - or to get rid of them altogether. There's little reason to
keep them separate. /If/ you want to keep them separate (because they
protect different data structures) then it's the cleanest design to have
an ordering between them. The taking of 'A' might go away anytime - such
a construct is really, really fragile and is only asking for trouble.
Ingo
next prev parent reply other threads:[~2006-12-01 8:55 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-29 15:24 CPUFREQ-CPUHOTPLUG: Possible circular locking dependency Gautham R Shenoy
2006-11-29 21:05 ` Andrew Morton
2006-11-30 4:28 ` Gautham R Shenoy
2006-11-30 6:35 ` Gautham R Shenoy
2006-11-30 8:29 ` Ingo Molnar
2006-11-30 8:52 ` Gautham R Shenoy
2006-12-01 1:43 ` Gautham R Shenoy
2006-12-01 8:55 ` Ingo Molnar [this message]
2006-11-30 8:31 ` Ingo Molnar
2006-11-30 10:24 ` Gautham R Shenoy
2006-11-30 11:03 ` Ingo Molnar
2006-11-30 11:19 ` Andrew Morton
2006-11-30 11:46 ` Ingo Molnar
2006-11-30 12:44 ` Gautham R Shenoy
2006-11-30 14:35 ` Ingo Molnar
2006-11-30 19:40 ` Andrew Morton
2006-11-30 20:24 ` Ingo Molnar
2006-11-30 11:43 ` Gautham R Shenoy
2006-11-30 11:53 ` Ingo Molnar
2006-11-30 12:19 ` Gautham R Shenoy
-- strict thread matches above, loose matches on Subject: below --
2006-12-06 18:27 Pallipadi, Venkatesh
2006-12-07 7:06 ` Gautham R Shenoy
2006-12-07 12:50 Pallipadi, Venkatesh
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=20061201085502.GA29060@elte.hu \
--to=mingo@elte.hu \
--cc=akpm@osdl.org \
--cc=davej@redhat.com \
--cc=dipankar@in.ibm.com \
--cc=ego@in.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.org \
--cc=vatsa@in.ibm.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox