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

2024-04-05 Thread Alexei Starovoitov
On Fri, Apr 5, 2024 at 8:46 AM Benjamin Tissoires wrote: > > Alright, as of today (and I'm about to be AFK for the weekend), I got > your changes in and working (I think). I'll review the series on > Monday and send it back so we have a baseline to compare it to with > bpf_wq. Nice! Looking

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

2024-04-05 Thread Benjamin Tissoires
On Thu, Apr 4, 2024 at 8:29 PM Alexei Starovoitov wrote: > > On Thu, Apr 4, 2024 at 10:56 AM Benjamin Tissoires > wrote: > > > > On Thu, Apr 4, 2024 at 6:41 PM Alexei Starovoitov > > wrote: > > > > > > On Thu, Apr 4, 2024 at 8:27 AM Benjamin Tissoires > > > wrote: > > > > > > > > > > > > > > >

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

2024-04-04 Thread Alexei Starovoitov
On Thu, Apr 4, 2024 at 10:56 AM Benjamin Tissoires wrote: > > On Thu, Apr 4, 2024 at 6:41 PM Alexei Starovoitov > wrote: > > > > On Thu, Apr 4, 2024 at 8:27 AM Benjamin Tissoires > > wrote: > > > > > > > > > > > > > > So we need something like: > > > > > > > > struct bpf_hrtimer { > > > >

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

2024-04-04 Thread Benjamin Tissoires
On Thu, Apr 4, 2024 at 6:41 PM Alexei Starovoitov wrote: > > On Thu, Apr 4, 2024 at 8:27 AM Benjamin Tissoires > wrote: > > > > > > > > > > So we need something like: > > > > > > struct bpf_hrtimer { > > > union { > > > struct hrtimer timer; > > > + struct work_struct work; > > > }; >

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

2024-04-04 Thread Alexei Starovoitov
On Thu, Apr 4, 2024 at 8:27 AM Benjamin Tissoires wrote: > > > > > > So we need something like: > > > > struct bpf_hrtimer { > > union { > > struct hrtimer timer; > > + struct work_struct work; > > }; > > struct bpf_map *map; > > struct bpf_prog *prog; > > void __rcu *callback_fn;

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

2024-04-04 Thread Benjamin Tissoires
On Thu, Apr 4, 2024 at 4:44 AM Alexei Starovoitov wrote: > > On Wed, Apr 3, 2024 at 6:01 PM Alexei Starovoitov > wrote: > > > > On Wed, Apr 3, 2024 at 11:50 AM Alexei Starovoitov > > wrote: > > > > > > On Wed, Mar 27, 2024 at 10:02 AM Benjamin Tissoires > > > wrote: > > > > > >

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

2024-04-03 Thread Alexei Starovoitov
On Wed, Apr 3, 2024 at 6:01 PM Alexei Starovoitov wrote: > > On Wed, Apr 3, 2024 at 11:50 AM Alexei Starovoitov > wrote: > > > > On Wed, Mar 27, 2024 at 10:02 AM Benjamin Tissoires > > wrote: > > > > > goto out; > > > > > } > > > > > + spin_lock(>sleepable_lock); >

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

2024-04-03 Thread Alexei Starovoitov
On Wed, Apr 3, 2024 at 11:50 AM Alexei Starovoitov wrote: > > On Wed, Mar 27, 2024 at 10:02 AM Benjamin Tissoires > wrote: > > > > goto out; > > > > } > > > > + spin_lock(>sleepable_lock); > > > > drop_prog_refcnt(t); > > > > +

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

2024-04-03 Thread Alexei Starovoitov
On Wed, Mar 27, 2024 at 10:02 AM Benjamin Tissoires wrote: > > > goto out; > > > } > > > + spin_lock(>sleepable_lock); > > > drop_prog_refcnt(t); > > > + spin_unlock(>sleepable_lock); > > > > this also looks odd. > > I basically need to protect "t->prog

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

2024-03-27 Thread Benjamin Tissoires
On Mon, Mar 25, 2024 at 1:50 AM Alexei Starovoitov wrote: > > On Fri, Mar 22, 2024 at 7:56 AM Benjamin Tissoires wrote: > > > > They are implemented as a workqueue, which means that there are no > > guarantees of timing nor ordering. > > > > Signed-off-by: Benjamin Tissoires > > > > --- > > > >

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

2024-03-25 Thread Alexei Starovoitov
On Fri, Mar 22, 2024 at 7:56 AM Benjamin Tissoires wrote: > > They are implemented as a workqueue, which means that there are no > guarantees of timing nor ordering. > > Signed-off-by: Benjamin Tissoires > > --- > > no changes in v5 > > changes in v4: > - dropped __bpf_timer_compute_key() > -

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

2024-03-22 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 --- no changes in v5 changes in v4: - dropped __bpf_timer_compute_key() - use a spin_lock instead of a semaphore - ensure bpf_timer_cancel_and_free is not