From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Frederic Weisbecker <fweisbec@gmail.com>,
Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: [PATCH 08/13 -next] tracing/lockdep: Disable lockdep first in entering NMI
Date: Mon, 21 Jan 2013 16:14:11 -0500 [thread overview]
Message-ID: <20130121211728.501681064@goodmis.org> (raw)
In-Reply-To: 20130121211403.337052956@goodmis.org
[-- Attachment #1: 0008-tracing-lockdep-Disable-lockdep-first-in-entering-NM.patch --]
[-- Type: text/plain, Size: 2070 bytes --]
From: Steven Rostedt <srostedt@redhat.com>
When function tracing with either debug locks enabled or tracing
preempt disabled, the add_preempt_count() is traced. This is an
issue with lockdep and function tracing. As function tracing
can disable interrupts, and lockdep records that change,
lockdep may not be able to handle this recursion if it happens from
an NMI context.
The first thing that an NMI does is:
#define nmi_enter() \
do { \
ftrace_nmi_enter(); \
BUG_ON(in_nmi()); \
add_preempt_count(NMI_OFFSET + HARDIRQ_OFFSET); \
lockdep_off(); \
rcu_nmi_enter(); \
trace_hardirq_enter(); \
} while (0)
When the add_preempt_count() is traced, and the tracing callback
disables interrupts, it will jump into the lockdep code. There's
some places in lockdep that can't handle this re-entrance, and
causes lockdep to fail.
As the lockdep_off() (and lockdep_on) is a simple:
void lockdep_off(void)
{
current->lockdep_recursion++;
}
and is never traced, it can be called first in nmi_enter()
and lockdep_on() last in nmi_exit().
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
include/linux/hardirq.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h
index 624ef3f..57bfdce 100644
--- a/include/linux/hardirq.h
+++ b/include/linux/hardirq.h
@@ -180,10 +180,10 @@ extern void irq_exit(void);
#define nmi_enter() \
do { \
+ lockdep_off(); \
ftrace_nmi_enter(); \
BUG_ON(in_nmi()); \
add_preempt_count(NMI_OFFSET + HARDIRQ_OFFSET); \
- lockdep_off(); \
rcu_nmi_enter(); \
trace_hardirq_enter(); \
} while (0)
@@ -192,10 +192,10 @@ extern void irq_exit(void);
do { \
trace_hardirq_exit(); \
rcu_nmi_exit(); \
- lockdep_on(); \
BUG_ON(!in_nmi()); \
sub_preempt_count(NMI_OFFSET + HARDIRQ_OFFSET); \
ftrace_nmi_exit(); \
+ lockdep_on(); \
} while (0)
#endif /* LINUX_HARDIRQ_H */
--
1.7.10.4
next prev parent reply other threads:[~2013-01-21 21:18 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-21 21:14 [PATCH 00/13 -next] [For linux-next] tracing: Review of changes Steven Rostedt
2013-01-21 21:14 ` [PATCH 01/13 -next] tracing: Fix sparse warning with is_signed_type() macro Steven Rostedt
2013-01-21 21:14 ` [PATCH 02/13 -next] ring-buffer: Remove unnecessary recusive call in rb_advance_iter() Steven Rostedt
2013-01-21 21:14 ` [PATCH 03/13 -next] tracing: Use this_cpu_ptr per-cpu helper Steven Rostedt
2013-01-21 21:14 ` [PATCH 04/13 -next] tracing: Verify target file before registering a uprobe event Steven Rostedt
2013-01-21 21:14 ` [PATCH 05/13 -next] tracing/syscalls: Make local functions static Steven Rostedt
2013-01-21 21:14 ` [PATCH 06/13 -next] tracing: Add checks if tr->buffer is NULL in tracing_reset{_online_cpus} Steven Rostedt
2013-01-21 21:14 ` [PATCH 07/13 -next] tracing: Remove unneeded check of max_tr->buffer before tracing_reset Steven Rostedt
2013-01-21 21:14 ` Steven Rostedt [this message]
2013-01-21 21:14 ` [PATCH 09/13 -next] tracing/fgraph: Add max_graph_depth to limit function_graph depth Steven Rostedt
2013-01-21 21:14 ` [PATCH 10/13 -next] ftrace: Move ARCH_SUPPORTS_FTRACE_SAVE_REGS in Kconfig Steven Rostedt
2013-01-21 21:14 ` [PATCH 11/13 -next] kprobes/x86: Move ftrace-based kprobe code into kprobes-ftrace.c Steven Rostedt
2013-01-21 21:14 ` [PATCH 12/13 -next] kprobes/x86: Move kprobes stuff under arch/x86/kernel/kprobes/ Steven Rostedt
2013-01-21 21:14 ` [PATCH 13/13 -next] tracing: Remove the extra 4 bytes of padding in events Steven Rostedt
2013-01-21 23:13 ` Arjan van de Ven
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=20130121211728.501681064@goodmis.org \
--to=rostedt@goodmis.org \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@linux-foundation.org \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.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