From: Leon Hwang <leon.hwang@linux.dev>
To: Masoud Aghasi <maghasi@disroot.org>, bpf@vger.kernel.org
Cc: andrii@kernel.org, eddyz87@gmail.com, ast@kernel.org,
daniel@iogearbox.net, memxor@gmail.com, martin.lau@linux.dev,
song@kernel.org, yonghong.song@linux.dev, jolsa@kernel.org,
emil@etsalapatis.com, ihor.solodrai@linux.dev,
john.fastabend@gmail.com
Subject: Re: [PATCH bpf v6 3/3] selftests/bpf: add tests for percpu map flags combination
Date: Thu, 8 Oct 2026 21:28:01 +0800 [thread overview]
Message-ID: <2ae7b3d0-6350-4145-a5da-7a9a81a845d4@linux.dev> (raw)
In-Reply-To: <20261008120734.1565972-4-maghasi@disroot.org>
On 2026/10/8 20:07, Masoud Aghasi wrote:
> All possible combinations of (BPF_EXIST, BPF_NOEXIST) and
> (BPF_F_ALL_CPUS, BPF_F_CPU) flags are covered for all percpu map types.
>
> As BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE does not support BPF_NOEXIST and
> also in order to reduce the amount of code duplicates, I added its
> new test scenarios to the existing cpu_flag_percpu_cgroup_storage test.
>
> But for other percpu map types, I added new tests to be able to
> exercise all flag combinations and the edge cases such as percpu LRU
> unnecessary deletion issue.
>
> Signed-off-by: Masoud Aghasi <maghasi@disroot.org>
Two concerns below, others lgtm.
Acked-by: Leon Hwang <leon.hwang@linux.dev>
> ---
> .../selftests/bpf/prog_tests/percpu_alloc.c | 254 ++++++++++++++++++
> 1 file changed, 254 insertions(+)
>
[...]
> +
> + if (map_type != BPF_MAP_TYPE_LRU_PERCPU_HASH)
> + goto out;
> +
> + /* Percpu LRU hash map should not delete old entries unnecessarily */
> + flags = BPF_F_ALL_CPUS | BPF_NOEXIST;
> + key = 2;
> + err = bpf_map_update_elem(map_fd, &key, values, flags);
> + if (!ASSERT_OK(err, "bpf_map_update_elem lru_percpu_hash all_cpus|noexist"))
> + goto out;
Update values[0] before update_elem(), and verify_map_value_all_cpus()?
Also update values[0] before the below update_elem().
> +
> + flags = BPF_F_ALL_CPUS | BPF_EXIST;
> + err = bpf_map_update_elem(map_fd, &key, values, flags);
> + if (!ASSERT_OK(err, "bpf_map_update_elem lru_percpu_hash all_cpus|exist"))
> + goto out;
> +
> + key = 0;
Why do you use 'k = 0' instead of '2'?
I think we should update and verify using the same key.
Thanks,
Leon
> + verify_map_value_all_cpus(map_fd, &key, values, elem_sz, first_value, nr_cpus);
> +
> +out:
> + close(map_fd);
> + free(values);
> +}
> +
[...]
next prev parent reply other threads:[~2026-10-08 13:28 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-08 12:07 [PATCH bpf v6 0/3] bpf: Fix incorrect handling of user flags by percpu map updates Masoud Aghasi
2026-10-08 12:07 ` [PATCH bpf v6 1/3] bpf: Fix incorrect handling of user flags in bpf_percpu_array_update Masoud Aghasi
2026-10-08 13:27 ` Leon Hwang
2026-10-08 12:07 ` [PATCH bpf v6 2/3] bpf: Fix incorrect handling of user flags by percpu hash map updates Masoud Aghasi
2026-10-08 13:27 ` Leon Hwang
2026-10-08 12:07 ` [PATCH bpf v6 3/3] selftests/bpf: add tests for percpu map flags combination Masoud Aghasi
2026-10-08 13:28 ` Leon Hwang [this message]
2026-10-08 15:58 ` Masoud Aghasi
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=2ae7b3d0-6350-4145-a5da-7a9a81a845d4@linux.dev \
--to=leon.hwang@linux.dev \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--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=maghasi@disroot.org \
--cc=martin.lau@linux.dev \
--cc=memxor@gmail.com \
--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