From: Mahe Tardy <mahe.tardy@gmail.com>
To: Sid Nayyar <sidnayyar@google.com>
Cc: "Anton Protopopov" <aspsk2@gmail.com>,
"Alexei Starovoitov" <alexei.starovoitov@gmail.com>,
"Ihor Solodrai" <ihor.solodrai@linux.dev>,
"Daniel Borkmann" <daniel@iogearbox.net>,
"John Fastabend" <john.fastabend@gmail.com>,
"Andrii Nakryiko" <andrii@kernel.org>,
"Eduard Zingerman" <eddyz87@gmail.com>,
"Kumar Kartikeya Dwivedi" <memxor@gmail.com>,
"Martin KaFai Lau" <martin.lau@linux.dev>,
"Song Liu" <song@kernel.org>,
"Yonghong Song" <yonghong.song@linux.dev>,
"Jiri Olsa" <jolsa@kernel.org>,
"Emil Tsalapatis" <emil@etsalapatis.com>,
"Quentin Monnet" <qmo@kernel.org>,
"Shuah Khan" <shuah@kernel.org>,
bpf@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-kselftest@vger.kernel.org,
"Giuliano Procida" <gprocida@google.com>,
"Neill Kapron" <nkapron@google.com>,
"Thiébaud Weksteen" <tweek@google.com>,
"Maxime Ripard" <mripard@kernel.org>
Subject: Re: [PATCH RFC bpf-next 0/7] bpf: Support struct_ops in light skeletons
Date: Mon, 30 Nov 2026 19:14:34 +0100 [thread overview]
Message-ID: <aw29CkSnTXrly6az@gmail.com> (raw)
In-Reply-To: <CA+OvW8ZADPDZJYURT+a2kwvWcsgdJvzP5Q9sJuvXnnL2kgZ2dQ@mail.gmail.com>
On Wed, Nov 11, 2026 at 01:05:25PM +0530, Sid Nayyar wrote:
> On Tue, Nov 10, 2026 at 6:43 PM Anton Protopopov <aspsk2@gmail.com> wrote:
> >
> > On Mon, Nov 9, 2026 at 10:40 PM Alexei Starovoitov
> > <alexei.starovoitov@gmail.com> wrote:
> > >
> > > On Mon, Nov 09, 2026 at 11:46 AM Ihor Solodrai <ihor.solodrai@linux.dev> wrote:
> > >
> > > > Andrii, Alexei, wdyt? Any other ideas?
> > >
> > > The loader asks the kernel for ids, sizes and offsets only to pass them
> > > back in the next three commands:
> > >
> > > the loader asks and passes it back in
> > > -------------------------------- ------------------------------------
> > > id, size of bpf_struct_ops_<t> BPF_MAP_CREATE
> > > id of <t>, index of the member BPF_PROG_LOAD
> > > offset of data, of every member BPF_MAP_UPDATE_ELEM
> > >
> > > the kernel can match by name instead.
> > >
> > > The kernel has both BTFs. BPF_MAP_CREATE of a struct_ops map demands
> > > btf_fd of the object already, and bpf_struct_ops.c doesn't use it.
> > > The kernel can find its struct_ops and the members by name,
> > > like btf_parse_kptr() finds the type of a kptr.
> > > Then the loader passes what bpftool knows when it generates
> > > the skeleton:
> > >
> > > command the loader passes
> > > ------------------- ---------------------------------------------------
> > > BPF_MAP_CREATE btf_fd, btf_value_type_id and value_size of the
> > > struct in the BTF of the object
> > > BPF_PROG_LOAD attach_btf_obj_fd = btf_fd, attach_btf_id = that
> > > struct, expected_attach_type = index of its member
> > > BPF_MAP_UPDATE_ELEM that struct with the prog fds in it
> > >
> > > The kernel rejects such BPF_MAP_CREATE and BPF_PROG_LOAD today.
> > > Nothing changes for existing users.
> > > The BTF of the object is in the blob, so the signature covers the names.
> > >
> > > Then no need for a helper or a kfunc. The 4k buffer, the fds of module
> > > BTF and the offsets at run time go away.
> > > map->def.value_size, prog->attach_btf_id and prog->expected_attach_type
> > > don't hold offsets into the blob.
> > >
> > > The diff below replaces patches 1-5. Patches 6 and 7 stay.
> >
> > I like Alexei's approach here, it fits with shirudo. I also have tested it.
> > (Patches 6,7 weren't tested, shirudo uses libbpf without bpftool.)
> >
>
> Thank you Alexei, Ihor and Anton for the reviews.
>
> I agree that the loader's efforts to find out ids, sizes and offsets
> for STRUCT_OPS maps and its members is wasteful since it only passes
> those values back to the kernel. I will redo my patch series using
> Alexei's proposed approach and send it out for review as soon as
> possible.
Hey Sid, I'm working with Anton and we are interested into merging this
to have this for 7.5 eventually. We've been following this and since
it's been something like 20 days, would that help if we re-send this
patch set with Alexei's proposal. Thanks!
>
> Regards,
> Siddharth
>
> > >
> > > [...]
> > >
next prev parent reply other threads:[~2026-11-30 18:14 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-06 20:19 Siddharth Nayyar
2026-11-06 20:19 ` [PATCH RFC bpf-next 1/7] bpf: Add bpf_btf_get_struct_member_info() helper Siddharth Nayyar
2026-11-06 20:56 ` bot+bpf-ci
2026-11-06 20:19 ` [PATCH RFC bpf-next 2/7] libbpf: Implement bpf_gen__init_kern_struct_ops() for light skeletons Siddharth Nayyar
2026-11-06 20:56 ` bot+bpf-ci
2026-11-06 20:19 ` [PATCH RFC bpf-next 3/7] libbpf: Support BPF_MAP_TYPE_STRUCT_OPS in bpf_gen__map_create() Siddharth Nayyar
2026-11-06 20:56 ` bot+bpf-ci
2026-11-06 20:19 ` [PATCH RFC bpf-next 4/7] libbpf: Support BPF_PROG_TYPE_STRUCT_OPS in bpf_gen__prog_load() Siddharth Nayyar
2026-11-06 20:56 ` bot+bpf-ci
2026-11-06 20:19 ` [PATCH RFC bpf-next 5/7] libbpf: Implement bpf_gen__struct_ops_update_elem() for light skeletons Siddharth Nayyar
2026-11-06 20:56 ` bot+bpf-ci
2026-11-06 20:19 ` [PATCH RFC bpf-next 6/7] bpftool: Generate attach and detach for struct_ops in " Siddharth Nayyar
2026-11-06 20:19 ` [PATCH RFC bpf-next 7/7] selftests/bpf: Add light skeleton struct_ops tests Siddharth Nayyar
2026-11-09 19:46 ` [PATCH RFC bpf-next 0/7] bpf: Support struct_ops in light skeletons Ihor Solodrai
2026-11-09 21:39 ` Alexei Starovoitov
2026-11-10 13:08 ` Anton Protopopov
2026-11-10 13:12 ` Anton Protopopov
2026-11-11 7:35 ` Sid Nayyar
2026-11-30 18:14 ` Mahe Tardy [this message]
2026-11-30 18:21 ` Alexei Starovoitov
2026-11-30 19:20 ` Sid Nayyar
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=aw29CkSnTXrly6az@gmail.com \
--to=mahe.tardy@gmail.com \
--cc=alexei.starovoitov@gmail.com \
--cc=andrii@kernel.org \
--cc=aspsk2@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=emil@etsalapatis.com \
--cc=gprocida@google.com \
--cc=ihor.solodrai@linux.dev \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=memxor@gmail.com \
--cc=mripard@kernel.org \
--cc=nkapron@google.com \
--cc=qmo@kernel.org \
--cc=shuah@kernel.org \
--cc=sidnayyar@google.com \
--cc=song@kernel.org \
--cc=tweek@google.com \
--cc=yonghong.song@linux.dev \
/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
all inboxes | Powered by JetHome®