[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAErzpmt9HKPfyrc_iW5QjT1=E5mUwFcKJihga0s-WBhqE6uiwg@mail.gmail.com>
Date: Wed, 17 Dec 2025 17:21:11 +0800
From: Donglin Peng <dolinux.peng@...il.com>
To: Eduard Zingerman <eddyz87@...il.com>
Cc: ast@...nel.org, andrii.nakryiko@...il.com, zhangxiaoqin@...omi.com,
ihor.solodrai@...ux.dev, linux-kernel@...r.kernel.org, bpf@...r.kernel.org,
pengdonglin <pengdonglin@...omi.com>, Alan Maguire <alan.maguire@...cle.com>
Subject: Re: [PATCH bpf-next v9 08/10] bpf: Skip anonymous types in type
lookup for performance
On Wed, Dec 17, 2025 at 2:55 PM Eduard Zingerman <eddyz87@...il.com> wrote:
>
> On Mon, 2025-12-08 at 14:23 +0800, Donglin Peng wrote:
>
> [...]
>
> > @@ -550,6 +550,11 @@ u32 btf_nr_types(const struct btf *btf)
> > return total;
> > }
> >
> > +u32 btf_sorted_start_id(const struct btf *btf)
> > +{
> > + return btf->sorted_start_id ?: (btf->start_id ?: 1);
> > +}
> > +
>
> I think that changes in this patch are correct. However, it seems
Thanks, I think the changes to btf_find_decl_tag_value and
btf_prepare_func_args will cause issues if the input btf is a
split BTF. We should search from its base BTF. Like this:
const struct btf *base_btf = btf;
while (btf_base_btf(base_btf))
base_btf = btf_base_btf(base_btf);
id = base_btf->sorted_start_id > 0 ? base_btf->sorted_start_id - 1 : 0;
> error prone to remember that sorted_start_id is always set for
> vmlinux/module BTF and might not be set for program BTF.
> Wdyt about using the above function everywhere instead of directly
> reading the field?
Agreed. If so, I think we need to add another helper function to check
whether the input BTF is sorted to improve code clarity.
bool btf_is_sorted(const struct btf *btf)
{
return btf->sorted_start_id > 0;
}
Besides, do you think we should reject loading a kernel module that is
not sorted?
Thanks,
Donglin
>
> > /*
> > * Assuming that types are sorted by name in ascending order.
> > */
>
> [...]
Powered by blists - more mailing lists