From: Oleg Nesterov <oleg@tv-sign.ru>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Arjan van de Ven <arjan@linux.intel.com>,
Heiko Carstens <heiko.carstens@de.ibm.com>,
Ingo Molnar <mingo@elte.hu>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Andrew Morton <akpm@linux-foundation.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: hrtimers: simplify lockdep handling
Date: Thu, 26 Jun 2008 15:06:24 +0400 [thread overview]
Message-ID: <20080626110624.GA110@tv-sign.ru> (raw)
In-Reply-To: <Pine.LNX.4.58.0806251539180.405@gandalf.stny.rr.com>
Hi Steven,
On 06/25, Steven Rostedt wrote:
>
> I'm currently porting -rt to 26-rc7 and I came across this change:
>
> Commit: 8e60e05fdc7344415fa69a3883b11f65db967b47
>
> With the
>
> - double_spin_lock(&new_base->lock, &old_base->lock,
> - smp_processor_id() < cpu);
> + spin_lock(&new_base->lock);
> + spin_lock_nested(&old_base->lock, SINGLE_DEPTH_NESTING);
>
>
> What's the reason that this is possible? Is it because the migration
> happens only on CPU hotplugging and that the CPU hotplugging code has
> locks that would prevent a reversal of the lock taking?
Yes. Even if we ignore CPU hotplugging locks, it is not possible that
2 migrate_timers()'s can take these locks in reverse order, this means
that both CPUs are dead and we are doing something meaningless.
> I'm not arguing that the code is incorrect, but this looks like a subtlety
> that can bite us later.
>
> In other words, we really need comments around this code to explain to
> casual viewers why this code is not deadlock prone. The change log here
> and for 0d180406f2914aea3a78ddb880e2fe9ac78a9372 does not explain why the
> straight forward taking of the locks is OK.
OK, I agree, I'll try to make the trivial doc patch.
But please note that the old code was confusing too, imho. It looked as
if we really have to avoid the deadlock, and the casual viewer (me) was
very confused when noticed the changes which added base_lock_keys and
double_spin_lock ;)
Oleg.
prev parent reply other threads:[~2008-06-26 11:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-25 19:46 Steven Rostedt
2008-06-26 11:06 ` Oleg Nesterov [this message]
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=20080626110624.GA110@tv-sign.ru \
--to=oleg@tv-sign.ru \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@linux-foundation.org \
--cc=arjan@linux.intel.com \
--cc=heiko.carstens@de.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
/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
all inboxes | Powered by JetHome®