Commit 409b0c0169147e8e392886ca441cc95e314b5faf

Authored by Steven Rostedt (Red Hat)
Committed by Greg Kroah-Hartman
1 parent fef76eabdf

tracing: Add condition check to RCU lockdep checks

commit a05d59a5673339ef6936d6940cdf68172ce75b9f upstream.

The trace_tlb_flush() tracepoint can be called when a CPU is going offline.
When a CPU is offline, RCU is no longer watching that CPU and since the
tracepoint is protected by RCU, it must not be called. To prevent the
tlb_flush tracepoint from being called when the CPU is offline, it was
converted to a TRACE_EVENT_CONDITION where the condition checks if the
CPU is online before calling the tracepoint.

Unfortunately, this was not enough to stop lockdep from complaining about
it. Even though the RCU protected code of the tracepoint will never be
called, the condition is hidden within the tracepoint, and even though the
condition prevents RCU code from being called, the lockdep checks are
outside the tracepoint (this is to test tracepoints even when they are not
enabled).

Even though tracepoints should be checked to be RCU safe when they are not
enabled, the condition should still be considered when checking RCU.

Link: http://lkml.kernel.org/r/CA+icZUUGiGDoL5NU8RuxKzFjoLjEKRtUWx=JB8B9a0EQv-eGzQ@mail.gmail.com

Fixes: 3a630178fd5f "tracing: generate RCU warnings even when tracepoints are disabled"
Acked-by: Dave Hansen <dave@sr71.net>
Reported-by: Sedat Dilek <sedat.dilek@gmail.com>
Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Showing 1 changed file with 1 additions and 1 deletions Side-by-side Diff

include/linux/tracepoint.h
... ... @@ -173,7 +173,7 @@
173 173 TP_PROTO(data_proto), \
174 174 TP_ARGS(data_args), \
175 175 TP_CONDITION(cond),,); \
176   - if (IS_ENABLED(CONFIG_LOCKDEP)) { \
  176 + if (IS_ENABLED(CONFIG_LOCKDEP) && (cond)) { \
177 177 rcu_read_lock_sched_notrace(); \
178 178 rcu_dereference_sched(__tracepoint_##name.funcs);\
179 179 rcu_read_unlock_sched_notrace(); \