From: sashiko-bot@kernel.org
To: "Leon Hwang" <leon.hwang@linux.dev>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next v12 07/10] selftests/bpf: Add tests to verify global percpu data
Date: Thu, 13 Aug 2026 15:42:42 +0000 [thread overview]
Message-ID: <20260813154243.62D451F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260813152324.97937-8-leon.hwang@linux.dev>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The test `test_global_percpu_data` fails because `bpf_map__set_value_size()` clears the `.percpu` map's BTF type ID when it encounters a non-array as the last variable in the datasec.
--
--- Patch [7]: [PATCH bpf-next v12 07/10] selftests/bpf: Add tests to verify global percpu data ---
commit 0224e1ae61dc47271ec8a72ac29b073935a25d31
Author: Leon Hwang <leon.hwang@linux.dev>
selftests/bpf: Add tests to verify global percpu data
This patch adds a selftest to verify global percpu data map initialization
and modification using APIs like bpf_map__set_value_size() and
bpf_map_lookup_elem_flags(). It includes both light and standard skeleton
tests.
> diff --git a/tools/testing/selftests/bpf/prog_tests/global_data_init.c b/tools/testing/selftests/bpf/prog_tests/global_data_init.c
> index 8466332d7406f..06d163a022dcc 100644
> --- a/tools/testing/selftests/bpf/prog_tests/global_data_init.c
> +++ b/tools/testing/selftests/bpf/prog_tests/global_data_init.c
[ ... ]
> +static void test_global_percpu_data_init(void)
> +{
[ ... ]
> + err = bpf_map__set_value_size(map, desired_sz);
> + if (!ASSERT_OK(err, "bpf_map__set_value_size"))
> + goto out;
> + if (!ASSERT_EQ(bpf_map__value_size(map), desired_sz, "percpu value size"))
> + goto out;
> + if (!ASSERT_NEQ(bpf_map__btf_value_type_id(map), 0, "percpu BTF value type"))
> + goto out;
[Severity: Medium]
Will this test fail here because bpf_map__set_value_size() clears the BTF
type ID?
When bpf_map__set_value_size() is called, it attempts to resize the BTF
datasec. This requires the last variable in the datasec to be an array.
Because `struct_data` is defined last in the `.percpu` section in the BPF
program, map_btf_datasec_resize() returns -EINVAL and clears the BTF type
ID to 0, causing this assertion to fail.
> diff --git a/tools/testing/selftests/bpf/progs/test_global_percpu_data.c b/tools/testing/selftests/bpf/progs/test_global_percpu_data.c
> new file mode 100644
> index 0000000000000..416841cd35692
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/progs/test_global_percpu_data.c
[ ... ]
> +int nums[7] SEC(".percpu");
> +bool set SEC(".percpu") = false;
> +struct {
> + char set;
> + int i;
> + int nums[7];
> +} struct_data SEC(".percpu") = {
> + .set = 0,
> + .i = -1,
> +};
[Severity: Medium]
Does placing this struct at the end of the `.percpu` section break the
BTF resizing logic?
Could the variables in the `.percpu` section be reordered so that an array
like `nums` or `cpu_id` is the last variable?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260813152324.97937-1-leon.hwang@linux.dev?part=7
next prev parent reply other threads:[~2026-08-13 15:42 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-13 15:23 [PATCH bpf-next v12 00/10] bpf: Introduce global percpu data Leon Hwang
2026-08-13 15:23 ` [PATCH bpf-next v12 01/10] bpf: Drop duplicate blank lines in kernel/bpf/ Leon Hwang
2026-08-13 16:26 ` bot+bpf-ci
2026-08-13 15:23 ` [PATCH bpf-next v12 02/10] bpf: Factor out check_map_mem_read helper in verifier Leon Hwang
2026-08-13 16:26 ` bot+bpf-ci
2026-08-13 15:23 ` [PATCH bpf-next v12 03/10] bpf: Introduce global percpu data Leon Hwang
2026-08-13 15:23 ` [PATCH bpf-next v12 04/10] libbpf: Probe percpu data feature Leon Hwang
2026-08-13 15:38 ` sashiko-bot
2026-08-13 15:23 ` [PATCH bpf-next v12 05/10] libbpf: Add support for global percpu data Leon Hwang
2026-08-13 15:42 ` sashiko-bot
2026-08-13 16:26 ` bot+bpf-ci
2026-08-13 17:41 ` Andrii Nakryiko
2026-08-13 15:23 ` [PATCH bpf-next v12 06/10] bpftool: Generate skeleton " Leon Hwang
2026-08-13 16:26 ` bot+bpf-ci
2026-08-13 17:56 ` Andrii Nakryiko
2026-08-13 15:23 ` [PATCH bpf-next v12 07/10] selftests/bpf: Add tests to verify " Leon Hwang
2026-08-13 15:42 ` sashiko-bot [this message]
2026-08-13 16:26 ` bot+bpf-ci
2026-08-13 15:23 ` [PATCH bpf-next v12 08/10] selftests/bpf: Test direct reading/writing read-only percpu_array map Leon Hwang
2026-08-13 15:23 ` [PATCH bpf-next v12 09/10] selftests/bpf: Test verifier log for global percpu data Leon Hwang
2026-08-13 15:23 ` [PATCH bpf-next v12 10/10] selftests/bpf: Verify bpf_iter " Leon Hwang
2026-08-13 16:26 ` 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=20260813154243.62D451F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=leon.hwang@linux.dev \
--cc=sashiko-reviews@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).