mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: "Paul E. McKenney" <paulmck@kernel.org>
Cc: rcu@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@meta.com
Subject: Re: [PATCH 0/6] Switch __DECLARE_TRACE() to new notrace variant of SRCU-fast
Date: Wed, 23 Jul 2025 16:34:50 -0400	[thread overview]
Message-ID: <20250723163450.02bc299b@gandalf.local.home> (raw)
In-Reply-To: <45397494-544e-41c0-bf48-c66d213fce05@paulmck-laptop>

On Wed, 23 Jul 2025 13:27:54 -0700
"Paul E. McKenney" <paulmck@kernel.org> wrote:

> This triggers continues to trigger a kernel test robot report of a
> "using smp_processor_id() in preemptible" splat.  I looked for issues
> with explicit preemption disabling, and, not finding any, will next turn
> my attention to accesses to per-CPU variables.  Any and all insights
> are welcome.

Currently perf and ftrace expect the tracepoints to be called with
preemption disabled. You may need this:

diff --git a/include/trace/perf.h b/include/trace/perf.h
index a1754b73a8f5..1b7925a85966 100644
--- a/include/trace/perf.h
+++ b/include/trace/perf.h
@@ -71,7 +71,9 @@ perf_trace_##call(void *__data, proto)					\
 	u64 __count __attribute__((unused));				\
 	struct task_struct *__task __attribute__((unused));		\
 									\
+	preempt_disable_notrace();					\
 	do_perf_trace_##call(__data, args);				\
+	preempt_enable_notrace();					\
 }
 
 #undef DECLARE_EVENT_SYSCALL_CLASS
diff --git a/include/trace/trace_events.h b/include/trace/trace_events.h
index 4f22136fd465..0504a423ca25 100644
--- a/include/trace/trace_events.h
+++ b/include/trace/trace_events.h
@@ -436,7 +436,9 @@ __DECLARE_EVENT_CLASS(call, PARAMS(proto), PARAMS(args), PARAMS(tstruct), \
 static notrace void							\
 trace_event_raw_event_##call(void *__data, proto)			\
 {									\
+	preempt_disable_notrace();					\
 	do_trace_event_raw_event_##call(__data, args);			\
+	preempt_enable_notrace();					\
 }
 
 #undef DECLARE_EVENT_SYSCALL_CLASS


But please add it with the change, as there's "preempt_count" accounting to
report to the user that accounts that preemption was disabled when called.

-- Steve

  parent reply	other threads:[~2025-07-23 20:34 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-23 20:27 Paul E. McKenney
2025-07-23 20:27 ` [PATCH v4 1/6] srcu: Move rcu_is_watching() checks to srcu_read_{,un}lock_fast() Paul E. McKenney
2025-07-23 20:27 ` [PATCH v4 2/6] srcu: Add srcu_read_lock_fast_notrace() and srcu_read_unlock_fast_notrace() Paul E. McKenney
2025-07-23 20:50   ` Boqun Feng
2025-07-23 21:21     ` Paul E. McKenney
2025-07-23 20:27 ` [PATCH v4 3/6] srcu: Add guards for notrace variants of SRCU-fast readers Paul E. McKenney
2025-07-23 20:27 ` [PATCH v4 4/6] tracing: Guard __DECLARE_TRACE() use of __DO_TRACE_CALL() with SRCU-fast Paul E. McKenney
2025-07-23 21:40   ` Mathieu Desnoyers
2025-07-23 22:17     ` Paul E. McKenney
2025-07-23 22:29       ` Steven Rostedt
2025-07-23 22:51         ` Paul E. McKenney
2025-07-23 20:27 ` [PATCH v4 5/6] srcu: Document __srcu_read_{,un}lock_fast() implicit RCU readers Paul E. McKenney
2025-07-23 20:28 ` [PATCH v4 6/6] srcu: Document srcu_flip() memory-barrier D relation to SRCU-fast Paul E. McKenney
2025-07-23 20:34 ` Steven Rostedt [this message]
2025-07-23 20:54   ` [PATCH 0/6] Switch __DECLARE_TRACE() to new notrace variant of SRCU-fast Paul E. McKenney

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=20250723163450.02bc299b@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=kernel-team@meta.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulmck@kernel.org \
    --cc=rcu@vger.kernel.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

all inboxes | Powered by JetHome®