[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <5a633862-ae0e-43ba-8da6-0f03efd01bde@linux.dev>
Date: Mon, 24 Nov 2025 22:23:53 +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 v10 8/8] selftests/bpf: Add cases to test
BPF_F_CPU and BPF_F_ALL_CPUS flags
On 2025/11/22 10:34, Alexei Starovoitov wrote:
> On Mon, Nov 17, 2025 at 8:22 AM Leon Hwang <leon.hwang@...ux.dev> wrote:
>>
[...]
>> +
>> + /* lookup then check value on CPUs */
>> + for (j = 0; j < nr_cpus; j++) {
>> + flags = (u64)j << 32 | BPF_F_CPU;
>> + err = bpf_map__lookup_elem(map, keys + i * key_sz, key_sz, values,
>> + value_sz, flags);
>> + if (!ASSERT_OK(err, "bpf_map__lookup_elem specified cpu"))
>> + goto out;
>> + if (!ASSERT_EQ(values[0], j != cpu ? 0 : value,
>> + "bpf_map__lookup_elem value on specified cpu"))
>> + goto out;
>
> I was about to apply it, but noticed that the test is unstable.
> It fails 1 out of 10 for me in the above line.
> test_percpu_map_op_cpu_flag:PASS:bpf_map_lookup_batch value on
> specified cpu 0 nsec
> test_percpu_map_op_cpu_flag:FAIL:bpf_map_lookup_batch value on
> specified cpu unexpected bpf_map_lookup_batch value on specified cpu:
> actual 0 != expected 3735929054
> #261/15 percpu_alloc/cpu_flag_lru_percpu_hash:FAIL
> #261 percpu_alloc:FAIL
>
> Please investigate what is going on.
>
I was able to reproduce the failure on a 16-core VM.
It appears to be caused by LRU eviction. When I increased max_entries of
the lru_percpu_hash map to libbpf_num_possible_cpus(), the issue no
longer reproduced.
I'll need to spend more time investigating the exact eviction behavior
and why it shows up intermittently in this test.
Thanks,
Leon
Powered by blists - more mailing lists