All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Leon Hwang" <leon.hwang@linux.dev>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next v9 6/9] selftests/bpf: Add tests to verify global percpu data
Date: Mon, 13 Jul 2026 17:13:33 +0000	[thread overview]
Message-ID: <20260713171334.6A5A71F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260713154024.30851-7-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_subskel` unconditionally asserts that `var_cnt > 0`, but the compiled BPF object contains no non-percpu global variables, meaning `var_cnt` will always be exactly 0 and the test will reliably fail.
--

--- Patch [6]: [PATCH bpf-next v9 6/9] selftests/bpf: Add tests to verify global percpu data ---
commit 3e1db5f1fcec57a130c30e415035e1b1944b5e17
Author: Leon Hwang <leon.hwang@linux.dev>

selftests/bpf: Add tests to verify global percpu data

This commit introduces tests for BPF global percpu data, verifying APIs like
bpf_map__set_initial_value() and bpf_map__initial_value(). It also adds a
subskeleton test to ensure that the live variables of a subskeleton do not
include those for global percpu data.

> diff --git a/tools/testing/selftests/bpf/prog_tests/global_percpu_subskel.c b/tools/testing/selftests/bpf/prog_tests/global_percpu_subskel.c
> new file mode 100644
> index 0000000000000..8aebd533d86b5
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/prog_tests/global_percpu_subskel.c
[ ... ]
> +	if (!ASSERT_OK_PTR(subskel->subskel, "subskel"))
> +		goto out;
> +	if (!ASSERT_OK_PTR(subskel->maps.percpu, "maps.percpu"))
> +		goto out;
> +	ASSERT_EQ(bpf_map__type(subskel->maps.percpu), BPF_MAP_TYPE_PERCPU_ARRAY,
> +		  "percpu_map_type");
> +	ASSERT_GT(subskel->subskel->var_cnt, 0, "var_cnt");

[Severity: Medium]
Will this test unconditionally fail here?

Since all global variables in test_global_percpu_data.c are placed in .percpu
sections:

int unused SEC(".percpu.looooooooong");
int data2 SEC(".percpu.data");
int data SEC(".percpu") = -1;

bpftool generates a subskeleton with a variable count of 0, because maps of type
BPF_MAP_TYPE_PERCPU_ARRAY are skipped during subskeleton generation.

Thus, subskel->subskel->var_cnt should be exactly 0, which would cause this
assertion to fail.

> +
> +	for (i = 0; i < subskel->subskel->var_cnt; i++) {
> +		const struct bpf_var_skeleton *var;
> +
> +		var = (void *) subskel->subskel->vars + i * subskel->subskel->var_skel_sz;
> +		ASSERT_NEQ(var->map, &subskel->maps.percpu, "var");
> +	}
> +

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260713154024.30851-1-leon.hwang@linux.dev?part=6

  reply	other threads:[~2026-07-13 17:13 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-13 15:40 [PATCH bpf-next v9 0/9] bpf: Introduce global percpu data Leon Hwang
2026-07-13 15:40 ` [PATCH bpf-next v9 1/9] bpf: Drop duplicate blank lines in verifier Leon Hwang
2026-07-13 15:40 ` [PATCH bpf-next v9 2/9] bpf: Introduce global percpu data Leon Hwang
2026-07-13 15:40 ` [PATCH bpf-next v9 3/9] libbpf: Probe percpu data feature Leon Hwang
2026-07-13 16:17   ` sashiko-bot
2026-07-14  1:42     ` Leon Hwang
2026-07-13 15:40 ` [PATCH bpf-next v9 4/9] libbpf: Add support for global percpu data Leon Hwang
2026-07-13 15:40 ` [PATCH bpf-next v9 5/9] bpftool: Generate skeleton " Leon Hwang
2026-07-13 16:48   ` sashiko-bot
2026-07-14  5:45     ` Leon Hwang
2026-07-13 15:40 ` [PATCH bpf-next v9 6/9] selftests/bpf: Add tests to verify " Leon Hwang
2026-07-13 17:13   ` sashiko-bot [this message]
2026-07-14  1:51     ` Leon Hwang
2026-07-13 15:40 ` [PATCH bpf-next v9 7/9] selftests/bpf: Test direct reading/writing read-only percpu_array map Leon Hwang
2026-07-13 15:40 ` [PATCH bpf-next v9 8/9] selftests/bpf: Test verifier log for global percpu data Leon Hwang
2026-07-13 15:40 ` [PATCH bpf-next v9 9/9] selftests/bpf: Verify bpf_iter " Leon Hwang

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=20260713171334.6A5A71F000E9@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 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.