From: Eduard Zingerman <eddyz87@gmail.com>
To: Mykyta Yatsenko <mykyta.yatsenko5@gmail.com>,
bpf@vger.kernel.org, ast@kernel.org, andrii@kernel.org,
daniel@iogearbox.net, kafai@meta.com, kernel-team@meta.com,
memxor@gmail.com
Cc: Mykyta Yatsenko <yatsenko@meta.com>
Subject: Re: [PATCH bpf-next v3 10/10] selftests/bpf: add file dynptr tests
Date: Tue, 21 Oct 2025 09:40:00 -0700 [thread overview]
Message-ID: <9d682b66318060267e6ca6e90c0aa985e9e0f853.camel@gmail.com> (raw)
In-Reply-To: <b682bacf-8b61-42b2-9f4c-d617f9f56d17@gmail.com>
On Tue, 2025-10-21 at 14:55 +0100, Mykyta Yatsenko wrote:
[...]
> > > +struct {
> > > + __uint(type, BPF_MAP_TYPE_RINGBUF);
> > > + __uint(max_entries, 10000000);
> > > +} ringbuf SEC(".maps");
>
> > The test case lgtm, but a question: will it be possible to use an
> > array map instead of a ringbuf? Just to avoid the need to allocate
> > and discard the pointer.
>
> How do I use array map here? Should I set a map value to be a buffer of
> needed length (256KB) or use 1 byte value and 256K elements in the map?
> Honestly, both options seem a little awkward to me, but I'm not sure
> maybe it is an
> expected way to get a big buffer.
I think you can declare a top level char array of needed length and
libbpf will create an array map with a single element of that size.
E.g. see arrays `arr` and `small_arr` in progs/iters.c.
If, instead, you declare an array with 1-byte elements, verifier will
reject access past offset 0 for each lookup result.
> I like allocation/discard, as it guarantees that this temporary buffer
> is local to the
> current func execution and we need to run non-trivial deinitialization
> anyway.
If the goal is to memset the buffer to zero, I don't think that
ringbuf guarantees that newly allocated or discarded buffer are reset.
[...]
prev parent reply other threads:[~2025-10-21 16:40 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-20 22:25 [PATCH bpf-next v3 00/10] bpf: Introduce file dynptr Mykyta Yatsenko
2025-10-20 22:25 ` [PATCH bpf-next v3 01/10] selftests/bpf: remove unnecessary kfunc prototypes Mykyta Yatsenko
2025-10-20 22:25 ` [PATCH bpf-next v3 02/10] bpf: widen dynptr size/offset to 64 bit Mykyta Yatsenko
2025-10-20 23:01 ` Eduard Zingerman
2025-10-21 11:59 ` Mykyta Yatsenko
2025-10-20 22:25 ` [PATCH bpf-next v3 03/10] lib: move freader into buildid.h Mykyta Yatsenko
2025-10-20 22:25 ` [PATCH bpf-next v3 04/10] lib/freader: support reading more than 2 folios Mykyta Yatsenko
2025-10-20 22:25 ` [PATCH bpf-next v3 05/10] bpf: verifier: centralize const dynptr check in unmark_stack_slots_dynptr() Mykyta Yatsenko
2025-10-20 22:25 ` [PATCH bpf-next v3 06/10] bpf: add plumbing for file-backed dynptr Mykyta Yatsenko
2025-10-20 23:08 ` Eduard Zingerman
2025-10-20 22:25 ` [PATCH bpf-next v3 07/10] bpf: add kfuncs and helpers support for file dynptrs Mykyta Yatsenko
2025-10-20 22:25 ` [PATCH bpf-next v3 08/10] bpf: verifier: refactor kfunc specialization Mykyta Yatsenko
2025-10-20 23:38 ` Eduard Zingerman
2025-10-21 13:03 ` Mykyta Yatsenko
2025-10-20 22:25 ` [PATCH bpf-next v3 09/10] bpf: dispatch to sleepable file dynptr Mykyta Yatsenko
2025-10-20 22:25 ` [PATCH bpf-next v3 10/10] selftests/bpf: add file dynptr tests Mykyta Yatsenko
2025-10-21 0:45 ` Eduard Zingerman
2025-10-21 13:55 ` Mykyta Yatsenko
2025-10-21 16:40 ` Eduard Zingerman [this message]
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=9d682b66318060267e6ca6e90c0aa985e9e0f853.camel@gmail.com \
--to=eddyz87@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=kafai@meta.com \
--cc=kernel-team@meta.com \
--cc=memxor@gmail.com \
--cc=mykyta.yatsenko5@gmail.com \
--cc=yatsenko@meta.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.