From: sashiko-bot@kernel.org
To: "Fuyu Zhao" <zhaofuyu@vivo.com>
Cc: bpf@vger.kernel.org
Subject: Re: [RFC PATCH bpf-next v2 1/2] libbpf: support selective kernel module BTF loading via .kmod_btfs section
Date: Thu, 13 Aug 2026 03:37:53 +0000 [thread overview]
Message-ID: <20260813033753.B09FA1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260813032613.2755-2-zhaofuyu@vivo.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] Missing increment of `nr_loaded` prevents early loop termination.
- [Low] Multi-line comment formatting violation.
--
--- Patch [1]: [RFC PATCH bpf-next v2 1/2] libbpf: support selective kernel module BTF loading via .kmod_btfs section ---
commit 3f4fb04bbfb95d7f7ea0012b5651135983af6e62
Author: Fuyu Zhao <zhaofuyu@vivo.com>
libbpf: support selective kernel module BTF loading via .kmod_btfs section
This patch adds support for a ".kmod_btfs" ELF section to allow BPF programs
to specify which kernel modules need BTF loading. It introduces functions to
collect the module names and filter the BTF loading process to avoid loading
unneeded modules.
> diff --git a/tools/lib/bpf/bpf_helpers.h b/tools/lib/bpf/bpf_helpers.h
> index 9d160b5b9c0ee..171ea055cd323 100644
> --- a/tools/lib/bpf/bpf_helpers.h
> +++ b/tools/lib/bpf/bpf_helpers.h
> @@ -188,6 +188,20 @@ enum libbpf_tristate {
> TRI_MODULE = 2,
> };
>
> +/* Helper typedef for declaring kernel module names that need BTF loading.
> + *
[Severity: Low]
This isn't a bug, but the BPF subsystem coding style expects multi-line
comments to have the opening /* on its own line. Should this be reformatted
to match the preferred kernel style?
> + * Usage: define an array in the ".kmod_btfs" ELF section to specify
> + * which modules need BTF loading:
> + *
[ ... ]
> diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> index 514e4e9daa825..9fe8a653e8b6b 100644
> --- a/tools/lib/bpf/libbpf.c
> +++ b/tools/lib/bpf/libbpf.c
[ ... ]
> @@ -5891,6 +5987,10 @@ static int load_module_btfs(struct bpf_object *obj)
> break;
> }
> obj->btf_module_cnt++;
> +
> + if (obj->kmod_btfs &&
> + obj->kmod_btfs->nr_names == obj->kmod_btfs->nr_loaded)
> + break;
[Severity: Medium]
Is obj->kmod_btfs->nr_loaded missing an increment?
Looking at the loop in load_module_btfs(), when a module BTF is successfully
loaded and obj->btf_module_cnt is incremented, obj->kmod_btfs->nr_loaded
doesn't appear to be updated anywhere.
Will this prevent the intended optimization of breaking out of the loop early,
causing it to always scan all remaining kernel BTF IDs unnecessarily?
> }
>
> if (err) {
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260813032613.2755-1-zhaofuyu@vivo.com?part=1
next prev parent reply other threads:[~2026-08-13 3:37 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-13 3:26 [RFC PATCH bpf-next v2 0/2] libbpf: Improve BPF load performance by selectively loading kmod BTFs Fuyu Zhao
2026-08-13 3:26 ` [RFC PATCH bpf-next v2 1/2] libbpf: support selective kernel module BTF loading via .kmod_btfs section Fuyu Zhao
2026-08-13 3:37 ` sashiko-bot [this message]
2026-08-13 4:22 ` bot+bpf-ci
2026-08-13 3:26 ` [RFC PATCH bpf-next v2 2/2] selftests/bpf: add tests for selective kmod BTF loading Fuyu Zhao
2026-08-13 3:37 ` sashiko-bot
2026-08-13 4:22 ` bot+bpf-ci
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260813033753.B09FA1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=zhaofuyu@vivo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.