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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
> <memxor@xxxxxxxxx> wrote:
> > [...]
> > +                       return -E2BIG;
> > +               }
> > +               ext->ksym.offset = index;
>
> > +       } 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.

> >
> >         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



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux