From: Kumar Kartikeya Dwivedi <memxor@gmail.com>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: bpf <bpf@vger.kernel.org>, "Alexei Starovoitov" <ast@kernel.org>,
"Daniel Borkmann" <daniel@iogearbox.net>,
"Andrii Nakryiko" <andrii@kernel.org>,
"Martin KaFai Lau" <kafai@fb.com>,
"Song Liu" <songliubraving@fb.com>, "Yonghong Song" <yhs@fb.com>,
"Jesper Dangaard Brouer" <brouer@redhat.com>,
"Toke Høiland-Jørgensen" <toke@redhat.com>,
Networking <netdev@vger.kernel.org>
Subject: Re: [PATCH bpf-next RFC v1 3/8] libbpf: Support kernel module function calls
Date: Wed, 1 Sep 2021 07:57:01 +0530 [thread overview]
Message-ID: <20210901022701.g7nzkmm6lo7jf3wd@apollo.localdomain> (raw)
In-Reply-To: <CAEf4Bza11W+NPt1guXj87fy_xcsWLHeFLNK0OkzL9A+TfcYhog@mail.gmail.com>
On Wed, Sep 01, 2021 at 06:25:14AM IST, Andrii Nakryiko wrote:
> On Mon, Aug 30, 2021 at 10:34 AM Kumar Kartikeya Dwivedi
> <memxor@gmail.com> wrote:
> >
>
> -ENOCOMMITMESSAGE?
>
> > Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
> > ---
> > tools/lib/bpf/bpf.c | 3 ++
> > tools/lib/bpf/libbpf.c | 71 +++++++++++++++++++++++++++++++--
> > tools/lib/bpf/libbpf_internal.h | 2 +
> > 3 files changed, 73 insertions(+), 3 deletions(-)
> >
>
> [...]
>
> > @@ -515,6 +521,13 @@ struct bpf_object {
> > void *priv;
> > bpf_object_clear_priv_t clear_priv;
> >
> > + struct {
> > + struct hashmap *map;
> > + int *fds;
> > + size_t cap_cnt;
> > + __u32 n_fds;
> > + } kfunc_btf_fds;
> > +
> > char path[];
> > };
> > #define obj_elf_valid(o) ((o)->efile.elf)
> > @@ -5327,6 +5340,7 @@ bpf_object__relocate_data(struct bpf_object *obj, struct bpf_program *prog)
> > ext = &obj->externs[relo->sym_off];
> > insn[0].src_reg = BPF_PSEUDO_KFUNC_CALL;
> > insn[0].imm = ext->ksym.kernel_btf_id;
> > + insn[0].off = ext->ksym.offset;
>
> Just a few lines above we use insn[1].imm =
> ext->ksym.kernel_btf_obj_fd; for EXT_KSYM (for variables). Why are you
> inventing a new form if we already have a pretty consistent pattern?
>
That makes sense. This is all new to me, so I went with what was described in
e6ac2450d6de (bpf: Support bpf program calling kernel function), but I'll rework
it to encode the btf fd like that in the next spin. It also makes the everything
far simpler.
> > break;
> > case RELO_SUBPROG_ADDR:
> > if (insn[0].src_reg != BPF_PSEUDO_FUNC) {
>
> [...]
--
Kartikeya
next prev parent reply other threads:[~2021-09-01 2:27 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-30 17:34 [PATCH bpf-next RFC v1 0/8] Support kernel module function calls from eBPF Kumar Kartikeya Dwivedi
2021-08-30 17:34 ` [PATCH bpf-next RFC v1 1/8] bpf: Introduce BPF support for kernel module function calls Kumar Kartikeya Dwivedi
2021-08-30 20:01 ` Alexei Starovoitov
2021-08-30 17:34 ` [PATCH bpf-next RFC v1 2/8] bpf: Be conservative during verification for invalid kfunc calls Kumar Kartikeya Dwivedi
2021-08-30 17:34 ` [PATCH bpf-next RFC v1 3/8] libbpf: Support kernel module function calls Kumar Kartikeya Dwivedi
2021-09-01 0:55 ` Andrii Nakryiko
2021-09-01 2:27 ` Kumar Kartikeya Dwivedi [this message]
2021-09-01 2:59 ` Alexei Starovoitov
2021-09-01 3:38 ` Andrii Nakryiko
2021-08-30 17:34 ` [PATCH bpf-next RFC v1 4/8] libbpf: Resolve invalid kfunc calls with imm = 0, off = 0 Kumar Kartikeya Dwivedi
2021-09-01 0:35 ` Andrii Nakryiko
2021-08-30 17:34 ` [PATCH bpf-next RFC v1 5/8] tools: Allow specifying base BTF file in resolve_btfids Kumar Kartikeya Dwivedi
2021-08-30 17:34 ` [PATCH bpf-next RFC v1 6/8] bpf: btf: Introduce helpers for dynamic BTF set registration Kumar Kartikeya Dwivedi
2021-08-30 17:34 ` [PATCH bpf-next RFC v1 7/8] bpf: enable TCP congestion control kfunc from modules Kumar Kartikeya Dwivedi
2021-09-01 0:48 ` Andrii Nakryiko
2021-08-30 17:34 ` [PATCH bpf-next RFC v1 8/8] bpf, selftests: Add basic test for module kfunc call Kumar Kartikeya Dwivedi
2021-08-30 20:07 ` Alexei Starovoitov
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=20210901022701.g7nzkmm6lo7jf3wd@apollo.localdomain \
--to=memxor@gmail.com \
--cc=andrii.nakryiko@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=brouer@redhat.com \
--cc=daniel@iogearbox.net \
--cc=kafai@fb.com \
--cc=netdev@vger.kernel.org \
--cc=songliubraving@fb.com \
--cc=toke@redhat.com \
--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;
as well as URLs for NNTP newsgroup(s).