BPF List
 help / color / mirror / Atom feed
From: David Vernet <void@manifault.com>
To: Joanne Koong <joannelkoong@gmail.com>
Cc: bpf@vger.kernel.org, andrii@kernel.org, ast@kernel.org,
	daniel@iogearbox.net
Subject: Re: [PATCH bpf-next v4 3/6] bpf: Dynptr support for ring buffers
Date: Mon, 16 May 2022 09:09:32 -0700	[thread overview]
Message-ID: <20220516160932.mttpfphr6rkm4ve7@dev0025.ash9.facebook.com> (raw)
In-Reply-To: <20220509224257.3222614-4-joannelkoong@gmail.com>

On Mon, May 09, 2022 at 03:42:54PM -0700, Joanne Koong wrote:
> Currently, our only way of writing dynamically-sized data into a ring
> buffer is through bpf_ringbuf_output but this incurs an extra memcpy
> cost. bpf_ringbuf_reserve + bpf_ringbuf_commit avoids this extra
> memcpy, but it can only safely support reservation sizes that are
> statically known since the verifier cannot guarantee that the bpf
> program won’t access memory outside the reserved space.
> 
> The bpf_dynptr abstraction allows for dynamically-sized ring buffer
> reservations without the extra memcpy.
> 
> There are 3 new APIs:
> 
> long bpf_ringbuf_reserve_dynptr(void *ringbuf, u32 size, u64 flags, struct bpf_dynptr *ptr);
> void bpf_ringbuf_submit_dynptr(struct bpf_dynptr *ptr, u64 flags);
> void bpf_ringbuf_discard_dynptr(struct bpf_dynptr *ptr, u64 flags);
> 
> These closely follow the functionalities of the original ringbuf APIs.
> For example, all ringbuffer dynptrs that have been reserved must be
> either submitted or discarded before the program exits.
> 
> Signed-off-by: Joanne Koong <joannelkoong@gmail.com>

Looks good!

Acked-by: David Vernet <void@manifault.com>

  parent reply	other threads:[~2022-05-16 16:09 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-09 22:42 [PATCH bpf-next v4 0/6] Dynamic pointers Joanne Koong
2022-05-09 22:42 ` [PATCH bpf-next v4 1/6] bpf: Add MEM_UNINIT as a bpf_type_flag Joanne Koong
2022-05-13 14:11   ` David Vernet
2022-05-09 22:42 ` [PATCH bpf-next v4 2/6] bpf: Add verifier support for dynptrs and implement malloc dynptrs Joanne Koong
2022-05-12  0:05   ` Daniel Borkmann
2022-05-12 20:03     ` Joanne Koong
2022-05-13 13:12       ` Daniel Borkmann
2022-05-13 16:39         ` Alexei Starovoitov
2022-05-13 19:28           ` Daniel Borkmann
2022-05-13 21:04             ` Andrii Nakryiko
2022-05-13 22:16             ` Alexei Starovoitov
2022-05-16 20:29               ` Joanne Koong
2022-05-16 20:52     ` Joanne Koong
2022-05-13 20:59   ` Andrii Nakryiko
2022-05-13 21:36   ` David Vernet
2022-05-09 22:42 ` [PATCH bpf-next v4 3/6] bpf: Dynptr support for ring buffers Joanne Koong
2022-05-13 21:02   ` Andrii Nakryiko
2022-05-16 16:09   ` David Vernet [this message]
2022-05-09 22:42 ` [PATCH bpf-next v4 4/6] bpf: Add bpf_dynptr_read and bpf_dynptr_write Joanne Koong
2022-05-13 21:06   ` Andrii Nakryiko
2022-05-16 16:56   ` David Vernet
2022-05-16 17:23     ` Joanne Koong
2022-05-09 22:42 ` [PATCH bpf-next v4 5/6] bpf: Add dynptr data slices Joanne Koong
2022-05-13 21:11   ` Andrii Nakryiko
2022-05-13 21:37   ` Alexei Starovoitov
2022-05-16 17:13     ` Joanne Koong
2022-05-09 22:42 ` [PATCH bpf-next v4 6/6] bpf: Dynptr tests Joanne Koong

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=20220516160932.mttpfphr6rkm4ve7@dev0025.ash9.facebook.com \
    --to=void@manifault.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=joannelkoong@gmail.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