All of lore.kernel.org
 help / color / mirror / Atom feed
* Are BPF programs preemptible?
@ 2023-01-23  9:21 Yaniv Agman
  2023-01-23 10:46 ` Jakub Sitnicki
  0 siblings, 1 reply; 21+ messages in thread
From: Yaniv Agman @ 2023-01-23  9:21 UTC (permalink / raw)
  To: bpf

Hello!

Several places state that eBPF programs cannot be preempted by the
kernel (e.g. https://docs.cilium.io/en/latest/bpf/toolchain), however,
I did see a strange behavior where an eBPF percpu map gets overridden,
and I'm trying to figure out if it's due to a bug in my program or
some misunderstanding I have about eBPF. What caught my eye was a
sentence in a LWN article (https://lwn.net/Articles/812503/) that
says: "Alexei thankfully enlightened me recently over a beer that the
real intent here is to guarantee that the program runs to completion
on the same CPU where it started".

So my question is - are BPF programs guaranteed to run from start to
end without being interrupted at all or the only guarantee I get is
that they run on the same CPU but IRQs (NMIs, soft irqs, whatever) can
interrupt their run?

If the only guarantee is no migration, it means that a percpu map
cannot be safely used by two different BPF programs that can preempt
each other (e.g. some kprobe and a network cgroup program).

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

end of thread, other threads:[~2023-01-26 17:52 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-23  9:21 Are BPF programs preemptible? Yaniv Agman
2023-01-23 10:46 ` Jakub Sitnicki
2023-01-23 12:30   ` Yaniv Agman
2023-01-23 17:02     ` Yonghong Song
2023-01-23 17:32       ` Yaniv Agman
2023-01-23 20:06         ` Martin KaFai Lau
2023-01-23 21:01           ` Yaniv Agman
2023-01-23 21:22             ` Jakub Sitnicki
2023-01-23 21:56               ` Yaniv Agman
2023-01-24 12:30                 ` Alexei Starovoitov
2023-01-24 15:47                   ` Yaniv Agman
2023-01-24 17:24                     ` Alexei Starovoitov
2023-01-24 17:38                       ` Yaniv Agman
2023-01-25  0:04                         ` Alexei Starovoitov
2023-01-25 16:39                           ` Yaniv Agman
2023-01-25 18:52                             ` Alexei Starovoitov
2023-01-25 19:59                               ` Yaniv Agman
2023-01-26  2:22                                 ` Alexei Starovoitov
2023-01-26  6:59                                   ` Yaniv Agman
2023-01-26 15:29                                     ` Alexei Starovoitov
2023-01-26 17:51                                       ` Yaniv Agman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.