public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [for-next][PATCH 0/4] tracing: Updates for v6.20
@ 2026-01-30 15:46 Steven Rostedt
  2026-01-30 15:46 ` [for-next][PATCH 1/4] tracing: perf: Have perf tracepoint callbacks always disable preemption Steven Rostedt
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Steven Rostedt @ 2026-01-30 15:46 UTC (permalink / raw)
  To: linux-kernel
  Cc: Masami Hiramatsu, Mark Rutland, Mathieu Desnoyers, Andrew Morton,
	Paul E. McKenney

  git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git
trace/for-next

Head SHA1: a46023d5616ed3ed781e56ca93400eb9490e3646


Paul E. McKenney (1):
      srcu: Fix warning to permit SRCU-fast readers in NMI handlers

Steven Rostedt (3):
      tracing: perf: Have perf tracepoint callbacks always disable preemption
      bpf: Have __bpf_trace_run() use rcu_read_lock_dont_migrate()
      tracing: Guard __DECLARE_TRACE() use of __DO_TRACE_CALL() with SRCU-fast

----
 include/linux/tracepoint.h   |  9 +++++----
 include/trace/perf.h         |  4 ++--
 include/trace/trace_events.h |  4 ++--
 kernel/rcu/srcutree.c        |  3 ++-
 kernel/trace/bpf_trace.c     |  5 ++---
 kernel/tracepoint.c          | 18 ++++++++++++++----
 6 files changed, 27 insertions(+), 16 deletions(-)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [for-next][PATCH 1/4] tracing: perf: Have perf tracepoint callbacks always disable preemption
  2026-01-30 15:46 [for-next][PATCH 0/4] tracing: Updates for v6.20 Steven Rostedt
@ 2026-01-30 15:46 ` Steven Rostedt
  2026-01-30 15:46 ` [for-next][PATCH 2/4] bpf: Have __bpf_trace_run() use rcu_read_lock_dont_migrate() Steven Rostedt
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Steven Rostedt @ 2026-01-30 15:46 UTC (permalink / raw)
  To: linux-kernel
  Cc: Masami Hiramatsu, Mark Rutland, Mathieu Desnoyers, Andrew Morton,
	Paul E. McKenney, Sebastian Andrzej Siewior, Alexei Starovoitov

From: Steven Rostedt <rostedt@goodmis.org>

In preparation to convert protection of tracepoints from being protected
by a preempt disabled section to being protected by SRCU, have all the
perf callbacks disable preemption as perf expects preemption to be
disabled when processing tracepoints.

While at it, convert the perf system call callback preempt_disable() to a
guard(preempt).

Link: https://lore.kernel.org/all/20250613152218.1924093-1-bigeasy@linutronix.de/
Link: https://patch.msgid.link/20260108220550.2f6638f3@fedora

Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: "Paul E. McKenney" <paulmck@kernel.org>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20260126231256.174621257@kernel.org
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 include/trace/perf.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/trace/perf.h b/include/trace/perf.h
index a1754b73a8f5..348ad1d9b556 100644
--- a/include/trace/perf.h
+++ b/include/trace/perf.h
@@ -71,6 +71,7 @@ perf_trace_##call(void *__data, proto)					\
 	u64 __count __attribute__((unused));				\
 	struct task_struct *__task __attribute__((unused));		\
 									\
+	guard(preempt_notrace)();					\
 	do_perf_trace_##call(__data, args);				\
 }
 
@@ -85,9 +86,8 @@ perf_trace_##call(void *__data, proto)					\
 	struct task_struct *__task __attribute__((unused));		\
 									\
 	might_fault();							\
-	preempt_disable_notrace();					\
+	guard(preempt_notrace)();					\
 	do_perf_trace_##call(__data, args);				\
-	preempt_enable_notrace();					\
 }
 
 /*
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [for-next][PATCH 2/4] bpf: Have __bpf_trace_run() use rcu_read_lock_dont_migrate()
  2026-01-30 15:46 [for-next][PATCH 0/4] tracing: Updates for v6.20 Steven Rostedt
  2026-01-30 15:46 ` [for-next][PATCH 1/4] tracing: perf: Have perf tracepoint callbacks always disable preemption Steven Rostedt
@ 2026-01-30 15:46 ` Steven Rostedt
  2026-01-30 15:46 ` [for-next][PATCH 3/4] srcu: Fix warning to permit SRCU-fast readers in NMI handlers Steven Rostedt
  2026-01-30 15:46 ` [for-next][PATCH 4/4] tracing: Guard __DECLARE_TRACE() use of __DO_TRACE_CALL() with SRCU-fast Steven Rostedt
  3 siblings, 0 replies; 8+ messages in thread
From: Steven Rostedt @ 2026-01-30 15:46 UTC (permalink / raw)
  To: linux-kernel
  Cc: Masami Hiramatsu, Mark Rutland, Mathieu Desnoyers, Andrew Morton,
	Paul E. McKenney, Sebastian Andrzej Siewior, Alexei Starovoitov,
	Alexei Starovoitov

From: Steven Rostedt <rostedt@goodmis.org>

In order to switch the protection of tracepoint callbacks from
preempt_disable() to srcu_read_lock_fast() the BPF callback from
tracepoints needs to have migration prevention as the BPF programs expect
to stay on the same CPU as they execute. Put together the RCU protection
with migration prevention and use rcu_read_lock_dont_migrate() in
__bpf_trace_run(). This will allow tracepoints callbacks to be
preemptible.

Link: https://lore.kernel.org/all/CAADnVQKvY026HSFGOsavJppm3-Ajm-VsLzY-OeFUe+BaKMRnDg@mail.gmail.com/

Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: "Paul E. McKenney" <paulmck@kernel.org>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20260126231256.335034877@kernel.org
Suggested-by: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 kernel/trace/bpf_trace.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
index fe28d86f7c35..abbf0177ad20 100644
--- a/kernel/trace/bpf_trace.c
+++ b/kernel/trace/bpf_trace.c
@@ -2062,7 +2062,7 @@ void __bpf_trace_run(struct bpf_raw_tp_link *link, u64 *args)
 	struct bpf_run_ctx *old_run_ctx;
 	struct bpf_trace_run_ctx run_ctx;
 
-	cant_sleep();
+	rcu_read_lock_dont_migrate();
 	if (unlikely(this_cpu_inc_return(*(prog->active)) != 1)) {
 		bpf_prog_inc_misses_counter(prog);
 		goto out;
@@ -2071,13 +2071,12 @@ void __bpf_trace_run(struct bpf_raw_tp_link *link, u64 *args)
 	run_ctx.bpf_cookie = link->cookie;
 	old_run_ctx = bpf_set_run_ctx(&run_ctx.run_ctx);
 
-	rcu_read_lock();
 	(void) bpf_prog_run(prog, args);
-	rcu_read_unlock();
 
 	bpf_reset_run_ctx(old_run_ctx);
 out:
 	this_cpu_dec(*(prog->active));
+	rcu_read_unlock_migrate();
 }
 
 #define UNPACK(...)			__VA_ARGS__
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [for-next][PATCH 3/4] srcu: Fix warning to permit SRCU-fast readers in NMI handlers
  2026-01-30 15:46 [for-next][PATCH 0/4] tracing: Updates for v6.20 Steven Rostedt
  2026-01-30 15:46 ` [for-next][PATCH 1/4] tracing: perf: Have perf tracepoint callbacks always disable preemption Steven Rostedt
  2026-01-30 15:46 ` [for-next][PATCH 2/4] bpf: Have __bpf_trace_run() use rcu_read_lock_dont_migrate() Steven Rostedt
@ 2026-01-30 15:46 ` Steven Rostedt
  2026-01-30 15:51   ` Boqun Feng
  2026-01-30 15:46 ` [for-next][PATCH 4/4] tracing: Guard __DECLARE_TRACE() use of __DO_TRACE_CALL() with SRCU-fast Steven Rostedt
  3 siblings, 1 reply; 8+ messages in thread
From: Steven Rostedt @ 2026-01-30 15:46 UTC (permalink / raw)
  To: linux-kernel
  Cc: Masami Hiramatsu, Mark Rutland, Mathieu Desnoyers, Andrew Morton,
	Paul E. McKenney, Andrii Nakryiko, Boqun Feng, Alexei Starovoitov,
	Peter Zijlstra, bpf

From: "Paul E. McKenney" <paulmck@kernel.org>

SRCU-fast is designed to be used in NMI handlers, even going so far
as to use atomic operations for architectures supporting NMIs but not
providing NMI-safe per-CPU atomic operations.  However, the WARN_ON_ONCE()
in __srcu_check_read_flavor() complains if SRCU-fast is used in an NMI
handler.  This commit therefore modifies that WARN_ON_ONCE() to avoid
such complaints.

Reported-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Tested-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Andrii Nakryiko <andrii@kernel.org>
Cc: Boqun Feng <boqun@kernel.org>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: bpf@vger.kernel.org
Link: https://patch.msgid.link/8232efe8-a7a3-446c-af0b-19f9b523b4f7@paulmck-laptop
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 kernel/rcu/srcutree.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/rcu/srcutree.c b/kernel/rcu/srcutree.c
index ea3f128de06f..c4a0a93e8da4 100644
--- a/kernel/rcu/srcutree.c
+++ b/kernel/rcu/srcutree.c
@@ -789,7 +789,8 @@ void __srcu_check_read_flavor(struct srcu_struct *ssp, int read_flavor)
 	struct srcu_data *sdp;
 
 	/* NMI-unsafe use in NMI is a bad sign, as is multi-bit read_flavor values. */
-	WARN_ON_ONCE((read_flavor != SRCU_READ_FLAVOR_NMI) && in_nmi());
+	WARN_ON_ONCE(read_flavor != SRCU_READ_FLAVOR_NMI &&
+		     read_flavor != SRCU_READ_FLAVOR_FAST && in_nmi());
 	WARN_ON_ONCE(read_flavor & (read_flavor - 1));
 
 	sdp = raw_cpu_ptr(ssp->sda);
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [for-next][PATCH 4/4] tracing: Guard __DECLARE_TRACE() use of __DO_TRACE_CALL() with SRCU-fast
  2026-01-30 15:46 [for-next][PATCH 0/4] tracing: Updates for v6.20 Steven Rostedt
                   ` (2 preceding siblings ...)
  2026-01-30 15:46 ` [for-next][PATCH 3/4] srcu: Fix warning to permit SRCU-fast readers in NMI handlers Steven Rostedt
@ 2026-01-30 15:46 ` Steven Rostedt
  3 siblings, 0 replies; 8+ messages in thread
From: Steven Rostedt @ 2026-01-30 15:46 UTC (permalink / raw)
  To: linux-kernel
  Cc: Masami Hiramatsu, Mark Rutland, Mathieu Desnoyers, Andrew Morton,
	Paul E. McKenney, Sebastian Andrzej Siewior, Alexei Starovoitov

From: Steven Rostedt <rostedt@goodmis.org>

The current use of guard(preempt_notrace)() within __DECLARE_TRACE()
to protect invocation of __DO_TRACE_CALL() means that BPF programs
attached to tracepoints are non-preemptible.  This is unhelpful in
real-time systems, whose users apparently wish to use BPF while also
achieving low latencies.  (Who knew?)

One option would be to use preemptible RCU, but this introduces
many opportunities for infinite recursion, which many consider to
be counterproductive, especially given the relatively small stacks
provided by the Linux kernel.  These opportunities could be shut down
by sufficiently energetic duplication of code, but this sort of thing
is considered impolite in some circles.

Therefore, use the shiny new SRCU-fast API, which provides somewhat faster
readers than those of preemptible RCU, at least on Paul E. McKenney's
laptop, where task_struct access is more expensive than access to per-CPU
variables.  And SRCU-fast provides way faster readers than does SRCU,
courtesy of being able to avoid the read-side use of smp_mb().  Also,
it is quite straightforward to create srcu_read_{,un}lock_fast_notrace()
functions.

Link: https://lore.kernel.org/all/20250613152218.1924093-1-bigeasy@linutronix.de/

Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20260126231256.499701982@kernel.org
Co-developed-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 include/linux/tracepoint.h   |  9 +++++----
 include/trace/trace_events.h |  4 ++--
 kernel/tracepoint.c          | 18 ++++++++++++++----
 3 files changed, 21 insertions(+), 10 deletions(-)

diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index 8a56f3278b1b..22ca1c8b54f3 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -108,14 +108,15 @@ void for_each_tracepoint_in_module(struct module *mod,
  * An alternative is to use the following for batch reclaim associated
  * with a given tracepoint:
  *
- * - tracepoint_is_faultable() == false: call_rcu()
+ * - tracepoint_is_faultable() == false: call_srcu()
  * - tracepoint_is_faultable() == true:  call_rcu_tasks_trace()
  */
 #ifdef CONFIG_TRACEPOINTS
+extern struct srcu_struct tracepoint_srcu;
 static inline void tracepoint_synchronize_unregister(void)
 {
 	synchronize_rcu_tasks_trace();
-	synchronize_rcu();
+	synchronize_srcu(&tracepoint_srcu);
 }
 static inline bool tracepoint_is_faultable(struct tracepoint *tp)
 {
@@ -275,13 +276,13 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)
 		return static_branch_unlikely(&__tracepoint_##name.key);\
 	}
 
-#define __DECLARE_TRACE(name, proto, args, cond, data_proto)		\
+#define __DECLARE_TRACE(name, proto, args, cond, data_proto)			\
 	__DECLARE_TRACE_COMMON(name, PARAMS(proto), PARAMS(args), PARAMS(data_proto)) \
 	static inline void __do_trace_##name(proto)			\
 	{								\
 		TRACEPOINT_CHECK(name)					\
 		if (cond) {						\
-			guard(preempt_notrace)();			\
+			guard(srcu_fast_notrace)(&tracepoint_srcu);	\
 			__DO_TRACE_CALL(name, TP_ARGS(args));		\
 		}							\
 	}								\
diff --git a/include/trace/trace_events.h b/include/trace/trace_events.h
index 4f22136fd465..fbc07d353be6 100644
--- a/include/trace/trace_events.h
+++ b/include/trace/trace_events.h
@@ -436,6 +436,7 @@ __DECLARE_EVENT_CLASS(call, PARAMS(proto), PARAMS(args), PARAMS(tstruct), \
 static notrace void							\
 trace_event_raw_event_##call(void *__data, proto)			\
 {									\
+	guard(preempt_notrace)();					\
 	do_trace_event_raw_event_##call(__data, args);			\
 }
 
@@ -447,9 +448,8 @@ static notrace void							\
 trace_event_raw_event_##call(void *__data, proto)			\
 {									\
 	might_fault();							\
-	preempt_disable_notrace();					\
+	guard(preempt_notrace)();					\
 	do_trace_event_raw_event_##call(__data, args);			\
-	preempt_enable_notrace();					\
 }
 
 /*
diff --git a/kernel/tracepoint.c b/kernel/tracepoint.c
index 62719d2941c9..fd2ee879815c 100644
--- a/kernel/tracepoint.c
+++ b/kernel/tracepoint.c
@@ -34,9 +34,13 @@ enum tp_transition_sync {
 
 struct tp_transition_snapshot {
 	unsigned long rcu;
+	unsigned long srcu_gp;
 	bool ongoing;
 };
 
+DEFINE_SRCU_FAST(tracepoint_srcu);
+EXPORT_SYMBOL_GPL(tracepoint_srcu);
+
 /* Protected by tracepoints_mutex */
 static struct tp_transition_snapshot tp_transition_snapshot[_NR_TP_TRANSITION_SYNC];
 
@@ -46,6 +50,7 @@ static void tp_rcu_get_state(enum tp_transition_sync sync)
 
 	/* Keep the latest get_state snapshot. */
 	snapshot->rcu = get_state_synchronize_rcu();
+	snapshot->srcu_gp = start_poll_synchronize_srcu(&tracepoint_srcu);
 	snapshot->ongoing = true;
 }
 
@@ -56,6 +61,8 @@ static void tp_rcu_cond_sync(enum tp_transition_sync sync)
 	if (!snapshot->ongoing)
 		return;
 	cond_synchronize_rcu(snapshot->rcu);
+	if (!poll_state_synchronize_srcu(&tracepoint_srcu, snapshot->srcu_gp))
+		synchronize_srcu(&tracepoint_srcu);
 	snapshot->ongoing = false;
 }
 
@@ -112,10 +119,13 @@ static inline void release_probes(struct tracepoint *tp, struct tracepoint_func
 		struct tp_probes *tp_probes = container_of(old,
 			struct tp_probes, probes[0]);
 
-		if (tracepoint_is_faultable(tp))
-			call_rcu_tasks_trace(&tp_probes->rcu, rcu_free_old_probes);
-		else
-			call_rcu(&tp_probes->rcu, rcu_free_old_probes);
+		if (tracepoint_is_faultable(tp)) {
+			call_rcu_tasks_trace(&tp_probes->rcu,
+					     rcu_free_old_probes);
+		} else {
+			call_srcu(&tracepoint_srcu, &tp_probes->rcu,
+				  rcu_free_old_probes);
+		}
 	}
 }
 
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [for-next][PATCH 3/4] srcu: Fix warning to permit SRCU-fast readers in NMI handlers
  2026-01-30 15:46 ` [for-next][PATCH 3/4] srcu: Fix warning to permit SRCU-fast readers in NMI handlers Steven Rostedt
@ 2026-01-30 15:51   ` Boqun Feng
  2026-01-30 17:17     ` Paul E. McKenney
  2026-01-30 17:28     ` Steven Rostedt
  0 siblings, 2 replies; 8+ messages in thread
From: Boqun Feng @ 2026-01-30 15:51 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: linux-kernel, Masami Hiramatsu, Mark Rutland, Mathieu Desnoyers,
	Andrew Morton, Paul E. McKenney, Andrii Nakryiko,
	Alexei Starovoitov, Peter Zijlstra, bpf

On Fri, Jan 30, 2026 at 10:46:10AM -0500, Steven Rostedt wrote:
> From: "Paul E. McKenney" <paulmck@kernel.org>
> 
> SRCU-fast is designed to be used in NMI handlers, even going so far
> as to use atomic operations for architectures supporting NMIs but not
> providing NMI-safe per-CPU atomic operations.  However, the WARN_ON_ONCE()
> in __srcu_check_read_flavor() complains if SRCU-fast is used in an NMI
> handler.  This commit therefore modifies that WARN_ON_ONCE() to avoid
> such complaints.
> 
> Reported-by: Steven Rostedt <rostedt@goodmis.org>
> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
> Tested-by: Steven Rostedt <rostedt@goodmis.org>
> Cc: Andrii Nakryiko <andrii@kernel.org>
> Cc: Boqun Feng <boqun@kernel.org>
> Cc: Alexei Starovoitov <ast@kernel.org>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: bpf@vger.kernel.org
> Link: https://patch.msgid.link/8232efe8-a7a3-446c-af0b-19f9b523b4f7@paulmck-laptop
> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>

Thank you, Steven! I will drop this in the RCU PR since you already plan
to carry it via tracing.

Regards,
Boqun

> ---
>  kernel/rcu/srcutree.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/rcu/srcutree.c b/kernel/rcu/srcutree.c
> index ea3f128de06f..c4a0a93e8da4 100644
> --- a/kernel/rcu/srcutree.c
> +++ b/kernel/rcu/srcutree.c
> @@ -789,7 +789,8 @@ void __srcu_check_read_flavor(struct srcu_struct *ssp, int read_flavor)
>  	struct srcu_data *sdp;
>  
>  	/* NMI-unsafe use in NMI is a bad sign, as is multi-bit read_flavor values. */
> -	WARN_ON_ONCE((read_flavor != SRCU_READ_FLAVOR_NMI) && in_nmi());
> +	WARN_ON_ONCE(read_flavor != SRCU_READ_FLAVOR_NMI &&
> +		     read_flavor != SRCU_READ_FLAVOR_FAST && in_nmi());
>  	WARN_ON_ONCE(read_flavor & (read_flavor - 1));
>  
>  	sdp = raw_cpu_ptr(ssp->sda);
> -- 
> 2.51.0
> 
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [for-next][PATCH 3/4] srcu: Fix warning to permit SRCU-fast readers in NMI handlers
  2026-01-30 15:51   ` Boqun Feng
@ 2026-01-30 17:17     ` Paul E. McKenney
  2026-01-30 17:28     ` Steven Rostedt
  1 sibling, 0 replies; 8+ messages in thread
From: Paul E. McKenney @ 2026-01-30 17:17 UTC (permalink / raw)
  To: Boqun Feng
  Cc: Steven Rostedt, linux-kernel, Masami Hiramatsu, Mark Rutland,
	Mathieu Desnoyers, Andrew Morton, Andrii Nakryiko,
	Alexei Starovoitov, Peter Zijlstra, bpf

On Fri, Jan 30, 2026 at 07:51:16AM -0800, Boqun Feng wrote:
> On Fri, Jan 30, 2026 at 10:46:10AM -0500, Steven Rostedt wrote:
> > From: "Paul E. McKenney" <paulmck@kernel.org>
> > 
> > SRCU-fast is designed to be used in NMI handlers, even going so far
> > as to use atomic operations for architectures supporting NMIs but not
> > providing NMI-safe per-CPU atomic operations.  However, the WARN_ON_ONCE()
> > in __srcu_check_read_flavor() complains if SRCU-fast is used in an NMI
> > handler.  This commit therefore modifies that WARN_ON_ONCE() to avoid
> > such complaints.
> > 
> > Reported-by: Steven Rostedt <rostedt@goodmis.org>
> > Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
> > Tested-by: Steven Rostedt <rostedt@goodmis.org>
> > Cc: Andrii Nakryiko <andrii@kernel.org>
> > Cc: Boqun Feng <boqun@kernel.org>
> > Cc: Alexei Starovoitov <ast@kernel.org>
> > Cc: Peter Zijlstra <peterz@infradead.org>
> > Cc: bpf@vger.kernel.org
> > Link: https://patch.msgid.link/8232efe8-a7a3-446c-af0b-19f9b523b4f7@paulmck-laptop
> > Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
> 
> Thank you, Steven! I will drop this in the RCU PR since you already plan
> to carry it via tracing.

Thank you both!

							Thanx, Paul

> Regards,
> Boqun
> 
> > ---
> >  kernel/rcu/srcutree.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/kernel/rcu/srcutree.c b/kernel/rcu/srcutree.c
> > index ea3f128de06f..c4a0a93e8da4 100644
> > --- a/kernel/rcu/srcutree.c
> > +++ b/kernel/rcu/srcutree.c
> > @@ -789,7 +789,8 @@ void __srcu_check_read_flavor(struct srcu_struct *ssp, int read_flavor)
> >  	struct srcu_data *sdp;
> >  
> >  	/* NMI-unsafe use in NMI is a bad sign, as is multi-bit read_flavor values. */
> > -	WARN_ON_ONCE((read_flavor != SRCU_READ_FLAVOR_NMI) && in_nmi());
> > +	WARN_ON_ONCE(read_flavor != SRCU_READ_FLAVOR_NMI &&
> > +		     read_flavor != SRCU_READ_FLAVOR_FAST && in_nmi());
> >  	WARN_ON_ONCE(read_flavor & (read_flavor - 1));
> >  
> >  	sdp = raw_cpu_ptr(ssp->sda);
> > -- 
> > 2.51.0
> > 
> > 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [for-next][PATCH 3/4] srcu: Fix warning to permit SRCU-fast readers in NMI handlers
  2026-01-30 15:51   ` Boqun Feng
  2026-01-30 17:17     ` Paul E. McKenney
@ 2026-01-30 17:28     ` Steven Rostedt
  1 sibling, 0 replies; 8+ messages in thread
From: Steven Rostedt @ 2026-01-30 17:28 UTC (permalink / raw)
  To: Boqun Feng
  Cc: linux-kernel, Masami Hiramatsu, Mark Rutland, Mathieu Desnoyers,
	Andrew Morton, Paul E. McKenney, Andrii Nakryiko,
	Alexei Starovoitov, Peter Zijlstra, bpf

On Fri, 30 Jan 2026 07:51:16 -0800
Boqun Feng <boqun@kernel.org> wrote:

> Thank you, Steven! I will drop this in the RCU PR since you already plan
> to carry it via tracing.

Thanks. It was a needed dependency for the last patch.

-- Steve

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-01-30 17:28 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-30 15:46 [for-next][PATCH 0/4] tracing: Updates for v6.20 Steven Rostedt
2026-01-30 15:46 ` [for-next][PATCH 1/4] tracing: perf: Have perf tracepoint callbacks always disable preemption Steven Rostedt
2026-01-30 15:46 ` [for-next][PATCH 2/4] bpf: Have __bpf_trace_run() use rcu_read_lock_dont_migrate() Steven Rostedt
2026-01-30 15:46 ` [for-next][PATCH 3/4] srcu: Fix warning to permit SRCU-fast readers in NMI handlers Steven Rostedt
2026-01-30 15:51   ` Boqun Feng
2026-01-30 17:17     ` Paul E. McKenney
2026-01-30 17:28     ` Steven Rostedt
2026-01-30 15:46 ` [for-next][PATCH 4/4] tracing: Guard __DECLARE_TRACE() use of __DO_TRACE_CALL() with SRCU-fast Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox