From: "Paul E. McKenney" <paulmck@kernel.org>
To: Steven Rostedt <rostedt@goodmis.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 13:54:50 -0700 [thread overview]
Message-ID: <f3d100b4-d849-4fd5-a9ef-8fb0cc78a884@paulmck-laptop> (raw)
In-Reply-To: <20250723163450.02bc299b@gandalf.local.home>
On Wed, Jul 23, 2025 at 04:34:50PM -0400, Steven Rostedt wrote:
> 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.
Thank you, Steve! I suspect that it would have taken me one good long
time to find that one, like maybe forever. ;-)
I am doing local testing, then will expose it to the kernel test robot,
and if all goes well, fold it in with attribution.
Thanx, Paul
prev parent reply other threads:[~2025-07-23 20:54 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 ` [PATCH 0/6] Switch __DECLARE_TRACE() to new notrace variant of SRCU-fast Steven Rostedt
2025-07-23 20:54 ` Paul E. McKenney [this message]
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=f3d100b4-d849-4fd5-a9ef-8fb0cc78a884@paulmck-laptop \
--to=paulmck@kernel.org \
--cc=kernel-team@meta.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rcu@vger.kernel.org \
--cc=rostedt@goodmis.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®