From: Andrea Arcangeli <andrea@qumranet.com>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Dave Jones <davej@redhat.com>, Roland Dreier <rdreier@cisco.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
David Miller <davem@davemloft.net>,
jeremy@goop.org, hugh@veritas.com, mingo@elte.hu,
akpm@linux-foundation.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] workaround minor lockdep bug triggered by mm_take_all_locks
Date: Mon, 4 Aug 2008 22:15:14 +0200 [thread overview]
Message-ID: <20080804201514.GB12464@duo.random> (raw)
In-Reply-To: <1217875739.3589.56.camel@twins>
On Mon, Aug 04, 2008 at 08:48:59PM +0200, Peter Zijlstra wrote:
> On Mon, 2008-08-04 at 19:57 +0200, Andrea Arcangeli wrote:
> > From: Andrea Arcangeli <andrea@qumranet.com>
> >
> > Lockdep can't recognize if spinlocks are at a different address. So
> > using trylock in a loop is one way to avoid lockdep to generate false
> > positives. After lockdep will be fixed this change can and should be
> > reverted.
> >
> > Signed-off-by: Andrea Arcangeli <andrea@qumranet.com>
>
> NAK, come-on, you didn't even bother to look at the available
> annotations..
Let's say when I hear prove-locking my instinct tells me to walk away
as fast as I can. I'll try to explain why I prefer the trylock loop
(which btw is the only one that will hide the lockdep false positives
here and I welcome you to fix it in another way, well another way that
comes to mind is to call __raw_spin_lock which I didn't do because I
don't like those lowlevel details in common code).
So about prove-locking:
1) in production is disabled so when I get bugreports I've to grab
locking deadlock information as usual (sysrq+t/p or preferably
lkcd/kdump)
2) while coding it's useless as well because I don't need this thing
to debug and fix any deadlocks
3) this only finds bugs after the system is hung and I can fix it by
other means then
Despite having used this for a while, it never happened to me that
this has been useful as single time, I only run into false positives
and systems grinding to an halt so not allowing debug kernels to run
which reduced even more the ability to debug the kernel. I'm not aware
of anybody else who was debugging that fixed bugs thanks to this
code. So in my experience this only has hurt me and I don't want it
ever enabled in anything I deal with.
If only this had a slight chance to find bugs that don't easily
trigger at runtime it'd be an entirely different matter.
To be clear: my criticism is only to prove-locking, for example I find
very useful that there are other things like spinlock debug options
that warns if you call GFP with GFP_KERNEL while you're in atomic
context (which unfortunately only works with preempt enabled for no
good reason because the atomic context is maintained by non-preempt
too but anyway). The spinlock sleep debug effectively find bugs that
would otherwise go unnoticed. Let's say I'm only interested in stuff
that shows bugs that would otherwise go unnoticed, everything else I
can debug it by myself without prove-locking printk in the logs.
So this can only help if you aren't capable of running and decoding
sysrq+p/t. And it can't help in production either because it has to be
disabled there (and production would be the only place where
explaining how to grab a sysrq+p/t is a problem, and normally it's
simpler to grab kdump/lkcd).
Furthermore I don't like to slowdown (up to grinding system to an halt
before these fixes, but still not so fast) for this so unnecessary
feature while debugging. This also explains why after checking that
the patch was ok when Andrew asked it, I disabled prove-locking pretty
quickly.
So perhaps I misunderstand how lockdep works, in which case you're
welcome to correct me, otherwise I'd really like to know if anybody
really felt some bug couldn't be fixed in equal time without it (and I
mean excluding production where obviously this is useless as it can't
be possibly enabled). Understanding what are the implications of the
deadlock is sure slower than comparing the disassembly of the
sysrq+p/t (which 99% of has to be done anyway because the report comes
from a production system, if the bug was reproducible it would have
been tripped before it hit production).
I see it as a didactical theoretical exercise, and I hope this
explains why I prefer the trylock loop any day compared to any more
complex prove-locking specific API polluting the common code. And if
it was for me I'd remove prove-locking from the kernel the moment it
started to pollute the common code for zero debugging advantages.
next prev parent reply other threads:[~2008-08-04 20:16 UTC|newest]
Thread overview: 73+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-04 13:03 [RFC][PATCH 0/7] lockdep Peter Zijlstra
2008-08-04 13:03 ` [RFC][PATCH 1/7] lockdep: Fix combinatorial explosion in lock subgraph traversal Peter Zijlstra
2008-08-05 8:34 ` David Miller
2008-08-05 8:46 ` Peter Zijlstra
2008-08-13 3:48 ` Tim Pepper
2008-08-13 10:56 ` Ingo Molnar
2008-08-04 13:03 ` [RFC][PATCH 2/7] lockdep: lock_set_subclass - reset a held locks subclass Peter Zijlstra
2008-08-05 8:35 ` David Miller
2008-08-04 13:03 ` [RFC][PATCH 3/7] lockdep: re-annotate scheduler runqueues Peter Zijlstra
2008-08-05 8:35 ` David Miller
2008-08-04 13:03 ` [RFC][PATCH 4/7] lockdep: shrink held_lock structure Peter Zijlstra
2008-08-05 16:08 ` Peter Zijlstra
2008-08-06 7:17 ` Peter Zijlstra
2008-08-04 13:03 ` [RFC][PATCH 5/7] lockdep: map_acquire Peter Zijlstra
2008-08-04 13:03 ` [RFC][PATCH 6/7] lockdep: lock protection locks Peter Zijlstra
2008-08-04 13:03 ` [RFC][PATCH 7/7] lockdep: spin_lock_nest_lock() Peter Zijlstra
2008-08-04 14:07 ` Roland Dreier
2008-08-04 14:19 ` Peter Zijlstra
2008-08-04 14:26 ` Roland Dreier
2008-08-04 14:32 ` Peter Zijlstra
2008-08-04 14:53 ` Dave Jones
2008-08-04 14:56 ` Peter Zijlstra
2008-08-04 16:26 ` Andrea Arcangeli
2008-08-04 16:38 ` Peter Zijlstra
2008-08-04 17:27 ` Andrea Arcangeli
2008-08-04 17:46 ` Andrea Arcangeli
2008-08-04 17:57 ` [PATCH] workaround minor lockdep bug triggered by mm_take_all_locks Andrea Arcangeli
2008-08-04 18:48 ` Peter Zijlstra
2008-08-04 18:56 ` Roland Dreier
2008-08-04 19:05 ` Peter Zijlstra
2008-08-04 20:15 ` Andrea Arcangeli [this message]
2008-08-04 20:37 ` Peter Zijlstra
2008-08-04 21:09 ` Andrea Arcangeli
2008-08-04 21:14 ` Pekka Enberg
2008-08-04 21:30 ` Andrea Arcangeli
2008-08-04 21:41 ` Andrew Morton
2008-08-04 22:12 ` Andrea Arcangeli
2008-08-04 21:42 ` Arjan van de Ven
2008-08-04 22:30 ` Andrea Arcangeli
2008-08-04 23:38 ` Arjan van de Ven
2008-08-05 0:47 ` Andrea Arcangeli
2008-08-04 21:27 ` Arjan van de Ven
2008-08-04 21:54 ` Andrea Arcangeli
2008-08-04 21:57 ` David Miller
2008-08-05 2:00 ` Roland Dreier
2008-08-05 2:18 ` Andrea Arcangeli
2008-08-05 12:02 ` Roland Dreier
2008-08-05 12:20 ` Andrea Arcangeli
2008-08-04 18:48 ` [RFC][PATCH 7/7] lockdep: spin_lock_nest_lock() Peter Zijlstra
2008-08-04 21:32 ` David Miller
2008-08-04 18:06 ` Jeremy Fitzhardinge
2008-08-04 18:54 ` Peter Zijlstra
2008-08-04 19:26 ` Jeremy Fitzhardinge
2008-08-04 19:31 ` Linus Torvalds
2008-08-04 19:39 ` Peter Zijlstra
2008-08-04 20:16 ` Jeremy Fitzhardinge
2008-10-08 15:27 ` Steven Rostedt
2008-10-08 15:43 ` Linus Torvalds
2008-10-08 16:03 ` Steven Rostedt
2008-10-08 16:19 ` Linus Torvalds
2008-10-08 16:53 ` Steven Rostedt
2008-10-08 15:52 ` Nick Piggin
2008-10-08 17:18 ` Steven Rostedt
2008-08-07 11:25 ` Peter Zijlstra
2008-08-07 11:25 ` [RFC][PATCH 8/7] lockdep: annotate mm_take_all_locks() Peter Zijlstra
2008-08-07 11:25 ` [RFC][PATCH 9/7] mm: fix mm_take_all_locks() locking order Peter Zijlstra
2008-08-07 12:14 ` Hugh Dickins
2008-08-07 12:41 ` Peter Zijlstra
2008-08-07 13:27 ` Hugh Dickins
2008-08-07 21:46 ` Andrea Arcangeli
2008-08-08 1:34 ` Andrea Arcangeli
2008-08-08 7:16 ` Peter Zijlstra
2008-08-11 10:08 ` [RFC][PATCH 0/7] lockdep Ingo Molnar
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=20080804201514.GB12464@duo.random \
--to=andrea@qumranet.com \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@linux-foundation.org \
--cc=davej@redhat.com \
--cc=davem@davemloft.net \
--cc=hugh@veritas.com \
--cc=jeremy@goop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=rdreier@cisco.com \
--cc=torvalds@linux-foundation.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox