From: Eduard Zingerman <eddyz87@gmail.com>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: Ihor Solodrai <ihor.solodrai@linux.dev>,
Mykyta Yatsenko <mykyta.yatsenko5@gmail.com>,
andrii@kernel.org, bpf@vger.kernel.org, ast@kernel.org,
daniel@iogearbox.net, mykolal@fb.com, kernel-team@meta.com
Subject: Re: [PATCH bpf-next 1/2] bpf: add bpf_dynptr_memset() kfunc
Date: Mon, 23 Jun 2025 14:45:35 -0700 [thread overview]
Message-ID: <59e7ca59c4c0ac455aa05c7ebd0ecd67871a5b47.camel@gmail.com> (raw)
In-Reply-To: <CAEf4BzYZBMOexPSM9=utpn22W=XMsztiE_X9AxO9CSSb1yv7LA@mail.gmail.com>
On Mon, 2025-06-23 at 14:38 -0700, Andrii Nakryiko wrote:
> On Thu, Jun 19, 2025 at 11:17 AM Eduard Zingerman <eddyz87@gmail.com> wrote:
> >
> > On Thu, 2025-06-19 at 11:13 -0700, Eduard Zingerman wrote:
> >
> > [...]
> >
> > > Also, what's the plan if you'd like to memset only a fragment of the
> > > memory pointed-to by dynptr?
> >
> > Oh, I see, there is bpf_dynptr_adjust(), sorry for the noise.
> >
>
> Even though we do have bpf_dynptr_adjust() for maximum generality and
> flexibility, for most dynptr-based APIs we try to pass also additional
> offset into dynptr to avoid unnecessary overhead. So it's not a bad
> idea to add this to bpf_memset(), IMO.
>
> bpf_memset(struct bpf_dynptr *dptr, u32 off, u8 val, u32 n) ?
>
> a bit unfortunate that we have 3 integers that you need to be careful
> to not swap accidentally, but even with just val and n you'd have to
> be careful. For other APIs we normally have offset to follow dynptr
> pointer, so hopefully this arrangement won't that surprising.
>
> Thoughts?
Unfortunate indeed.
The off and n being separated looks weird, tbh.
For dynptr funcs we actually have "dptr, off, size" everywhere, maybe
do the same here?
next prev parent reply other threads:[~2025-06-23 21:45 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-18 22:33 [PATCH bpf-next 1/2] bpf: add bpf_dynptr_memset() kfunc Ihor Solodrai
2025-06-18 22:33 ` [PATCH bpf-next 2/2] selftests/bpf: add test cases for bpf_dynptr_memset() Ihor Solodrai
2025-06-18 23:44 ` [PATCH bpf-next 1/2] bpf: add bpf_dynptr_memset() kfunc Mykyta Yatsenko
2025-06-19 17:09 ` Ihor Solodrai
2025-06-19 17:19 ` Eduard Zingerman
2025-06-19 17:55 ` Ihor Solodrai
2025-06-19 17:57 ` Eduard Zingerman
2025-06-19 18:04 ` Ihor Solodrai
2025-06-19 18:13 ` Eduard Zingerman
2025-06-19 18:17 ` Eduard Zingerman
2025-06-23 21:38 ` Andrii Nakryiko
2025-06-23 21:45 ` Eduard Zingerman [this message]
2025-06-23 22:12 ` Andrii Nakryiko
2025-06-20 15:09 ` Mykyta Yatsenko
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=59e7ca59c4c0ac455aa05c7ebd0ecd67871a5b47.camel@gmail.com \
--to=eddyz87@gmail.com \
--cc=andrii.nakryiko@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=ihor.solodrai@linux.dev \
--cc=kernel-team@meta.com \
--cc=mykolal@fb.com \
--cc=mykyta.yatsenko5@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;
as well as URLs for NNTP newsgroup(s).