lkml.org 
[lkml]   [2024]   [Apr]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH RFC bpf-next v6 6/6] selftests/bpf: add sleepable timer tests
On Mon, Apr 8, 2024 at 4:01 PM Eduard Zingerman <eddyz87@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.

\
 
 \ /
  Last update: 2024-05-27 16:30    [W:0.032 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site