All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Fuyu Zhao" <zhaofuyu@vivo.com>
Cc: bpf@vger.kernel.org
Subject: Re: [RFC PATCH bpf-next v2 2/2] selftests/bpf: add tests for selective kmod BTF loading
Date: Thu, 13 Aug 2026 03:37:42 +0000	[thread overview]
Message-ID: <20260813033743.102F91F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260813032613.2755-3-zhaofuyu@vivo.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The tracking counter `obj->kmod_btfs->nr_loaded` is never updated, rendering the early termination optimization for BTF loading completely ineffective.
--

--- Patch [2]: [RFC PATCH bpf-next v2 2/2] selftests/bpf: add tests for selective kmod BTF loading ---
commit 506359525a106f517e013e060ee2c6feb17720c8
Author: Fuyu Zhao <zhaofuyu@vivo.com>

selftests/bpf: add tests for selective kmod BTF loading

Add test cases to verify the new ".kmod_btfs" section logic in libbpf.
The added test cases cover three main scenarios: valid module, non-existent
module, and duplicates/unneeded modules.

> diff --git a/tools/testing/selftests/bpf/prog_tests/kmod_btfs.c b/tools/testing/selftests/bpf/prog_tests/kmod_btfs.c
> index 0000000000000..d875fcce6681d
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/prog_tests/kmod_btfs.c
> @@ -0,0 +1,52 @@
> +// SPDX-License-Identifier: GPL-2.0
> +#include <test_progs.h>
> +#include "kmod_btfs.skel.h"
> +#include "kmod_btfs_nonexist.skel.h"
> +#include "kmod_btfs_mix.skel.h"
> +

[ ... ]

[Severity: Medium]
While reviewing these tests, I noticed a potential regression in the libbpf
code they exercise. In load_module_btfs():

tools/lib/bpf/libbpf.c:load_module_btfs() {
...
		if (obj->kmod_btfs &&
		    obj->kmod_btfs->nr_names == obj->kmod_btfs->nr_loaded)
			break;
...
}

Is obj->kmod_btfs->nr_loaded ever incremented when a module BTF is
successfully loaded?

If it is not incremented, will this early termination condition ever be
met? It appears this might unnecessarily iterate over all remaining
system BTFs, which would bypass the intended performance optimization
of the .kmod_btfs section.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260813032613.2755-1-zhaofuyu@vivo.com?part=2

  reply	other threads:[~2026-08-13  3:37 UTC|newest]

Thread overview: 11+ 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
2026-08-13 12:00     ` Fuyu Zhao
2026-08-13  4:22   ` bot+bpf-ci
2026-08-13 12:04     ` Fuyu Zhao
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 [this message]
2026-08-13 12:00     ` Fuyu Zhao
2026-08-13  4:22   ` bot+bpf-ci
2026-08-13 12:05     ` Fuyu Zhao

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=20260813033743.102F91F000E9@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.