From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: "Paul E. McKenney" <paulmck@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>,
Stephen Rothwell <sfr@canb.auug.org.au>,
Frederic Weisbecker <frederic@kernel.org>,
Neeraj Upadhyay <neeraj.upadhyay@kernel.org>,
Boqun Feng <boqun.feng@gmail.com>,
Uladzislau Rezki <urezki@gmail.com>,
Masami Hiramatsu <mhiramat@kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Linux Next Mailing List <linux-next@vger.kernel.org>,
yonghong.song@linux.dev
Subject: Re: linux-next: manual merge of the rcu tree with the ftrace tree
Date: Fri, 14 Nov 2025 18:41:59 +0100 [thread overview]
Message-ID: <20251114174159.V60vTd1q@linutronix.de> (raw)
In-Reply-To: <747d4324-55f9-495d-b1ec-ca23cc472f3f@paulmck-laptop>
On 2025-11-14 09:25:06 [-0800], Paul E. McKenney wrote:
> On Fri, Nov 14, 2025 at 06:10:52PM +0100, Sebastian Andrzej Siewior wrote:
> > On 2025-11-14 09:00:21 [-0800], Paul E. McKenney wrote:
> > > > > Where in PREEMPT_RT we do not disable preemption around the tracepoint
> > > > > callback, but in non RT we do. Instead it uses a srcu and migrate disable.
> > > >
> > > > I appreciate the effort. I really do. But why can't we have SRCU on both
> > > > configs?
> > >
> > > Due to performance concerns for non-RT kernels and workloads, where we
> > > really need preemption disabled.
> >
> > This means srcu_read_lock_notrace() is much more overhead compared to
> > rcu_read_lock_sched_notrace()?
> > I am a bit afraid of different bugs here and there.
>
> No, the concern is instead overhead due to any actual preemption. So the
> goal is to actually disable preemption across the BPF program *except*
> in PREEMPT_RT kernels.
Overhead of actual preemption while the BPF callback of the trace-event
is invoked?
So we get rid of the preempt_disable() in the trace-point which we had
due rcu_read_lock_sched_notrace() and we need to preserve it because
preemption while the BPF program is invoked?
This is also something we want for CONFIG_PREEMPT (LAZY)?
Sorry to be verbose but I try to catch up.
The BPF invocation does not disable preemption for a long time. It
disables migration since some code uses per-CPU variables here.
For XDP kind of BPF invocations, preemption is disabled (except for RT)
because those run in NAPI/ softirq context.
> > > > Also why does tracepoint_guard() need to disable migration? The BPF
> > > > program already disables migrations (see for instance
> > > > bpf_prog_run_array()).
> > > > This is true for RT and !RT. So there is no need to do it here.
> > >
> > > The addition of migration disabling was in response to failures, which
> > > this fixed. Or at least greatly reduced the probability of! Let's see...
> > > That migrate_disable() has been there since 2022, so the failures were
> > > happening despite it. Adding Yonghong on CC for his perspective.
> >
> > Okay. In general I would prefer that we know why we do it. BPF had
> > preempt_disable() which was turned into migrate_disable() for RT reasons
> > since remaining on the same CPU was enough and preempt_disable() was the
> > only way to enforce it at the time.
> > And I think Linus requested migrate_disable() to work regardless of RT
> > which PeterZ made happen (for different reasons, not BPF related).
>
> Yes, migrate_disable() prevents migration either way, but it does not
> prevent preemption, which is what was needed in non-PREEMPT_RT kernels
> last I checked.
BPF in general sometimes relies on per-CPU variables. Sometimes it is
needed to avoid reentrancy which is what preempt_disable() provides for
the same context. This is usually handled where it is required and when
is removed, it is added back shortly. See for instance
https://lore.kernel.org/all/20251114064922.11650-1-chandna.sahil@gmail.com/
:)
>
> Thanx, Paul
Sebastian
next prev parent reply other threads:[~2025-11-14 17:42 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-14 2:52 linux-next: manual merge of the rcu tree with the ftrace tree Stephen Rothwell
2025-11-14 12:42 ` Steven Rostedt
2025-11-14 13:35 ` Sebastian Andrzej Siewior
2025-11-14 15:46 ` Steven Rostedt
2025-11-14 16:00 ` Sebastian Andrzej Siewior
2025-11-14 16:22 ` Steven Rostedt
2025-11-14 16:33 ` Sebastian Andrzej Siewior
2025-11-14 16:48 ` Steven Rostedt
2025-11-14 17:02 ` Sebastian Andrzej Siewior
2025-11-14 17:11 ` Steven Rostedt
2025-11-14 17:00 ` Paul E. McKenney
2025-11-14 17:10 ` Sebastian Andrzej Siewior
2025-11-14 17:25 ` Paul E. McKenney
2025-11-14 17:40 ` Steven Rostedt
2025-11-14 17:41 ` Sebastian Andrzej Siewior [this message]
2025-11-14 18:26 ` Paul E. McKenney
2025-11-14 14:48 ` Frederic Weisbecker
2025-11-14 16:01 ` Steven Rostedt
2025-11-14 17:06 ` Paul E. McKenney
2025-11-14 18:58 ` Paul E. McKenney
2025-11-18 13:05 ` Frederic Weisbecker
2025-11-18 15:04 ` Paul E. McKenney
2025-12-02 0:57 ` Paul E. McKenney
2025-12-07 20:43 ` Paul E. McKenney
2025-12-08 0:17 ` Steven Rostedt
2025-12-08 4:21 ` Paul E. McKenney
2025-11-14 17:05 ` Paul E. McKenney
2025-11-14 18:31 ` Yonghong Song
2025-11-18 7:35 ` Sebastian Andrzej Siewior
2025-11-18 15:05 ` Paul E. McKenney
2025-11-30 18:49 ` Yonghong Song
2025-11-19 0:38 ` Paul E. McKenney
-- strict thread matches above, loose matches on Subject: below --
2025-11-06 1:24 Stephen Rothwell
2017-05-01 3:18 Stephen Rothwell
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=20251114174159.V60vTd1q@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=boqun.feng@gmail.com \
--cc=frederic@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-next@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=neeraj.upadhyay@kernel.org \
--cc=paulmck@kernel.org \
--cc=rostedt@goodmis.org \
--cc=sfr@canb.auug.org.au \
--cc=urezki@gmail.com \
--cc=yonghong.song@linux.dev \
/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