public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Leon Hwang <leon.hwang@linux.dev>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: bpf <bpf@vger.kernel.org>, "Alexei Starovoitov" <ast@kernel.org>,
	"Andrii Nakryiko" <andrii@kernel.org>,
	"Daniel Borkmann" <daniel@iogearbox.net>,
	"Jiri Olsa" <jolsa@kernel.org>,
	"Yonghong Song" <yonghong.song@linux.dev>,
	"Song Liu" <song@kernel.org>, Eduard <eddyz87@gmail.com>,
	"Daniel Xu" <dxu@dxuuu.xyz>, "Daniel Müller" <deso@posteo.net>,
	"Martin KaFai Lau" <martin.lau@linux.dev>,
	"John Fastabend" <john.fastabend@gmail.com>,
	"KP Singh" <kpsingh@kernel.org>,
	"Stanislav Fomichev" <sdf@fomichev.me>,
	"Hao Luo" <haoluo@google.com>, "Shuah Khan" <shuah@kernel.org>,
	"Jason Xing" <kerneljasonxing@gmail.com>,
	"Tao Chen" <chen.dylane@linux.dev>,
	"Willem de Bruijn" <willemb@google.com>,
	"Paul Chaignon" <paul.chaignon@gmail.com>,
	"Anton Protopopov" <a.s.protopopov@gmail.com>,
	"Kumar Kartikeya Dwivedi" <memxor@gmail.com>,
	"Mykyta Yatsenko" <yatsenko@meta.com>,
	"Tobias Klauser" <tklauser@distanz.ch>,
	kernel-patches-bot@fb.com, LKML <linux-kernel@vger.kernel.org>,
	"open list:KERNEL SELFTEST FRAMEWORK"
	<linux-kselftest@vger.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
Date: Wed, 26 Nov 2025 10:00:44 +0800	[thread overview]
Message-ID: <8e764e95-2a50-4a48-9b89-808334460c95@linux.dev> (raw)
In-Reply-To: <CAADnVQJMM+PSq_nDL4rXbC42D+yX5iRo-G_y8qma5+OepcAESw@mail.gmail.com>



On 26/11/25 07:11, Alexei Starovoitov wrote:
> On Tue, Nov 25, 2025 at 7:00 AM Leon Hwang <leon.hwang@linux.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




  reply	other threads:[~2025-11-26  2:01 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-25 14:58 [PATCH bpf-next v11 0/8] bpf: Introduce BPF_F_CPU and BPF_F_ALL_CPUS flags for percpu maps Leon Hwang
2025-11-25 14:58 ` [PATCH bpf-next v11 1/8] bpf: Introduce internal bpf_map_check_op_flags helper function Leon Hwang
2025-11-25 14:58 ` [PATCH bpf-next v11 2/8] bpf: Introduce BPF_F_CPU and BPF_F_ALL_CPUS flags Leon Hwang
2025-11-25 23:21   ` Alexei Starovoitov
2025-11-25 14:58 ` [PATCH bpf-next v11 3/8] bpf: Add BPF_F_CPU and BPF_F_ALL_CPUS flags support for percpu_array maps Leon Hwang
2025-11-25 15:24   ` bot+bpf-ci
2025-11-25 14:58 ` [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 Leon Hwang
2025-11-25 23:11   ` Alexei Starovoitov
2025-11-26  2:00     ` Leon Hwang [this message]
2025-11-25 14:58 ` [PATCH bpf-next v11 5/8] bpf: Copy map value using copy_map_value_long for percpu_cgroup_storage maps Leon Hwang
2025-11-25 15:24   ` bot+bpf-ci
2025-11-25 14:58 ` [PATCH bpf-next v11 6/8] bpf: Add BPF_F_CPU and BPF_F_ALL_CPUS flags support " Leon Hwang
2025-11-25 14:58 ` [PATCH bpf-next v11 7/8] libbpf: Add BPF_F_CPU and BPF_F_ALL_CPUS flags support for percpu maps Leon Hwang
2025-11-25 14:58 ` [PATCH bpf-next v11 8/8] selftests/bpf: Add cases to test BPF_F_CPU and BPF_F_ALL_CPUS flags 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=8e764e95-2a50-4a48-9b89-808334460c95@linux.dev \
    --to=leon.hwang@linux.dev \
    --cc=a.s.protopopov@gmail.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=chen.dylane@linux.dev \
    --cc=daniel@iogearbox.net \
    --cc=deso@posteo.net \
    --cc=dxu@dxuuu.xyz \
    --cc=eddyz87@gmail.com \
    --cc=haoluo@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kernel-patches-bot@fb.com \
    --cc=kerneljasonxing@gmail.com \
    --cc=kpsingh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=memxor@gmail.com \
    --cc=paul.chaignon@gmail.com \
    --cc=sdf@fomichev.me \
    --cc=shuah@kernel.org \
    --cc=song@kernel.org \
    --cc=tklauser@distanz.ch \
    --cc=willemb@google.com \
    --cc=yatsenko@meta.com \
    --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