From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
Ingo Molnar <mingo@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Dave Hansen <dave.hansen@linux.intel.com>,
Dave Hansen <dave@sr71.net>, <paulmck@linux.vnet.ibm.com>,
Ingo Molnar <mingo@redhat.com>
Subject: [PATCH 08/11] tracing: generate RCU warnings even when tracepoints are disabled
Date: Mon, 06 Oct 2014 17:35:52 -0400 [thread overview]
Message-ID: <20141006213631.352752419@goodmis.org> (raw)
In-Reply-To: 20141006213544.344821619@goodmis.org
[-- Attachment #1: 0008-tracing-generate-RCU-warnings-even-when-tracepoints-.patch --]
[-- Type: text/plain, Size: 2692 bytes --]
From: Dave Hansen <dave.hansen@linux.intel.com>
Dave Jones reported seeing a bug from one of my TLB tracepoints:
http://lkml.kernel.org/r/20140806181801.GA4605@redhat.com
I've been running these patches for months and never saw this.
But, a big chunk of my testing, especially with all the debugging
enabled, was in a vm where intel_idle doesn't work. On the
systems where I was using intel_idle, I never had lockdep enabled
and this tracepoint on at the same time.
This patch ensures that whenever we have lockdep available, we do
_some_ RCU activity at the site of the tracepoint, despite
whether the tracepoint's condition matches or even if the
tracepoint itself is completely disabled. This is a bit of a
hack, but it is pretty self-contained.
I confirmed that with this patch plus lockdep I get the same
splat as Dave Jones did, but without enabling the tracepoint
explicitly.
Link: http://lkml.kernel.org/p/20140807175204.C257CAC5@viggo.jf.intel.com
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Dave Hansen <dave@sr71.net>
Cc: Dave Jones <davej@redhat.com>,
Cc: paulmck@linux.vnet.ibm.com
Cc: Ingo Molnar <mingo@redhat.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
include/linux/tracepoint.h | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index b1293f15f592..e08e21e5f601 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -157,6 +157,12 @@ extern void syscall_unregfunc(void);
* Make sure the alignment of the structure in the __tracepoints section will
* not add unwanted padding between the beginning of the section and the
* structure. Force alignment to the same alignment as the section start.
+ *
+ * When lockdep is enabled, we make sure to always do the RCU portions of
+ * the tracepoint code, regardless of whether tracing is on or we match the
+ * condition. This lets us find RCU issues triggered with tracepoints even
+ * when this tracepoint is off. This code has no purpose other than poking
+ * RCU a bit.
*/
#define __DECLARE_TRACE(name, proto, args, cond, data_proto, data_args) \
extern struct tracepoint __tracepoint_##name; \
@@ -167,6 +173,11 @@ extern void syscall_unregfunc(void);
TP_PROTO(data_proto), \
TP_ARGS(data_args), \
TP_CONDITION(cond),,); \
+ if (IS_ENABLED(CONFIG_LOCKDEP)) { \
+ rcu_read_lock_sched_notrace(); \
+ rcu_dereference_sched(__tracepoint_##name.funcs);\
+ rcu_read_unlock_sched_notrace(); \
+ } \
} \
__DECLARE_TRACE_RCU(name, PARAMS(proto), PARAMS(args), \
PARAMS(cond), PARAMS(data_proto), PARAMS(data_args)) \
--
2.0.1
next prev parent reply other threads:[~2014-10-06 21:37 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-06 21:35 [PATCH 00/11] [GIT PULL] tracing: Updates for 3.18 Steven Rostedt
2014-10-06 21:35 ` [PATCH 01/11] ftrace: Add separate function for non recursive callbacks Steven Rostedt
2014-10-06 21:35 ` [PATCH 02/11] ftrace: Add helper function ftrace_ops_get_func() Steven Rostedt
2014-10-06 21:35 ` [PATCH 03/11] ftrace: Set callback to ftrace_stub when no ops are registered Steven Rostedt
2014-10-06 21:35 ` [PATCH 04/11] ftrace: Remove freeing of old_hash from ftrace_hash_move() Steven Rostedt
2014-10-06 21:35 ` [PATCH 05/11] ftrace: Grab any ops for a rec for enabled_functions output Steven Rostedt
2014-10-06 21:35 ` [PATCH 06/11] ftrace: Annotate the ops operation on update Steven Rostedt
2014-10-06 21:35 ` [PATCH 07/11] ftrace: Replace tramp_hash with old_*_hash to save space Steven Rostedt
2014-10-06 21:35 ` Steven Rostedt [this message]
2014-10-07 2:39 ` [PATCH 08/11] tracing: generate RCU warnings even when tracepoints are disabled Paul E. McKenney
2014-10-06 21:35 ` [PATCH 09/11] kernel: trace_syscalls: Replace rcu_assign_pointer() with RCU_INIT_POINTER() Steven Rostedt
2014-10-06 21:35 ` [PATCH 10/11] ftrace: Add sanity check when unregistering last ftrace_ops Steven Rostedt
2014-10-06 21:35 ` [PATCH 11/11] ftrace: Only disable ftrace_enabled to test buffer in selftest Steven Rostedt
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=20141006213631.352752419@goodmis.org \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=dave.hansen@linux.intel.com \
--cc=dave@sr71.net \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=mingo@redhat.com \
--cc=paulmck@linux.vnet.ibm.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;
as well as URLs for NNTP newsgroup(s).