From: bot+bpf-ci@kernel.org
To: leon.hwang@linux.dev,bpf@vger.kernel.org
Cc: ast@kernel.org,daniel@iogearbox.net,andrii@kernel.org,martin.lau@linux.dev,eddyz87@gmail.com,memxor@gmail.com,song@kernel.org,yonghong.song@linux.dev,jolsa@kernel.org,john.fastabend@gmail.com,qmo@kernel.org,shuah@kernel.org,leon.hwang@linux.dev,linux-kernel@vger.kernel.org,linux-kselftest@vger.kernel.org,kernel-patches-bot@fb.com,emil@etsalapatis.com,ast@kernel.org,andrii@kernel.org,daniel@iogearbox.net,martin.lau@kernel.org,eddyz87@gmail.com,yonghong.song@linux.dev,clm@meta.com,ihor.solodrai@linux.dev
Subject: Re: [PATCH bpf-next v12 10/10] selftests/bpf: Verify bpf_iter for global percpu data
Date: Thu, 13 Aug 2026 16:26:30 +0000 (UTC) [thread overview]
Message-ID: <bd01566fa68ef3b993bdd4cfbd9802a24cd9b5052b5a746712067d8571ea0bd0@mail.kernel.org> (raw)
In-Reply-To: <20260813152324.97937-11-leon.hwang@linux.dev>
[-- Attachment #1: Type: text/plain, Size: 3184 bytes --]
> 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 d308ca3b30457..7d6bda9092954 100644
> --- a/tools/testing/selftests/bpf/prog_tests/global_data_init.c
> +++ b/tools/testing/selftests/bpf/prog_tests/global_data_init.c
> @@ -327,6 +327,56 @@ static void test_global_percpu_data_verifier_log(void)
> RUN_TESTS(test_global_percpu_data);
> }
>
> +static void test_global_percpu_data_iter(void)
> +{
> + DECLARE_LIBBPF_OPTS(bpf_iter_attach_opts, opts);
> + struct test_global_percpu_data *skel;
> + union bpf_iter_link_info linfo = {};
> + struct bpf_link *link = NULL;
> + int fd, num_cpus, len, err;
> + char buf[16];
> +
> + num_cpus = libbpf_num_possible_cpus();
> + if (!ASSERT_GT(num_cpus, 0, "libbpf_num_possible_cpus"))
> + return;
> +
> + skel = test_global_percpu_data__open();
> + if (!ASSERT_OK_PTR(skel, "test_global_percpu_data__open"))
> + return;
> +
> + skel->rodata->num_cpus = num_cpus;
> + skel->rodata->offsetof_num = offsetof(struct test_global_percpu_data__percpu, struct_data);
> + skel->rodata->offsetof_num += sizeof(skel->percpu->struct_data) - sizeof(int);
This isn't a bug, but could these two lines collapse into a single
offsetof(struct test_global_percpu_data__percpu, struct_data.nums[6]),
so the offset names the field being read instead of depending on nums[6]
staying last in the struct?
> + skel->rodata->elem_sz = roundup(sizeof(struct test_global_percpu_data__percpu), 8);
> + skel->percpu->struct_data.nums[6] = 0xc0de;
> +
> + err = test_global_percpu_data__load(skel);
> + if (!ASSERT_OK(err, "test_global_percpu_data__load"))
> + goto out;
> +
> + linfo.map.map_fd = bpf_map__fd(skel->maps.percpu);
> + opts.link_info = &linfo;
> + opts.link_info_len = sizeof(linfo);
> + link = bpf_program__attach_iter(skel->progs.dump_percpu_data, &opts);
> + if (!ASSERT_OK_PTR(link, "bpf_program__attach_iter"))
> + goto out;
> +
> + fd = bpf_iter_create(bpf_link__fd(link));
> + if (!ASSERT_GE(fd, 0, "bpf_iter_create"))
> + goto out;
> +
> + while ((len = read(fd, buf, sizeof(buf))) > 0)
> + do { } while (0);
This isn't a bug, but would a bare semicolon (as in bpf_iter.c's
read-drain loops) be clearer here than do { } while (0)?
[ ... ]
> diff --git a/tools/testing/selftests/bpf/progs/test_global_percpu_data.c b/tools/testing/selftests/bpf/progs/test_global_percpu_data.c
> index d086e9417f9fb..71ff8d1bf49eb 100644
> --- a/tools/testing/selftests/bpf/progs/test_global_percpu_data.c
> +++ b/tools/testing/selftests/bpf/progs/test_global_percpu_data.c
> @@ -61,4 +61,29 @@ int verifier_snprintf(void *ctx)
> return 0;
> }
>
> +volatile const __u32 num_cpus = 0;
> +volatile const int offsetof_num;
This isn't a bug, but would a name like nums6_off (set directly from
offsetof(struct test_global_percpu_data__percpu, struct_data.nums[6]))
make it clearer which field the iterator is summing?
[ ... ]
---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md
CI run summary: https://github.com/kernel-patches/bpf/actions/runs/31716447858
next prev parent reply other threads:[~2026-08-13 16:26 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-13 15:23 [PATCH bpf-next v12 00/10] bpf: Introduce " 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-14 6:07 ` Leon Hwang
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-14 6:10 ` Leon Hwang
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:23 ` [PATCH bpf-next v12 05/10] libbpf: Add support for global percpu data Leon Hwang
2026-08-13 16:26 ` bot+bpf-ci
2026-08-13 17:41 ` Andrii Nakryiko
2026-08-14 6:11 ` Leon Hwang
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-14 6:12 ` Leon Hwang
2026-08-13 17:56 ` Andrii Nakryiko
2026-08-14 2:03 ` Leon Hwang
2026-08-14 18:00 ` Andrii Nakryiko
2026-08-13 15:23 ` [PATCH bpf-next v12 07/10] selftests/bpf: Add tests to verify " Leon Hwang
2026-08-13 16:26 ` bot+bpf-ci
2026-08-14 6:13 ` Leon Hwang
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 [this message]
2026-08-14 6:13 ` Leon Hwang
2026-08-14 19:34 ` Andrii Nakryiko
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=bd01566fa68ef3b993bdd4cfbd9802a24cd9b5052b5a746712067d8571ea0bd0@mail.kernel.org \
--to=bot+bpf-ci@kernel.org \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=clm@meta.com \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=emil@etsalapatis.com \
--cc=ihor.solodrai@linux.dev \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kernel-patches-bot@fb.com \
--cc=leon.hwang@linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=martin.lau@kernel.org \
--cc=martin.lau@linux.dev \
--cc=memxor@gmail.com \
--cc=qmo@kernel.org \
--cc=shuah@kernel.org \
--cc=song@kernel.org \
--cc=yonghong.song@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
all inboxes | Powered by JetHome®