On Apr 19 2024, Alexei Starovoitov wrote:
On Fri, Apr 19, 2024 at 8:14 AM Benjamin Tissoires bentiss@kernel.org wrote:
Honestly I just felt the patch series was big enough for a PoC and comparison with sleepable bpf_timer. But if we think this needs not to be added, I guess that works too :)
It certainly did its job to compare the two and imo bpf_wq with kfunc approach looks cleaner overall and will be easier to extend in the long term.
Yeah. I agree. I'm also glad we pick the bpf_wq approach as I gave it a lot more care :)
Talking about extending, I think I'll need delayed_work soon enough. Most of the time when I receive an input event, the device is preventing any communication with it, and with plain bpf_wq, it's likely that when the code kicks in the device won't have processed the current input, meaning to a useless retry. With delayed_works, I can schedule it slightly later, and have a higher chance of not having to retry.
I've got a quick hack locally that I can submit once this series get merged.
I mean that we'll be adding 3 kfuncs initially: bpf_wq_init, bpf_wq_start, bpf_wq_set_callback.
imo that's good enough to land it and get some exposure.
sounds good to me.
I'll be using it right away to refactor bpf_arena_alloc.h into actual arena allocator for bpf progs that is not just a selftest.
I'm currently working on locks for bpf_arena. Kumar has a patch set that adds bpf_preempt_disble kfunc and coupled with bpf_wq we'll have all mechanisms to build arbitrary data structures/algorithms as bpf programs.
Oh. I did not realize that it was that needed for outside of my playground. That's good to hear :)
Cheers, Benjamin