From: David Carlier <devnexen@gmail.com>
To: linux-trace-kernel@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, rostedt@goodmis.org,
mhiramat@kernel.org, mathieu.desnoyers@efficios.com,
peterz@infradead.org, vineeth@bitbyteword.org,
David Carlier <devnexen@gmail.com>
Subject: [PATCH v2] tracepoint: add lockdep rcu_is_watching() check to trace_##name##_enabled()
Date: Thu, 30 Apr 2026 15:41:59 +0100 [thread overview]
Message-ID: <20260430144159.10985-1-devnexen@gmail.com> (raw)
In-Reply-To: <20260430053511.8767-1-devnexen@gmail.com>
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")
Cc: Vineeth Pillai (Google) <vineeth@bitbyteword.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: David Carlier <devnexen@gmail.com>
---
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);\
}
--
2.53.0
next prev parent reply other threads:[~2026-04-30 14:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-30 5:35 [PATCH] tracepoint: add lockdep rcu_is_watching() check to trace_call__##name() David Carlier
2026-04-30 13:35 ` Steven Rostedt
2026-04-30 14:41 ` David Carlier [this message]
2026-04-30 20:01 ` [PATCH v2] tracepoint: add lockdep rcu_is_watching() check to trace_##name##_enabled() Steven Rostedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260430144159.10985-1-devnexen@gmail.com \
--to=devnexen@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=vineeth@bitbyteword.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox