Linux Kernel Selftest development
 help / color / mirror / Atom feed
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,
	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,
	linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
	kernel-patches-bot@fb.com, martin.lau@kernel.org, clm@meta.com,
	ihor.solodrai@linux.dev
Subject: Re: [PATCH bpf-next v12 07/10] selftests/bpf: Add tests to verify global percpu data
Date: Fri, 14 Aug 2026 14:13:02 +0800	[thread overview]
Message-ID: <56384749-0b87-4aee-b30e-8a8a629f84a0@linux.dev> (raw)
In-Reply-To: <0ffc09de1b26ea2a7bf3015a63307a134259c376347b778b71706b9830dcd185@mail.kernel.org>

On 14/8/26 00:26, 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 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
> 
> [ ... ]
> 
>> @@ -60,3 +63,188 @@ void test_global_data_init(void)
>>  	free(newval);
>>  	bpf_object__close(obj);
>>  }
>> +
>> +static void test_percpu_data_on_cpus(struct bpf_map *map, int map_fd, int prog_fd, int *runp)
>> +{
>> +	struct test_global_percpu_data__percpu *data = NULL;
>> +	int i, err, key = 0, num_online, run = 0;
>> +	__u64 args[2] = {0x1234ULL, 0x5678ULL};
>> +	size_t data_sz;
>> +	bool *online;
>> +	LIBBPF_OPTS(bpf_test_run_opts, topts,
>> +		    .ctx_in = args,
>> +		    .ctx_size_in = sizeof(args),
>> +		    .flags = BPF_F_TEST_RUN_ON_CPU,
>> +	);
> 
> This isn't a bug, but does the raw_tp ctx need to be passed here, given
> the program ignores it?

Good catch.

Will drop the 'args'.

> 
> [ ... ]
> 
>> +static void test_global_percpu_data_init(void)
>> +{
>> +	struct test_global_percpu_data__percpu init_value = {};
>> +	struct test_global_percpu_data__percpu *init_data;
>> +	const __u32 desired_sz = sysconf(_SC_PAGE_SIZE);
>> +	struct test_global_percpu_data *skel = NULL;
>> +	size_t init_data_sz;
>> +	struct bpf_map *map;
>> +	int prog_fd, err;
> 
> [ ... ]
> 
>> +	map = skel->maps.percpu;
>> +	if (!ASSERT_EQ(bpf_map__type(map), BPF_MAP_TYPE_PERCPU_ARRAY, "bpf_map__type"))
>> +		goto out;
>> +
>> +	init_value.data = 2;
>> +	init_value.nums[6] = -1;
>> +	init_value.struct_data.i = 2;
>> +	init_value.struct_data.nums[6] = -1;
>> +	err = bpf_map__set_initial_value(map, &init_value, sizeof(init_value));
>> +	if (!ASSERT_OK(err, "bpf_map__set_initial_value"))
>> +		goto out;
>> +
>> +	init_data = bpf_map__initial_value(map, &init_data_sz);
>> +	if (!ASSERT_OK_PTR(init_data, "bpf_map__initial_value"))
>> +		goto out;
>> +
>> +	ASSERT_EQ(init_data->data, init_value.data, "init_value data");
>> +	ASSERT_EQ(init_data->set, init_value.set, "init_value set");
>> +	ASSERT_EQ(init_data->struct_data.i, init_value.struct_data.i, "init_value struct_data.i");
>> +	ASSERT_EQ(init_data->struct_data.nums[6], init_value.struct_data.nums[6],
>> +		  "init_value struct_data.nums[6]");
> 
> This isn't a bug, but should init_value.set be given a non-zero value,
> and nums[6] checked, so these assertions can actually distinguish a broken
> copy?

Will update 'init_value.set = 1;' and check 'nums[6]'.

Thanks,
Leon


  reply	other threads:[~2026-08-14  6:13 UTC|newest]

Thread overview: 26+ 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-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-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 [this message]
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
2026-08-14  6:13     ` 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=56384749-0b87-4aee-b30e-8a8a629f84a0@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=ihor.solodrai@linux.dev \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kernel-patches-bot@fb.com \
    --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