trace_call__##name() was added by commit 677a3d82b640 ("tracepoint: Add
trace_call__##name() API") to let callers that already gate on
trace_##name##_enabled() skip the redundant static_branch_unlikely()
re-evaluation. The changelog states that the new helper retains the
LOCKDEP RCU-watching assertion carried by trace_##name(), but the
WARN_ONCE() was omitted from both definitions.
Without it, sites converted from trace_foo(args) to trace_call__foo(args)
lose the WARN_ONCE(!rcu_is_watching()) coverage under CONFIG_LOCKDEP when
the tracepoint is enabled - the case that commit c2679254b9c9 ("tracing:
Make tracepoint lockdep check actually test something") added the warning
for.
Mirror the same block in both trace_call__##name() bodies, gated by
(cond) in __DECLARE_TRACE to match its trace_##name() and ungated in
__DECLARE_TRACE_SYSCALL.
Fixes: 677a3d82b640 ("tracepoint: Add trace_call__##name() API")
Cc: Vineeth Pillai (Google) <[email protected]>
Cc: Mathieu Desnoyers <[email protected]>
Cc: Masami Hiramatsu <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Signed-off-by: David Carlier <[email protected]>
---
include/linux/tracepoint.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index 578e520b6ee6..048e0035d4fa 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -318,6 +318,10 @@ static inline struct tracepoint
*tracepoint_ptr_deref(tracepoint_ptr_t *p)
static inline void trace_call__##name(proto) \
{ \
__do_trace_##name(args); \
+ if (IS_ENABLED(CONFIG_LOCKDEP) && (cond)) { \
+ WARN_ONCE(!rcu_is_watching(), \
+ "RCU not watching for tracepoint"); \
+ } \
}
#define __DECLARE_TRACE_SYSCALL(name, proto, args, data_proto) \
@@ -342,6 +346,10 @@ static inline struct tracepoint
*tracepoint_ptr_deref(tracepoint_ptr_t *p)
{ \
might_fault(); \
__do_trace_##name(args); \
+ if (IS_ENABLED(CONFIG_LOCKDEP)) { \
+ WARN_ONCE(!rcu_is_watching(), \
+ "RCU not watching for tracepoint"); \
+ } \
}
/*
--
2.53.0