On Mon, Apr 8, 2024 at 4:01 PM Eduard Zingerman <eddy...@gmail.com> wrote:
>
> > +SEC("tc")
> > +/* check that calling bpf_timer_start() with a delay on a sleepable
> > + * callback is returning -EINVAL
> > + */
> > +__retval(-22)
> > +long test_call_sleepable_delay(void *ctx)
> > +{
> > +     int key = 2;
> > +     struct bpf_timer *timer;
> > +
> > +     timer = bpf_map_lookup_elem(&timer_map, &key);
> > +     if (!timer)
> > +             return 1;
> > +
> > +     if (bpf_timer_init(timer, &timer_map, CLOCK_MONOTONIC | 
> > BPF_F_TIMER_SLEEPABLE))
> > +             return 2;
> > +
> > +     if (bpf_timer_set_sleepable_cb(timer, timer_cb_sleepable))
> > +             return 3;
> > +
> > +     return bpf_timer_start(timer, 1, 0);
>
> Q: should verifier statically check that 3rd parameter is zero for sleepable 
> timers?
>   (same question for call to bpf_timer_set_sleepable_cb() with non-sleepable 
> map)

It can, but that sounds like more work for the verifier.
Which gives more reasons to use new kfuncs and clean start with bpf_wq.

Reply via email to