BPF List
 help / color / mirror / Atom feed
* BPF memory model
@ 2023-09-07 22:00 Josh Don
  2023-09-08  8:42 ` Paul E. McKenney
  0 siblings, 1 reply; 13+ messages in thread
From: Josh Don @ 2023-09-07 22:00 UTC (permalink / raw)
  To: Paul E. McKenney
  Cc: Hao Luo, davemarchevsky, Tejun Heo, David Vernet, Neel Natu,
	Jack Humphries, bpf, ast

Hi Paul,

I was chatting with Dave Marchevsky about the BPF memory model, and
had some followup questions you might be able to answer.

I've been using the built-in RMW operations to do a lot of lockless
programming, for concurrent BPF-BPF, but also especially for
userspace-BPF (the latter of which has become a lot more interesting
with the sched_ext work from Meta). It would of course be nice to
sometimes lower the synchronization overhead to a hardware barrier or
a compiler barrier, to allow for general use acquire/release semantics
(rather than needing to fall back to a lock RMW instruction). I saw
your presentation from 2021 on this topic here:
https://lpc.events/event/11/contributions/941/attachments/859/1667/bpf-memory-model.2020.09.22a.pdf

Has there been any further interest in supporting additional
kernel-style atomics in BPF that you know of?

And on a different BPF note, one thing I wasn't sure about was the
ability of the cpu to reorder loads and stores across the BPF program
call boundary. For example, could the load of "z" in the BPF program
below be reordered before the store to x in the kernel? I'm sure that
no compiler barrier is ever necessary here since the BPF program is
compiled separately from the kernel, but I'm not sure whether a
hardware barrier is necessary.
<kernel>
x = 3
call_bpf();
  <bpf>
  int y = z;

Best,
Josh

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

end of thread, other threads:[~2023-11-13 20:03 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-07 22:00 BPF memory model Josh Don
2023-09-08  8:42 ` Paul E. McKenney
2023-09-08 20:26   ` Josh Don
2023-09-08 22:07     ` Tejun Heo
2023-09-08 23:16       ` Alexei Starovoitov
2023-09-09 12:47         ` Paul E. McKenney
2023-09-18 15:09   ` Barret Rhoden
2023-09-19  9:52     ` Paul E. McKenney
2023-09-19 15:55       ` Barret Rhoden
2023-10-16 16:48         ` Paul E. McKenney
2023-10-16 17:17           ` Jose E. Marchesi
2023-11-13 18:53           ` Barret Rhoden
2023-11-13 20:03             ` Paul E. McKenney

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