Thread (31 messages) 31 messages, 3 authors, 2021-09-25

Re: [PATCH bpf-next v4 06/11] libbpf: Support kernel module function calls

From: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Date: 2021-09-24 23:54:23
Also in: bpf

On Wed, Sep 22, 2021 at 04:11:13AM IST, Andrii Nakryiko wrote:
On Mon, Sep 20, 2021 at 7:15 AM Kumar Kartikeya Dwivedi
[off-list ref] wrote:
quoted
[...]
+                       return -E2BIG;
+               }
+               ext->ksym.offset = index;
quoted
+       } else {
+               ext->ksym.offset = 0;
        }
I think it will be cleaner if you move the entire offset determination
logic after all the other checks are performed and ext is mostly
populated. That will also make the logic shorter and simpler because
if ayou find kern_btf_fd match, you can exit early (or probably rather
Ack to everything else (including the other mail), but...
goto to report the match and exit). Otherwise
This sentence got eaten up.
quoted
        kern_func = btf__type_by_id(kern_btf, kfunc_id);
this is actually extremely wasteful for module BTFs. Let's add
internal (at least for now) helper that will search only for "own" BTF
types in the BTF, skipping types in base BTF. Something like
btf_type_by_id_own()?
Just to make sure I am not misunderstanding: I don't see where this is wasteful.
btf_type_by_id seems to not be searching anything, but just returns pointer in
base BTF if kfunc_id < btf->start_id, otherwise in module BTF.

What am I missing? I guess the 'kern_btf' name was the source of confusion? If
so, I'll rename it.

Thanks.

--
Kartikeya
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help