Skip to content

Commit 1b27312

Browse files
committed
tracepoints: Use WARN() and not WARN_ON() for warnings
There are two WARN_ON*() warnings in tracepoint.h that deal with RCU usage. But when they trigger, especially from using a TRACE_EVENT() macro, the information is not very helpful and is confusing: ------------[ cut here ]------------ WARNING: CPU: 0 PID: 0 at include/trace/events/lock.h:24 lock_acquire+0x2b2/0x2d0 Where the above warning takes you to: TRACE_EVENT(lock_acquire, <<<--- line 24 in lock.h TP_PROTO(struct lockdep_map *lock, unsigned int subclass, int trylock, int read, int check, struct lockdep_map *next_lock, unsigned long ip), [..] Change the WARN_ON_ONCE() to WARN_ONCE() and add a string that allows someone to search for exactly where the bug happened. Link: https://lore.kernel.org/linux-trace-kernel/[email protected] Cc: Masami Hiramatsu <[email protected]> Cc: Mathieu Desnoyers <[email protected]> Cc: Thomas Gleixner <[email protected]> Reported-by: Borislav Petkov <[email protected]> Tested-by: Borislav Petkov (AMD) <[email protected]> Reviewed-by: Paul E. McKenney <[email protected]> Signed-off-by: Steven Rostedt (Google) <[email protected]>
1 parent d6cb38e commit 1b27312

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

include/linux/tracepoint.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,8 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)
199199
if (!(cond)) \
200200
return; \
201201
\
202-
if (WARN_ON_ONCE(RCUIDLE_COND(rcuidle))) \
202+
if (WARN_ONCE(RCUIDLE_COND(rcuidle), \
203+
"Bad RCU usage for tracepoint")) \
203204
return; \
204205
\
205206
/* keep srcu and sched-rcu usage consistent */ \
@@ -259,7 +260,8 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)
259260
TP_ARGS(args), \
260261
TP_CONDITION(cond), 0); \
261262
if (IS_ENABLED(CONFIG_LOCKDEP) && (cond)) { \
262-
WARN_ON_ONCE(!rcu_is_watching()); \
263+
WARN_ONCE(!rcu_is_watching(), \
264+
"RCU not watching for tracepoint"); \
263265
} \
264266
} \
265267
__DECLARE_TRACE_RCU(name, PARAMS(proto), PARAMS(args), \

0 commit comments

Comments
 (0)