bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFC 0/5] bpf: avoid locks in bpf_timer and bpf_wq
@ 2025-10-31 21:58 Mykyta Yatsenko
  2025-10-31 21:58 ` [PATCH RFC v1 1/5] bpf: refactor bpf_async_cb callback update Mykyta Yatsenko
                   ` (4 more replies)
  0 siblings, 5 replies; 16+ messages in thread
From: Mykyta Yatsenko @ 2025-10-31 21:58 UTC (permalink / raw)
  To: bpf, ast, andrii, daniel, kafai, kernel-team, eddyz87, memxor
  Cc: Mykyta Yatsenko

From: Mykyta Yatsenko <yatsenko@meta.com>

This series reworks implementation of BPF timer and workqueue APIs.
The goal is to make both timers and wq non-blocking, enabling their use
in NMI context.
Today this code relies on a bpf_spin_lock embedded in the map element to
serialize:
 * init of the async object,
 * setting/changing the callback and bpf_prog
 * starting/cancelling the timer/work
 * tearing down when the map element is deleted or the map’s user ref is
 dropped

The series apply design similar to existing bpf_task_work
approach [1]: RCU and refcount to maintain lifetime guarantees and state
machine to handle data races.

This RFC doesn’t yet fully add NMI support for timers
and workqueue helpers and kfuncs, but it takes the first step by
removing the spinlock from bpf_async_cb struct.

---
1: https://lore.kernel.org/bpf/175864081800.1466288.3242104888617580131.git-patchwork-notify@kernel.org/

Signed-off-by: Mykyta Yatsenko <yatsenko@meta.com>

---
Mykyta Yatsenko (5):
      bpf: refactor bpf_async_cb callback update
      bpf: refactor bpf_async_cb prog swap
      bpf: factor out timer deletion helper
      bpf: add refcnt into struct bpf_async_cb
      bpf: remove lock from bpf_async_cb

 kernel/bpf/helpers.c | 309 +++++++++++++++++++++++++++++++--------------------
 1 file changed, 189 insertions(+), 120 deletions(-)
---
base-commit: 23f852daa4bab4d579110e034e4d513f7d490846
change-id: 20251028-timer_nolock-457f5b9daace

Best regards,
-- 
Mykyta Yatsenko <yatsenko@meta.com>

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

end of thread, other threads:[~2025-11-06  0:08 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-31 21:58 [PATCH RFC 0/5] bpf: avoid locks in bpf_timer and bpf_wq Mykyta Yatsenko
2025-10-31 21:58 ` [PATCH RFC v1 1/5] bpf: refactor bpf_async_cb callback update Mykyta Yatsenko
2025-11-04  1:58   ` Eduard Zingerman
2025-10-31 21:58 ` [PATCH RFC v1 2/5] bpf: refactor bpf_async_cb prog swap Mykyta Yatsenko
2025-11-04 18:42   ` Eduard Zingerman
2025-10-31 21:58 ` [PATCH RFC v1 3/5] bpf: factor out timer deletion helper Mykyta Yatsenko
2025-11-04 18:45   ` Eduard Zingerman
2025-10-31 21:58 ` [PATCH RFC v1 4/5] bpf: add refcnt into struct bpf_async_cb Mykyta Yatsenko
2025-10-31 22:35   ` bot+bpf-ci
2025-11-03 18:14     ` Alexei Starovoitov
2025-10-31 21:58 ` [PATCH RFC v1 5/5] bpf: remove lock from bpf_async_cb Mykyta Yatsenko
2025-11-04 22:01   ` Eduard Zingerman
2025-11-05 15:30     ` Mykyta Yatsenko
2025-11-05 22:44       ` Eduard Zingerman
2025-11-05 23:39         ` Mykyta Yatsenko
2025-11-06  0:08           ` Eduard Zingerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).