Skip to content

Commit 3a63017

Browse files
hansendcrostedt
authored andcommitted
tracing: generate RCU warnings even when tracepoints are disabled
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>
1 parent fef5aee commit 3a63017

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

include/linux/tracepoint.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,12 @@ extern void syscall_unregfunc(void);
157157
* Make sure the alignment of the structure in the __tracepoints section will
158158
* not add unwanted padding between the beginning of the section and the
159159
* structure. Force alignment to the same alignment as the section start.
160+
*
161+
* When lockdep is enabled, we make sure to always do the RCU portions of
162+
* the tracepoint code, regardless of whether tracing is on or we match the
163+
* condition. This lets us find RCU issues triggered with tracepoints even
164+
* when this tracepoint is off. This code has no purpose other than poking
165+
* RCU a bit.
160166
*/
161167
#define __DECLARE_TRACE(name, proto, args, cond, data_proto, data_args) \
162168
extern struct tracepoint __tracepoint_##name; \
@@ -167,6 +173,11 @@ extern void syscall_unregfunc(void);
167173
TP_PROTO(data_proto), \
168174
TP_ARGS(data_args), \
169175
TP_CONDITION(cond),,); \
176+
if (IS_ENABLED(CONFIG_LOCKDEP)) { \
177+
rcu_read_lock_sched_notrace(); \
178+
rcu_dereference_sched(__tracepoint_##name.funcs);\
179+
rcu_read_unlock_sched_notrace(); \
180+
} \
170181
} \
171182
__DECLARE_TRACE_RCU(name, PARAMS(proto), PARAMS(args), \
172183
PARAMS(cond), PARAMS(data_proto), PARAMS(data_args)) \

0 commit comments

Comments
 (0)