Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Yafang Shao" <laoar.shao@gmail.com>,
	ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org,
	eddyz87@gmail.com, memxor@gmail.com, mingo@redhat.com,
	peterz@infradead.org, juri.lelli@redhat.com,
	vincent.guittot@linaro.org, akpm@linux-foundation.org,
	david@kernel.org, gourry@gourry.net, tj@kernel.org,
	hannes@cmpxchg.org, mkoutny@suse.com, shakeel.butt@linux.dev,
	roman.gushchin@linux.dev, yu.c.chen@intel.com,
	zhao1.liu@intel.com, tim.c.chen@linux.intel.com,
	lizhe.67@bytedance.com
Cc: bpf@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [RFC PATCH v3 bpf-next 5/5] selftests/bpf: add tests for the numab kfuncs
Date: Mon, 19 Oct 2026 06:51:00 +0000	[thread overview]
Message-ID: <sashiko-outbox-176703@kernel.org> (raw)
In-Reply-To: <20261019064157.29885-6-laoar.shao@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] selftests/bpf: missing kfunc BTF skip check in test_bpf_numab()
--

commit 07e4c14213f29b11a7ce19b88e46e524dc48e78d
Author: Yafang Shao <laoar.shao@gmail.com>

selftests/bpf: add tests for the numab kfuncs

This commit adds BPF selftests exercising the bpf_numab_set_mode() and
bpf_numab_get_mode() kfuncs across set/get roundtrips, mode validation,
invalid cgroup IDs, and cgroup hierarchy combinations.

> diff --git a/tools/testing/selftests/bpf/prog_tests/bpf_numab.c b/tools/testing/selftests/bpf/prog_tests/bpf_numab.c
> new file mode 100644
> index 0000000000000..7ce4b8153c42f
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/prog_tests/bpf_numab.c
> @@ -0,0 +1,227 @@
[ ... ]
> +static void test_set_get(void)
> +{
> +	struct bpf_numab *skel;
> +	int cgroup_fd;
> +	u64 cgid;
> +
> +	cgroup_fd = test__join_cgroup(CGROUP_PATH);
> +	if (!ASSERT_GE(cgroup_fd, 0, "join_cgroup"))
> +		return;
> +
> +	skel = bpf_numab__open_and_load();
> +	if (!ASSERT_OK_PTR(skel, "open_and_load"))
> +		goto cleanup;
[ ... ]
> +void test_bpf_numab(void)
> +{
> +	if (test__start_subtest("set_get"))
> +		test_set_get();
> +	if (test__start_subtest("invalid_mode"))
> +		test_invalid_mode();
> +	if (test__start_subtest("bad_cgid"))
> +		test_bad_cgid();
> +	if (test__start_subtest("hierarchy"))
> +		test_hierarchy();
> +}

[Severity: Medium]
What happens when test_bpf_numab() runs on a kernel built without
CONFIG_BPF_NUMAB=y (for example when CONFIG_NUMA_BALANCING is disabled or on
non-x86_64 selftest configs where CONFIG_NUMA_BALANCING is not enabled)?

Because tools/testing/selftests/bpf/progs/bpf_numab.c declares
bpf_numab_set_mode and bpf_numab_get_mode as strong __ksym externs:

    extern int bpf_numab_set_mode(u64 cgid, s64 mode) __ksym;
    extern s64 bpf_numab_get_mode(u64 cgid) __ksym;

calling test_bpf_numab() -> test_set_get() -> bpf_numab__open_and_load()
(as well as test_invalid_mode(), test_bad_cgid(), and test_hierarchy())
fails in bpf_object__resolve_ksym_func_btf_id() with -ESRCH and trips
ASSERT_OK_PTR(skel, "open_and_load").

Should test_bpf_numab() check vmlinux BTF for bpf_numab_set_mode and
bpf_numab_get_mode via btf__find_by_name_kind(..., BTF_KIND_FUNC) and call
test__skip() when the kfuncs are not present?

> diff --git a/tools/testing/selftests/bpf/progs/bpf_numab.c b/tools/testing/selftests/bpf/progs/bpf_numab.c
[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261019064157.29885-1-laoar.shao@gmail.com?part=5


  reply	other threads:[~2026-10-19  6:51 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-19  6:41 [RFC PATCH v3 bpf-next 0/5] BPF-based per-cgroup NUMA balancing mode selection Yafang Shao
2026-10-19  6:41 ` [RFC PATCH v3 bpf-next 1/5] sched: fix stale get_pref_llc() stub for !CONFIG_SCHED_CACHE Yafang Shao
2026-10-19  6:41 ` [RFC PATCH v3 bpf-next 2/5] sched: use static_branch_likely() for the NUMA balancing tick check Yafang Shao
2026-10-19  6:41 ` [RFC PATCH v3 bpf-next 3/5] sched: add helpers for numa balancing Yafang Shao
2026-10-19  7:14   ` bot+bpf-ci
2026-10-19  6:41 ` [RFC PATCH v3 bpf-next 4/5] sched: add BPF-based per-cgroup NUMA balancing mode selection Yafang Shao
2026-10-19  6:58   ` sashiko-bot
2026-10-19  7:40     ` Yafang Shao
2026-10-19  7:24   ` bot+bpf-ci
2026-10-19  6:41 ` [RFC PATCH v3 bpf-next 5/5] selftests/bpf: add tests for the numab kfuncs Yafang Shao
2026-10-19  6:51   ` sashiko-bot [this message]
2026-10-19  6:55     ` Yafang Shao
2026-10-20 16:54 ` [RFC PATCH v3 bpf-next 0/5] BPF-based per-cgroup NUMA balancing mode selection Tejun Heo

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=sashiko-outbox-176703@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=david@kernel.org \
    --cc=eddyz87@gmail.com \
    --cc=gourry@gourry.net \
    --cc=hannes@cmpxchg.org \
    --cc=juri.lelli@redhat.com \
    --cc=laoar.shao@gmail.com \
    --cc=linux-mm@kvack.org \
    --cc=lizhe.67@bytedance.com \
    --cc=memxor@gmail.com \
    --cc=mingo@redhat.com \
    --cc=mkoutny@suse.com \
    --cc=peterz@infradead.org \
    --cc=roman.gushchin@linux.dev \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=shakeel.butt@linux.dev \
    --cc=tim.c.chen@linux.intel.com \
    --cc=tj@kernel.org \
    --cc=vincent.guittot@linaro.org \
    --cc=yu.c.chen@intel.com \
    --cc=zhao1.liu@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox