On Thu, 30 Apr 2026 15:41:59 +0100
David Carlier <[email protected]> wrote:
> trace_call__##name() was added by commit 677a3d82b640 ("tracepoint: Add
> trace_call__##name() API") for callers that already gate on
> trace_##name##_enabled(), letting them skip the redundant
> static_branch_unlikely() re-evaluation. The LOCKDEP rcu_is_watching()
> WARN_ONCE() that trace_##name() carries on the disabled path was not
> mirrored, so the cold-path coverage added by commit c2679254b9c9
> ("tracing: Make tracepoint lockdep check actually test something") is
> lost for trace_call__##name() callers when the tracepoint is disabled.
>
> When the tracepoint is enabled, the rcu_dereference inside
> __DO_TRACE_CALL() already trips under PROVE_RCU, so the warning is
> only needed on the !enabled path. The natural place is the gate that
> trace_call__##name() callers consult: trace_##name##_enabled().
>
> Fixes: 677a3d82b640 ("tracepoint: Add trace_call__##name() API")
Thanks, but I'm 86'ing the Fixes tag. The above commit has absolutely
nothing to do with this patch. This issue was there from the beginning of
having the trace_*_enabled() macro. This isn't a fix.
I'll modify the change log to be more accurate as well.
-- Steve
> 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 | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
> index 578e520b6ee6..3b3ab19c2627 100644
> --- a/include/linux/tracepoint.h
> +++ b/include/linux/tracepoint.h
> @@ -293,6 +293,10 @@ static inline struct tracepoint
> *tracepoint_ptr_deref(tracepoint_ptr_t *p)
> static inline bool \
> trace_##name##_enabled(void) \
> { \
> + if (IS_ENABLED(CONFIG_LOCKDEP)) { \
> + WARN_ONCE(!rcu_is_watching(), \
> + "RCU not watching for tracepoint"); \
> + } \
> return static_branch_unlikely(&__tracepoint_##name.key);\
> }
>