Chengkaitao <[email protected]> writes:

> From: Kaitao Cheng <[email protected]>
>
> Replace per-kfunc btf_id chains check with btf_id_in_kfunc_table() and
> static kfunc tables for easier maintenance.
>
> Prepare for future extensions to the bpf_list API family.
>
> Signed-off-by: Kaitao Cheng <[email protected]>
> ---

I think old is_bpf_rbtree_api_kfunc(kfunc_btf_id) is more readable than new
btf_id_in_kfunc_table(kfunc_btf_id, bpf_rbtree_api_kfuncs);
Not sure if this change should be bundled with this series, it looks
quite orthogonal.

>  kernel/bpf/verifier.c | 261 +++++++++++++++++++++++-------------------
>  1 file changed, 144 insertions(+), 117 deletions(-)
>
> diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
> index 4fbacd2149cd..f2d9863bb290 100644
> --- a/kernel/bpf/verifier.c
> +++ b/kernel/bpf/verifier.c
> @@ -544,9 +544,6 @@ static bool is_async_callback_calling_kfunc(u32 btf_id);
>  static bool is_callback_calling_kfunc(u32 btf_id);
>  static bool is_bpf_throw_kfunc(struct bpf_insn *insn);
>  
> -static bool is_bpf_wq_set_callback_kfunc(u32 btf_id);
> -static bool is_task_work_add_kfunc(u32 func_id);
> -
>  static bool is_sync_callback_calling_function(enum bpf_func_id func_id)
>  {
>       return func_id == BPF_FUNC_for_each_map_elem ||
> @@ -586,7 +583,7 @@ static bool is_async_cb_sleepable(struct bpf_verifier_env 
> *env, struct bpf_insn
>  
>       /* bpf_wq and bpf_task_work callbacks are always sleepable. */
>       if (bpf_pseudo_kfunc_call(insn) && insn->off == 0 &&
> -         (is_bpf_wq_set_callback_kfunc(insn->imm) || 
> is_task_work_add_kfunc(insn->imm)))
> +         is_async_callback_calling_kfunc(insn->imm))
>               return true;
>  
>       verifier_bug(env, "unhandled async callback in is_async_cb_sleepable");
> @@ -11203,31 +11200,6 @@ static int 
> set_task_work_schedule_callback_state(struct bpf_verifier_env *env,
>       return 0;
>  }
>  
> ...
> -- 
> 2.50.1 (Apple Git-155)

Reply via email to