From: Peter Zijlstra <peterz@infradead.org>
To: Usama Saqib <usama.saqib@datadoghq.com>
Cc: Alexei Starovoitov <alexei.starovoitov@gmail.com>,
Andrii Nakryiko <andrii@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Jiri Olsa <jolsa@kernel.org>, bpf <bpf@vger.kernel.org>,
bigeasy@linutronix.de, torvalds@linux-foundation.org
Subject: Re: BPF and lazy preemption.
Date: Tue, 10 Dec 2024 15:14:13 +0100 [thread overview]
Message-ID: <20241210141413.GT35539@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <CAOzX8iyS6ODErbnkyZO7RyVfXBCL5CFX5ydoKcvzc9LZf425Vw@mail.gmail.com>
On Tue, Dec 10, 2024 at 02:25:20PM +0100, Usama Saqib wrote:
> [ Adding x86 / scheduler folks to Cc given PREEMPT_LAZY as-is would cause
> serious regressions for us. ]
>
> On 11/18/24 10:14 AM, Usama Saqib wrote:
> > Hello,
> >
> > I hope everyone is doing well. It seems that work has started to
> > introduce a new preemption model in the linux kernel PREEMPT_LAZY [1].
> > According to the mailing list, the maintainers intend for this to
> > replace PREEMPT_NONE and PREEMPT_VOLUTARY as the default preemption
> > model.
> >
> > From the changeset, it looks like PREEMPT_LAZY allows
> > irqentry_exit_cond_resched() to get called on IRQ exit. This change,
> > similar to PREEMPT_FULL, can get two bpf programs attached to a kprobe
> > or tracepoint running in user context, to nest. This currently causes
> > the nesting program to miss. I have been able to get these misses to
> > happen on top of this new patch.
> >
> > This behavior is currently not possible with the default preemption
> > model used in most distributions, PREEMPT_VOLUNTARY. For many products
> > using BPF for tracing/security, this would constitute a regression in
> > terms of reliability.
> >
> > My question is whether there is any ongoing work to fix this behavior
> > of kprobes and tracepoints, so they do not miss on nesting. I have
> > previously been told that there is ongoing work related to
> > bpf-specific spinlocks to resolve this problem [2]. Will that be
> > available by the time this is merged into the mainline, and the
> > current defaults deprecated?
I have no idea about the whole BPF thing, but if behaviour is as
PREEMPT_FULL, then there is nothing to fix from a scheduler PoV.
Note that most distros already build with PREEMPT_DYNAMIC, which allows
users/admins to dynamically select the preemption model (either at boot
or at runtime through debugfs).
If certain BPF stuff cannot deal with full preemption, then I would have
to call it broken.
next prev parent reply other threads:[~2024-12-10 14:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-18 9:14 BPF and lazy preemption Usama Saqib
2024-12-10 13:25 ` Usama Saqib
2024-12-10 14:14 ` Peter Zijlstra [this message]
2024-12-10 14:48 ` Usama Saqib
2024-12-10 15:21 ` Peter Zijlstra
2024-12-10 19:33 ` Alexei Starovoitov
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=20241210141413.GT35539@noisy.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=alexei.starovoitov@gmail.com \
--cc=andrii@kernel.org \
--cc=bigeasy@linutronix.de \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=jolsa@kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=usama.saqib@datadoghq.com \
/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