From: Steven Rostedt <rostedt@goodmis.org>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: netdev@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Patrick McHardy <kaber@trash.net>, Ingo Molnar <mingo@elte.hu>,
Peter Zijlstra <peterz@infradead.org>
Subject: Re: [LOCKDEP BUG][2.6.36-rc1] xt_info_wrlock?
Date: Mon, 16 Aug 2010 14:16:06 -0400 [thread overview]
Message-ID: <1281982566.3268.137.camel@gandalf.stny.rr.com> (raw)
In-Reply-To: <1281981301.3268.110.camel@gandalf.stny.rr.com>
On Mon, 2010-08-16 at 13:55 -0400, Steven Rostedt wrote:
Re-looking at the code, I think I figured it out. But it should really
be documented better.
>
> Please tell me what prevents an interrupt going off after we grab the
> xt_info_wrlock(cpu) in get_counters().
>
> IOW, what prevents this:
>
> get_counters() {
I left out here:
for_each_possible_cpu(cpu) {
if (cpu == curcpu)
continue;
which means that we are grabbing the lock for other CPUs, and that a
softirq would not be a problem.
> xt_info_wrlock(cpu);
>
> <interrupt> --> softirq
>
> xt_info_rblock_bh();
> /* which grabs the writer lock */
> DEADLOCK!!
>
Your patchwork patch has:
@@ -729,8 +729,10 @@ static void get_counters(const struct
xt_table_info *t,
local_bh_enable();
/* Processing counters from other cpus, we can let bottom half enabled,
* (preemption is disabled)
+ * We must turn off lockdep to avoid a false positive.
*/
+ lockdep_off();
for_each_possible_cpu(cpu) {
We need a better comment than that. Could that be changed to something like:
/*
* lockdep tests if we grab a lock and can be preempted by
* a softirq and that softirq grabs the same lock causing a
* deadlock.
* This is a special case because this is a per-cpu lock,
* and we are only grabbing the lock for other CPUs. A softirq
* will only takes its local CPU lock thus, if we are preempted
* by a softirq, then it will grab the current CPU lock which
* we do not take here.
*
* Simply disable lockdep here until it can handle this situation.
*/
Thanks,
-- Steve
next prev parent reply other threads:[~2010-08-16 18:16 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-16 17:07 Steven Rostedt
2010-08-16 17:31 ` Eric Dumazet
2010-08-16 17:55 ` Steven Rostedt
2010-08-16 18:16 ` Steven Rostedt [this message]
2010-08-16 18:36 ` Peter Zijlstra
2010-08-16 18:48 ` Eric Dumazet
2010-08-16 19:16 ` Peter Zijlstra
2010-08-16 19:35 ` Eric Dumazet
2010-08-16 20:01 ` Peter Zijlstra
2010-08-16 20:17 ` Eric Dumazet
2010-08-16 18:48 ` Eric Dumazet
2010-08-16 19:44 ` David Miller
2010-08-16 20:04 ` Peter Zijlstra
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=1281982566.3268.137.camel@gandalf.stny.rr.com \
--to=rostedt@goodmis.org \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=kaber@trash.net \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=netdev@vger.kernel.org \
--cc=peterz@infradead.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
all inboxes | Powered by JetHome®