The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@kernel.org>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: David Carlier <devnexen@gmail.com>,
	linux-kernel@vger.kernel.org,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	"Vineeth Pillai (Google)" <vineeth@bitbyteword.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>,
	Linux-Renesas <linux-renesas-soc@vger.kernel.org>
Subject: Re: [for-next][PATCH 04/15] tracepoint: Add lockdep rcu_is_watching() check to trace_##name##_enabled()
Date: Wed, 1 Jul 2026 13:11:57 -0400	[thread overview]
Message-ID: <20260701131157.3fc4c695@robin> (raw)
In-Reply-To: <CAMuHMdUdsTHCMnitVEHdZvRFe9xgmLLTjSr=QqvOi0dxFjkTEA@mail.gmail.com>

On Wed, 1 Jul 2026 11:24:31 +0200
Geert Uytterhoeven <geert@linux-m68k.org> wrote:

> Thanks, it does not trigger with the commit reverted and the "echo 1 > ...".

Ah found the issue;

#define trace(point, args)                                      \
        do {                                                    \
                if (trace_##point##_enabled()) {                \
                        bool exit_rcu = false;                  \
                        if (in_nmi())                           \
                                break;                          \
                        if (!IS_ENABLED(CONFIG_TINY_RCU) &&     \
                            is_idle_task(current)) {            \
                                ct_irq_enter();                 \
                                exit_rcu = true;                \
                        }                                       \
                        trace_##point(args);                    \
                        if (exit_rcu)                           \
                                ct_irq_exit();                  \
                }                                               \
        } while (0)
#endif

The code within the enabled() call checks if RCU is watching, and if
not, it makes it watch. So yeah, this is a special case.

The following patch should fix the issue:

diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index 4a0c36f40fe2..e0d838c9ce93 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -292,13 +292,18 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)
 	{								\
 	}								\
 	static inline bool						\
+	__trace_##name##_enabled(void)					\
+	{								\
+		return static_branch_unlikely(&__tracepoint_##name.key);\
+	}								\
+	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);\
+		return __trace_##name##_enabled();			\
 	}
 
 #define __DECLARE_TRACE(name, proto, args, cond, data_proto)			\
@@ -457,6 +462,11 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)
 	{								\
 	}								\
 	static inline bool						\
+	__trace_##name##_enabled(void)					\
+	{								\
+		return false;						\
+	}								\
+	static inline bool						\
 	trace_##name##_enabled(void)					\
 	{								\
 		return false;						\
diff --git a/kernel/trace/trace_preemptirq.c b/kernel/trace/trace_preemptirq.c
index 0c42b15c3800..b63e3558948f 100644
--- a/kernel/trace/trace_preemptirq.c
+++ b/kernel/trace/trace_preemptirq.c
@@ -30,7 +30,7 @@
 #else
 #define trace(point, args)					\
 	do {							\
-		if (trace_##point##_enabled()) {		\
+		if (__trace_##point##_enabled()) {		\
 			bool exit_rcu = false;			\
 			if (in_nmi())				\
 				break;				\

  reply	other threads:[~2026-07-01 17:12 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-22 14:35 [for-next][PATCH 00/15] tracing: Updates for 7.2 Steven Rostedt
2026-05-22 14:35 ` [for-next][PATCH 01/15] tracing: Remove redundant IS_ERR() check in trace_pipe_open() Steven Rostedt
2026-05-22 14:35 ` [for-next][PATCH 02/15] seq_buf: Export seq_buf_putmem_hex() and add KUnit tests Steven Rostedt
2026-05-22 14:35 ` [for-next][PATCH 03/15] tracing: Bound synthetic-field strings with seq_buf Steven Rostedt
2026-05-22 14:35 ` [for-next][PATCH 04/15] tracepoint: Add lockdep rcu_is_watching() check to trace_##name##_enabled() Steven Rostedt
2026-06-30 17:39   ` Geert Uytterhoeven
2026-06-30 19:53     ` Steven Rostedt
2026-07-01  9:24       ` Geert Uytterhoeven
2026-07-01 17:11         ` Steven Rostedt [this message]
2026-05-22 14:35 ` [for-next][PATCH 05/15] tracing: Remove local variable for argument detection from trace_printk() Steven Rostedt
2026-05-22 14:35 ` [for-next][PATCH 06/15] tracing: Switch trace_recursion_record.c code over to use guard() Steven Rostedt
2026-05-22 14:35 ` [for-next][PATCH 07/15] tracefs: Fix typo in a comment of eventfs_callback() kerneldoc Steven Rostedt
2026-05-22 14:35 ` [for-next][PATCH 08/15] cpufreq: amd-pstate: Use trace_call__##name() at guarded tracepoint call site Steven Rostedt
2026-05-22 14:35 ` [for-next][PATCH 09/15] HID: Use trace_call__##name() at guarded tracepoint call sites Steven Rostedt
2026-05-22 14:35 ` [for-next][PATCH 10/15] tracing: Allow perf to read synthetic events Steven Rostedt
2026-05-22 15:19   ` Ian Rogers
2026-05-22 15:41     ` Steven Rostedt
2026-05-22 16:03       ` Namhyung Kim
2026-05-22 14:35 ` [for-next][PATCH 11/15] tracing/branch: Use pr_warn() instead of printk(KERN_WARNING) Steven Rostedt
2026-05-22 14:35 ` [for-next][PATCH 12/15] tracing: Use krealloc_array() for trace option array growth Steven Rostedt
2026-05-22 14:35 ` [for-next][PATCH 13/15] tracing: Fix README path for synthetic_events Steven Rostedt
2026-05-22 14:35 ` [for-next][PATCH 14/15] tracing: Simplify pages allocation for tracing_map logic Steven Rostedt
2026-05-22 14:35 ` [for-next][PATCH 15/15] tracing: Move trace_iterator_increment() into trace_find_next_entry_inc() 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=20260701131157.3fc4c695@robin \
    --to=rostedt@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=devnexen@gmail.com \
    --cc=geert@linux-m68k.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.org \
    --cc=peterz@infradead.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