Thread (17 messages) flat view 17 messages, 3 authors, 2021-09-01

Re: [PATCH bpf-next RFC v1 3/8] libbpf: Support kernel module function calls

From: Andrii Nakryiko <hidden>
Date: 2021-09-01 00:55:27
Also in: bpf

On Mon, Aug 30, 2021 at 10:34 AM Kumar Kartikeya Dwivedi
[off-list ref] 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(-)
[...]
quoted hunk ↗ jump to hunk
@@ -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?
                        break;
                case RELO_SUBPROG_ADDR:
                        if (insn[0].src_reg != BPF_PSEUDO_FUNC) {
[...]
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help