From: sashiko-bot@kernel.org
To: "Nicholas Dudar" <main.kalliope@gmail.com>
Cc: bpf@vger.kernel.org, sched-ext@lists.linux.dev
Subject: Re: [PATCH bpf-next v3 1/2] bpf: Require a BPF cpumask for bpf_cpumask_populate()
Date: Thu, 09 Jul 2026 18:39:18 +0000 [thread overview]
Message-ID: <20260709183918.E42371F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260709182800.2037938-2-main.kalliope@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The BPF selftests and their headers were not updated to reflect the new `struct bpf_cpumask *` signature for `bpf_cpumask_populate()`.
--
--- Patch [1]: [PATCH bpf-next v3 1/2] bpf: Require a BPF cpumask for bpf_cpumask_populate() ---
commit 79080c077263fb184f42fe92f3d8db1f3967a4b5
Author: Nicholas Dudar <main.kalliope@gmail.com>
bpf: Require a BPF cpumask for bpf_cpumask_populate()
This commit changes the first argument of bpf_cpumask_populate() to require
a struct bpf_cpumask pointer instead of a struct cpumask pointer. This
ensures the function follows the same ownership rules as other mutating
cpumask kfuncs.
> diff --git a/kernel/bpf/cpumask.c b/kernel/bpf/cpumask.c
> index b8c805b4b06a0..1336a4efa7553 100644
> --- a/kernel/bpf/cpumask.c
> +++ b/kernel/bpf/cpumask.c
[ ... ]
> @@ -467,7 +467,7 @@ __bpf_kfunc int bpf_cpumask_populate(struct cpumask *cpumask, void *src, size_t
> !IS_ALIGNED(source, sizeof(long)))
> return -EINVAL;
>
> - bitmap_copy(cpumask_bits(cpumask), src, nr_cpu_ids);
> + bitmap_copy(cpumask_bits(&cpumask->cpumask), src, nr_cpu_ids);
>
> return 0;
> }
> diff --git a/tools/sched_ext/include/scx/compat.bpf.h b/tools/sched_ext/include/scx/compat.bpf.h
> index 87f15f2962348..3f74d522f7e79 100644
> --- a/tools/sched_ext/include/scx/compat.bpf.h
> +++ b/tools/sched_ext/include/scx/compat.bpf.h
> @@ -84,7 +84,7 @@ bool scx_bpf_dispatch_vtime_from_dsq___old(struct bpf_iter_scx_dsq *it__iter, st
> *
> * Compat macro will be dropped on v6.19 release.
> */
> -int bpf_cpumask_populate(struct cpumask *dst, void *src, size_t src__sz) __ksym __weak;
> +int bpf_cpumask_populate(struct bpf_cpumask *dst, void *src, size_t src__sz) __ksym __weak;
[Severity: Low]
This isn't a bug, but should the BPF selftest headers also be updated to
reflect this new signature?
Looking at tools/testing/selftests/bpf/progs/cpumask_common.h, it appears it
still declares the old signature for the kfunc:
int bpf_cpumask_populate(struct cpumask *cpumask, void *src, size_t src__sz) __ksym __weak;
Because of this, the tests in cpumask_success.c and cpumask_failure.c under
tools/testing/selftests/bpf/progs/ continue to use explicit C-level casts
from struct bpf_cpumask * to struct cpumask *. For example, in
test_populate_success():
ret = bpf_cpumask_populate((struct cpumask *)mask, bits, CPUMASK_TEST_MASKLEN);
While this doesn't cause runtime failures since the BPF verifier matches the
runtime register BTF type instead of C-level casts, updating the selftests
would ensure complete consistency with the new kfunc signature.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260709182800.2037938-1-main.kalliope@gmail.com?part=1
next prev parent reply other threads:[~2026-07-09 18:39 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-09 18:27 [PATCH bpf-next v3 0/2] bpf: require an owned cpumask for bpf_cpumask_populate() Nicholas Dudar
2026-07-09 18:27 ` [PATCH bpf-next v3 1/2] bpf: Require a BPF " Nicholas Dudar
2026-07-09 18:39 ` sashiko-bot [this message]
2026-07-10 19:18 ` Kumar Kartikeya Dwivedi
2026-07-10 20:17 ` Admin
2026-07-10 20:34 ` Kumar Kartikeya Dwivedi
2026-07-10 23:43 ` Emil Tsalapatis
2026-07-10 23:42 ` Emil Tsalapatis
2026-07-09 18:28 ` [PATCH bpf-next v3 2/2] selftests/bpf: test bpf_cpumask_populate() rejects a borrowed cpumask Nicholas Dudar
2026-07-10 23:51 ` Emil Tsalapatis
2026-07-10 19:17 ` [PATCH bpf-next v3 0/2] bpf: require an owned cpumask for bpf_cpumask_populate() Kumar Kartikeya Dwivedi
2026-07-11 23:38 ` Tejun Heo
2026-07-11 0:00 ` patchwork-bot+netdevbpf
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=20260709183918.E42371F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=main.kalliope@gmail.com \
--cc=sashiko-reviews@lists.linux.dev \
--cc=sched-ext@lists.linux.dev \
/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.