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 v10 6/9] selftests/bpf: Add tests to verify global percpu data
Date: Wed, 15 Jul 2026 15:55:01 +0000	[thread overview]
Message-ID: <20260715155501.C8C5F1F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260715153254.92010-7-leon.hwang@linux.dev>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The `test_global_percpu_data_subskel` selftest fails unconditionally because it asserts `var_cnt > 0` on a subskeleton that is generated with zero variables.
--

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

selftests/bpf: Add tests to verify global percpu data

This commit adds selftests to verify operations on global percpu data in BPF
programs. It tests various libbpf APIs and skeleton behaviors for percpu
maps. It also adds a test to ensure live variables of a subskeleton do not
include 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
> @@ -0,0 +1,37 @@

[ ... ]

> +	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]
Since test_global_percpu_data.c only contains variables in .percpu* sections,
and the subskeleton generator skips percpu array variables, will var_cnt
always be exactly 0 here, causing this test to unconditionally fail?

Would it make sense to either add a standard global variable to
test_global_percpu_data.c (e.g. in .bss or .data), or adjust this assertion?

> +
> +	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");
> +	}
> +
> +out:
> +	test_global_percpu_data__destroy(subskel);
> +	bpf_object__close(obj);
> +}

> 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..54380dfb11a5a
> --- /dev/null
> +++ b/tools/testing/selftests/bpf/progs/test_global_percpu_data.c
> @@ -0,0 +1,33 @@
> +// SPDX-License-Identifier: GPL-2.0
> +#include <vmlinux.h>
> +#include <bpf/bpf_helpers.h>
> +#include "bpf_misc.h"
> +
> +int unused SEC(".percpu.looooooooong");
> +int data2 SEC(".percpu.data");
> +int data SEC(".percpu") = -1;
> +int nums[7] SEC(".percpu");
> +char run SEC(".percpu") = 0;

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

  reply	other threads:[~2026-07-15 15:55 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-15 15:32 [PATCH bpf-next v10 0/9] bpf: Introduce global percpu data Leon Hwang
2026-07-15 15:32 ` [PATCH bpf-next v10 1/9] bpf: Drop duplicate blank lines in verifier Leon Hwang
2026-07-15 15:32 ` [PATCH bpf-next v10 2/9] bpf: Introduce global percpu data Leon Hwang
2026-07-15 15:32 ` [PATCH bpf-next v10 3/9] libbpf: Probe percpu data feature Leon Hwang
2026-07-15 15:32 ` [PATCH bpf-next v10 4/9] libbpf: Add support for global percpu data Leon Hwang
2026-07-15 16:00   ` sashiko-bot
2026-07-15 15:32 ` [PATCH bpf-next v10 5/9] bpftool: Generate skeleton " Leon Hwang
2026-07-15 15:32 ` [PATCH bpf-next v10 6/9] selftests/bpf: Add tests to verify " Leon Hwang
2026-07-15 15:55   ` sashiko-bot [this message]
2026-07-15 16:11   ` bot+bpf-ci
2026-07-15 15:32 ` [PATCH bpf-next v10 7/9] selftests/bpf: Test direct reading/writing read-only percpu_array map Leon Hwang
2026-07-15 15:32 ` [PATCH bpf-next v10 8/9] selftests/bpf: Test verifier log for global percpu data Leon Hwang
2026-07-15 15:32 ` [PATCH bpf-next v10 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=20260715155501.C8C5F1F00A3D@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.