Re: [PATCH RFC bpf-next v3 04/16] bpf/helpers: introduce sleepable bpf_timers

2024-02-27 Thread Benjamin Tissoires
On Feb 23 2024, Eduard Zingerman wrote: > On Wed, 2024-02-21 at 17:25 +0100, Benjamin Tissoires wrote: > > [...] > > > @@ -1282,7 +1333,7 @@ BPF_CALL_3(bpf_timer_start, struct bpf_timer_kern *, > > timer, u64, nsecs, u64, fla > > > > if (in_nmi()) > > return -EOPNOTSUPP; > > -

Re: [PATCH RFC bpf-next v3 04/16] bpf/helpers: introduce sleepable bpf_timers

2024-02-22 Thread Eduard Zingerman
On Wed, 2024-02-21 at 17:25 +0100, Benjamin Tissoires wrote: [...] > @@ -1282,7 +1333,7 @@ BPF_CALL_3(bpf_timer_start, struct bpf_timer_kern *, > timer, u64, nsecs, u64, fla > > if (in_nmi()) > return -EOPNOTSUPP; > - if (flags & ~(BPF_F_TIMER_ABS |

Re: [PATCH RFC bpf-next v3 04/16] bpf/helpers: introduce sleepable bpf_timers

2024-02-22 Thread Alexei Starovoitov
On Wed, Feb 21, 2024 at 8:25 AM Benjamin Tissoires wrote: > /* the actual struct hidden inside uapi struct bpf_timer */ > @@ -1113,6 +1120,55 @@ struct bpf_timer_kern { > struct bpf_spin_lock lock; > } __attribute__((aligned(8))); > > +static u32 __bpf_timer_compute_key(struct

Re: [PATCH RFC bpf-next v3 04/16] bpf/helpers: introduce sleepable bpf_timers

2024-02-22 Thread Toke Høiland-Jørgensen
Benjamin Tissoires writes: > @@ -1245,6 +1294,7 @@ BPF_CALL_3(bpf_timer_set_callback, struct > bpf_timer_kern *, timer, void *, callb > ret = -EPERM; > goto out; > } > + down(>sleepable_lock); > prev = t->prog; > if (prev != prog) { >

Re: [PATCH RFC bpf-next v3 04/16] bpf/helpers: introduce sleepable bpf_timers

2024-02-22 Thread Benjamin Tissoires
On Feb 21 2024, 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 > > --- > > changes in v3: > - extracted the implementation in bpf_timer only, without >

[PATCH RFC bpf-next v3 04/16] bpf/helpers: introduce sleepable bpf_timers

2024-02-21 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 v3: - extracted the implementation in bpf_timer only, without bpf_timer_set_sleepable_cb() - rely on schedule_work() only, from