Re: [PATCH bpf-next v1 3/6] selftests/bpf: update bpf_wq_set_callback macro

Ihor Solodrai
2025-09-25T16:19:46Z

On 9/25/25 2:53 AM, Alexei Starovoitov wrote:
> On Wed, Sep 24, 2025 at 10:17 PM Ihor Solodrai <ihor.solodrai@linux.dev> wrote:
>>
>> Subsequent patch introduces bpf_wq_set_callback kfunc with an
>> implicit bpf_prog_aux argument.
>>
>> To ensure backward compatibility add a weak declaration and make
>> bpf_wq_set_callback macro to check for the new kfunc first.
>>
>> Signed-off-by: Ihor Solodrai <ihor.solodrai@linux.dev>
>> ---
>> tools/testing/selftests/bpf/bpf_experimental.h | 7 ++++++-
>> 1 file changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/tools/testing/selftests/bpf/bpf_experimental.h b/tools/testing/selftests/bpf/bpf_experimental.h
>> index d89eda3fd8a3..341408d017ea 100644
>> --- a/tools/testing/selftests/bpf/bpf_experimental.h
>> +++ b/tools/testing/selftests/bpf/bpf_experimental.h
>> @@ -583,8 +583,13 @@ extern int bpf_wq_start(struct bpf_wq *wq, unsigned int flags) __weak __ksym;
>> extern int bpf_wq_set_callback_impl(struct bpf_wq *wq,
>> int (callback_fn)(void *map, int *key, void *value),
>> unsigned int flags__k, void *aux__ign) __ksym;
>> +extern int bpf_wq_set_callback(struct bpf_wq *wq,
>> + int (callback_fn)(void *map, int *key, void *value),
>> + unsigned int flags) __weak __ksym;
>> #define bpf_wq_set_callback(timer, cb, flags) \
>> - bpf_wq_set_callback_impl(timer, cb, flags, NULL)
>> + (bpf_wq_set_callback ? \
>> + bpf_wq_set_callback(timer, cb, flags) : \
>> + bpf_wq_set_callback_impl(timer, cb, flags, NULL))
>
> There is also drivers/hid/bpf/progs/hid_bpf_helpers.h
> Pls double check that hid-bpf still compiles and works.

Yes, I noticed the usage.

I plan to send separate patches to hid when this series gets closer to
landing.