On 26/11/25 07:11, Alexei Starovoitov wrote:
> On Tue, Nov 25, 2025 at 7:00 AM Leon Hwang <[email protected]> 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 via email to