Re: [PATCH bpf-next 11/18] bpf: wq: add bpf_wq_init
From: Alexei Starovoitov
Date: Fri Apr 19 2024 - 11:34:51 EST
On Fri, Apr 19, 2024 at 8:12 AM Benjamin Tissoires <bentiss@xxxxxxxxxx> wrote:
>
>
> It's something I added while adding the tests. And some tests were passing
> in case I was having a non sleepable callback. But if we have
> bpf_rcu_read_lock(), we are all fine and can reduce the complexity.
Not quite following what was the issue.
Since the verifier is unconditionally verifying such callback as sleepable
the callback won't be able to access rcu pointers without doing
explicit bpf_rcu_read_lock() first (and few other code patterns
might be rejected), but that's a good thing.
Maybe next to set_cb kfunc add a comment that wq callbacks are sleepable.
I think bpf prog writers are often with kernel background,
so it will be their natural assumption that cb is sleepable.