[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAADnVQ+AOtxrQ6Oai20CmU=MSW3f+d_ykRZehYdK=pYjBDdYnQ@mail.gmail.com>
Date: Mon, 8 Apr 2024 20:16:43 -0700
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: Eduard Zingerman <eddyz87@...il.com>
Cc: Benjamin Tissoires <bentiss@...nel.org>, Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>, Andrii Nakryiko <andrii@...nel.org>,
Martin KaFai Lau <martin.lau@...ux.dev>, Song Liu <song@...nel.org>,
Yonghong Song <yonghong.song@...ux.dev>, John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...nel.org>, Stanislav Fomichev <sdf@...gle.com>, Hao Luo <haoluo@...gle.com>,
Jiri Olsa <jolsa@...nel.org>, Mykola Lysenko <mykolal@...com>, Shuah Khan <shuah@...nel.org>,
bpf <bpf@...r.kernel.org>, LKML <linux-kernel@...r.kernel.org>,
"open list:KERNEL SELFTEST FRAMEWORK" <linux-kselftest@...r.kernel.org>
Subject: Re: [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@...il.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.
Powered by blists - more mailing lists