public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
From: Anton Protopopov <aspsk@isovalent.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: Andrii Nakryiko <andrii@kernel.org>,
	Mykola Lysenko <mykolal@fb.com>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Martin KaFai Lau <martin.lau@linux.dev>,
	Song Liu <song@kernel.org>, Yonghong Song <yhs@fb.com>,
	John Fastabend <john.fastabend@gmail.com>,
	KP Singh <kpsingh@kernel.org>,
	Stanislav Fomichev <sdf@google.com>, Hao Luo <haoluo@google.com>,
	Jiri Olsa <jolsa@kernel.org>, Shuah Khan <shuah@kernel.org>,
	bpf@vger.kernel.org
Subject: Re: [RFC v2 PATCH bpf-next 4/4] selftests/bpf: test map percpu stats
Date: Mon, 26 Jun 2023 14:37:29 +0000	[thread overview]
Message-ID: <ZJmiqR9rS7j49SPM@zh-lab-node-5> (raw)
In-Reply-To: <20230622202059.ybeta3p3qknqbor4@macbook-pro-8.dhcp.thefacebook.com>

On Thu, Jun 22, 2023 at 01:20:59PM -0700, Alexei Starovoitov wrote:
> 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.

In fact, it looks like to add this check is out of the scope of this series:
the new kfunc expects a pointer to a trusted btf object, while a pointer
which we get from a static map address is a const pointer to map ("map_ptr"),
which is AFAICS currently not supported by the core kfunc code.

I've added a check that the percpu pointer itself is initialized (not NULL).

  reply	other threads:[~2023-06-26 14:36 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-22  9:53 [RFC v2 PATCH bpf-next 0/4] bpf: add percpu stats for bpf_map Anton Protopopov
2023-06-22  9:53 ` [RFC v2 PATCH bpf-next 1/4] bpf: add percpu stats for bpf_map elements insertions/deletions Anton Protopopov
2023-06-22 20:11   ` Alexei Starovoitov
2023-06-23 12:47     ` Anton Protopopov
2023-06-23 10:51   ` Daniel Borkmann
2023-06-23 12:35     ` Anton Protopopov
2023-06-22  9:53 ` [RFC v2 PATCH bpf-next 2/4] bpf: populate the per-cpu insertions/deletions counters for hashmaps Anton Protopopov
2023-06-22 20:18   ` Alexei Starovoitov
2023-06-22  9:53 ` [RFC v2 PATCH bpf-next 3/4] bpf: make preloaded map iterators to display map elements count Anton Protopopov
2023-06-22  9:58 ` [RFC v2 PATCH bpf-next 4/4] selftests/bpf: test map percpu stats Anton Protopopov
2023-06-22 20:20   ` Alexei Starovoitov
2023-06-26 14:37     ` Anton Protopopov [this message]
2023-06-23  9:53 ` [RFC v2 PATCH bpf-next 0/4] bpf: add percpu stats for bpf_map Daniel Borkmann
2023-06-24  0:17   ` Alexei Starovoitov
2023-06-26  8:50     ` Daniel Borkmann

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=ZJmiqR9rS7j49SPM@zh-lab-node-5 \
    --to=aspsk@isovalent.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=haoluo@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=mykolal@fb.com \
    --cc=sdf@google.com \
    --cc=shuah@kernel.org \
    --cc=song@kernel.org \
    --cc=yhs@fb.com \
    /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