[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <8e764e95-2a50-4a48-9b89-808334460c95@linux.dev>
Date: Wed, 26 Nov 2025 10:00:44 +0800
From: Leon Hwang <leon.hwang@...ux.dev>
To: Alexei Starovoitov <alexei.starovoitov@...il.com>
Cc: bpf <bpf@...r.kernel.org>, Alexei Starovoitov <ast@...nel.org>,
Andrii Nakryiko <andrii@...nel.org>, Daniel Borkmann <daniel@...earbox.net>,
Jiri Olsa <jolsa@...nel.org>, Yonghong Song <yonghong.song@...ux.dev>,
Song Liu <song@...nel.org>, Eduard <eddyz87@...il.com>,
Daniel Xu <dxu@...uu.xyz>, Daniel Müller <deso@...teo.net>,
Martin KaFai Lau <martin.lau@...ux.dev>,
John Fastabend <john.fastabend@...il.com>, KP Singh <kpsingh@...nel.org>,
Stanislav Fomichev <sdf@...ichev.me>, Hao Luo <haoluo@...gle.com>,
Shuah Khan <shuah@...nel.org>, Jason Xing <kerneljasonxing@...il.com>,
Tao Chen <chen.dylane@...ux.dev>, Willem de Bruijn <willemb@...gle.com>,
Paul Chaignon <paul.chaignon@...il.com>,
Anton Protopopov <a.s.protopopov@...il.com>,
Kumar Kartikeya Dwivedi <memxor@...il.com>,
Mykyta Yatsenko <yatsenko@...a.com>, Tobias Klauser <tklauser@...tanz.ch>,
kernel-patches-bot@...com, LKML <linux-kernel@...r.kernel.org>,
"open list:KERNEL SELFTEST FRAMEWORK" <linux-kselftest@...r.kernel.org>
Subject: Re: [PATCH bpf-next v11 4/8] bpf: Add BPF_F_CPU and BPF_F_ALL_CPUS
flags support for percpu_hash and lru_percpu_hash maps
On 26/11/25 07:11, Alexei Starovoitov wrote:
> On Tue, Nov 25, 2025 at 7:00 AM Leon Hwang <leon.hwang@...ux.dev> wrote:
>>
[...]
>> @@ -1342,7 +1360,7 @@ static long __htab_lru_percpu_map_update_elem(struct bpf_map *map, void *key,
>> * to remove older elem from htab and this removal
>> * operation will need a bucket lock.
>> */
>> - if (map_flags != BPF_EXIST) {
>> + if (!(map_flags & BPF_EXIST)) {
>> l_new = prealloc_lru_pop(htab, key, hash);
>> if (!l_new)
>> return -ENOMEM;
>
> It's not in the diff, but this is broken.
> You tried to allow BPF_EXIST combination here, but didn't update
> check_flags(),
>
> so BPF_[NO]EXIST | BPF_F_CPU combination check_flags() will always
> return 0, so BPF_[NO]EXIST flag will make no difference.
>
> When you add features, always always add unit tests.
> Patch 8 is not it. It's testing F_CPU. It doesn't check
> that BPF_EXIST | BPF_F_CPU correctly errors when an element doesn't exist.
>
> v10 was close, but then you decided to add this BPF_EXIST feature
> and did it in a sloppy way. Why ?
> Focus on one thing only. Land it and then do the next one.
> 11 revisions and still no go... it is not a good sign.
>
Yeah, you're right.
The intention of v11 was solely to address the unstable lru_percpu_hash
map test — not to introduce support for the BPF_EXIST combination.
Given that, the approach in v11 was not the right way to fix the
instability. I'll investigate the underlying cause first and then work
on a better fix.
Thanks,
Leon
Powered by blists - more mailing lists