[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAP01T74V7PqaS+YU+=BZK3E3TYYB+cr8TP81uHeAXZPdYF3HXg@mail.gmail.com>
Date: Tue, 22 Apr 2025 03:14:19 +0200
From: Kumar Kartikeya Dwivedi <memxor@...il.com>
To: Martin KaFai Lau <martin.lau@...ux.dev>
Cc: bpf@...r.kernel.org, Alexei Starovoitov <ast@...nel.org>,
Andrii Nakryiko <andrii@...nel.org>, Daniel Borkmann <daniel@...earbox.net>, netdev@...r.kernel.org,
kernel-team@...a.com, Amery Hung <ameryhung@...il.com>
Subject: Re: [RFC PATCH bpf-next 02/12] bpf: Simplify reg0 marking for the
rbtree kfuncs that return a bpf_rb_node pointer
On Sat, 19 Apr 2025 at 00:47, Martin KaFai Lau <martin.lau@...ux.dev> wrote:
>
> From: Martin KaFai Lau <martin.lau@...nel.org>
>
> The current rbtree kfunc, bpf_rbtree_{first, remove}, returns the
> bpf_rb_node pointer. The check_kfunc_call currently checks the
> kfunc btf_id instead of its return pointer type to decide
> if it needs to do mark_reg_graph_node(reg0) and ref_set_non_owning(reg0).
>
> The later patch will add bpf_rbtree_{root,left,right} that will also
> return a bpf_rb_node pointer. Instead of adding more kfunc btf_id
> checks to the "if" case, this patch changes the test to check the
> kfunc's return type. is_rbtree_node_type() function is added to
> test if a pointer type is a bpf_rb_node. The callers have already
> skipped the modifiers of the pointer type.
>
> A note on the ref_set_non_owning(), although bpf_rbtree_remove()
> also returns a bpf_rb_node pointer, the bpf_rbtree_remove()
> has the KF_ACQUIRE flag. Thus, its reg0 will not become non-owning.
>
> Signed-off-by: Martin KaFai Lau <martin.lau@...nel.org>
> ---
Acked-by: Kumar Kartikeya Dwivedi <memxor@...il.com>
Powered by blists - more mailing lists