Re: [PATCH RFC bpf-next v6 1/6] bpf/helpers: introduce sleepable bpf_timers

2024-04-08 Thread Alexei Starovoitov
On Mon, Apr 8, 2024 at 10:20 AM Benjamin Tissoires wrote: > > On Mon, Apr 8, 2024 at 7:08 PM Eduard Zingerman wrote: > > > > On Mon, 2024-04-08 at 10:09 +0200, Benjamin Tissoires wrote: > > > > [...] > > > > > diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c > > > index

Re: [PATCH RFC bpf-next v6 1/6] bpf/helpers: introduce sleepable bpf_timers

2024-04-08 Thread Eduard Zingerman
On Mon, 2024-04-08 at 19:20 +0200, Benjamin Tissoires wrote: [...] > That was my initial assumption too, but Alexei told me it was fine. > And I think he is correct because kfree_rcu doesn't need the rcu_head > to be initialized. > > So in the end, we initialize the memory as a work_struct, and

Re: [PATCH RFC bpf-next v6 1/6] bpf/helpers: introduce sleepable bpf_timers

2024-04-08 Thread Benjamin Tissoires
On Mon, Apr 8, 2024 at 7:08 PM Eduard Zingerman wrote: > > On Mon, 2024-04-08 at 10:09 +0200, Benjamin Tissoires wrote: > > [...] > > > diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c > > index 9234174ccb21..fd05d4358b31 100644 > > --- a/kernel/bpf/helpers.c > > +++

Re: [PATCH RFC bpf-next v6 1/6] bpf/helpers: introduce sleepable bpf_timers

2024-04-08 Thread Eduard Zingerman
On Mon, 2024-04-08 at 10:09 +0200, Benjamin Tissoires wrote: [...] > diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c > index 9234174ccb21..fd05d4358b31 100644 > --- a/kernel/bpf/helpers.c > +++ b/kernel/bpf/helpers.c > @@ -1096,12 +1096,19 @@ const struct bpf_func_proto

[PATCH RFC bpf-next v6 1/6] bpf/helpers: introduce sleepable bpf_timers

2024-04-08 Thread Benjamin Tissoires
They are implemented as a workqueue, which means that there are no guarantees of timing nor ordering. Signed-off-by: Benjamin Tissoires --- changes in v6: - dropped extra spinlock - implement cancel_and_free of a sleepable timer through a dedicated workqueue no changes in v5 changes in v4: