From: Leon Hwang <leon.hwang@linux.dev>
To: bot+bpf-ci@kernel.org, bpf@vger.kernel.org
Cc: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org,
eddyz87@gmail.com, memxor@gmail.com, martin.lau@linux.dev,
song@kernel.org, yonghong.song@linux.dev, jolsa@kernel.org,
emil@etsalapatis.com, ihor.solodrai@linux.dev, shuah@kernel.org,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
martin.lau@kernel.org, clm@meta.com
Subject: Re: [PATCH bpf-next v2] selftests/bpf: Avoid flaky resize value test for percpu data
Date: Wed, 19 Aug 2026 09:44:08 +0800 [thread overview]
Message-ID: <a1b1c6ee-ad7d-4972-a15b-f567e7787a6c@linux.dev> (raw)
In-Reply-To: <948e7ff41f942519880f9789faf6ca8ed9d0e2cf42eab5b9e1567ead5367b830@mail.kernel.org>
On 19/8/26 00:15, bot+bpf-ci@kernel.org wrote:
>> 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 5671c31085cd..2b69290bcc3e 100644
>> --- a/tools/testing/selftests/bpf/prog_tests/global_data_init.c
>> +++ b/tools/testing/selftests/bpf/prog_tests/global_data_init.c
>
> [ ... ]
>
>> @@ -236,6 +223,57 @@ static void test_global_percpu_data_lskel(void)
>> test_global_percpu_data_lskel__destroy(lskel);
>> }
>>
>> +#define PAGE_SIZE 4096
>> +
>> +static void test_global_percpu_data_map_resize(void)
>> +{
>> + const __u32 desired_sz = sysconf(_SC_PAGE_SIZE) * 2;
>> + struct test_global_percpu_data *skel;
>> + const int arr_value = -1;
>> + struct bpf_map *map;
>> + int err, prog_fd;
>> + size_t data_sz;
>> +
>> + if (sysconf(_SC_PAGE_SIZE) != PAGE_SIZE) {
>> + test__skip();
>> + return;
>> + }
>> +
>> + skel = test_global_percpu_data__open();
>> + if (!ASSERT_OK_PTR(skel, "test_global_percpu_data__open"))
>> + return;
>> +
>> + map = skel->maps.percpu_arr;
>> + skel->percpu_arr->arr[0] = arr_value;
>> + err = bpf_map__set_value_size(map, desired_sz);
>
> This isn't a bug, but since the guard above already pins the page size to
> 4096, would `const __u32 desired_sz = PAGE_SIZE * 2;` read more directly
Will change to 'PAGE_SIZE * 2' if the next revision is needed.
> here - and is the unguarded `#define PAGE_SIZE 4096` preferable to the
> `#ifndef PAGE_SIZE` form used in sockopt.c?
No. PAGE_SIZE must be 4096 here.
>
>> + if (!ASSERT_OK(err, "bpf_map__set_value_size"))
>> + goto out;
>> + if (!ASSERT_EQ(bpf_map__value_size(map), desired_sz, "bpf_map__value_size"))
>> + goto out;
>> + if (!ASSERT_NEQ(bpf_map__btf_value_type_id(map), 0, "bpf_map__btf_value_type_id"))
>> + goto out;
>> +
>> + skel->percpu_arr = bpf_map__initial_value(map, &data_sz);
>> + if (!ASSERT_EQ(data_sz, desired_sz, "data_sz"))
>> + goto out;
>> + if (!ASSERT_OK_PTR(skel->percpu_arr, "skel->percpu_arr"))
>> + goto out;
>
> This isn't a bug, but would it read more consistently with
> test_global_percpu_data_init() to check ASSERT_OK_PTR(skel->percpu_arr)
> before ASSERT_EQ(data_sz, desired_sz)? The block this replaces checked
> pointer-then-size, and the surviving test_global_percpu_data_init() at the
> same file still does pointer-then-size.
Unnecessary to keep consistent for their order. This is a really minor
readability concern.
Thanks,
Leon
next prev parent reply other threads:[~2026-08-19 1:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-18 15:32 Leon Hwang
2026-08-18 16:15 ` bot+bpf-ci
2026-08-19 1:44 ` Leon Hwang [this message]
2026-08-21 17:58 ` Andrii Nakryiko
2026-08-24 5:02 ` Leon Hwang
2026-08-24 20:04 ` 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=a1b1c6ee-ad7d-4972-a15b-f567e7787a6c@linux.dev \
--to=leon.hwang@linux.dev \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bot+bpf-ci@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=jolsa@kernel.org \
--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=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®