Re: [RFC v2 PATCH bpf-next 4/4] selftests/bpf: test map percpu stats

Alexei Starovoitov
2023-06-22T20:21:06Z

On Thu, Jun 22, 2023 at 09:58:14AM +0000, Anton Protopopov wrote:
> Add a new map test, map_percpu_stats.c, which is checking the correctness of
> map's percpu elements counters. For supported maps the test upserts a number
> of elements, checks the correctness of the counters, then deletes all the
> elements and checks again that the counters sum drops down to zero.
>
> The following map types are tested:
>
> * BPF_MAP_TYPE_HASH, BPF_F_NO_PREALLOC
> * BPF_MAP_TYPE_PERCPU_HASH, BPF_F_NO_PREALLOC
> * BPF_MAP_TYPE_HASH,
> * BPF_MAP_TYPE_PERCPU_HASH,
> * BPF_MAP_TYPE_LRU_HASH
> * BPF_MAP_TYPE_LRU_PERCPU_HASH
>
> Signed-off-by: Anton Protopopov <aspsk@isovalent.com>
> ---
> .../bpf/map_tests/map_percpu_stats.c | 336 ++++++++++++++++++
> .../selftests/bpf/progs/map_percpu_stats.c | 24 ++

please add another patch with an extension to map_ptr_kern.c
where it not only checks hash->count.counter, but new elem count as well.