Re: [PATCH bpf-next 2/2] bpf: Show total linked progs cnt instead of selector in trampoline ksym

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

 



On Wed, May 10, 2023 at 1:43 AM Song Liu <song@xxxxxxxxxx> wrote:
>
> On Tue, May 9, 2023 at 8:15 AM Yafang Shao <laoar.shao@xxxxxxxxx> wrote:
> >
> > After commit e21aa341785c ("bpf: Fix fexit trampoline."), the selector
> > is only used to indicate how many times the bpf trampoline image are
> > updated and been displayed in the trampoline ksym name. After the
> > trampoline is freed, the count will start from 0 again.
> > So the count is a useless value to the user, we'd better
> > show a more meaningful value like how many progs are linked to this
> > trampoline. After that change, the selector can be removed eventally.
> > If the user want to check whether the bpf trampoline image has been updated
> > or not, the user can also compare the address. Each time the trampoline
> > image is updated, the address will change consequently.
>
> I wonder whether this will cause confusion to some users. Maybe the saving
> doesn't worth the churn.

The trampoline ksym name as such:
ffffffffc06c3000 t bpf_trampoline_6442453466_1  [bpf]

I don't know what the user may use the selector for. It seems that the
selector is meaningless. While the cnt of linked progs can really help
users, with which the user can easily figure out how many progs are
linked to a kernel function.

However the key in the ksym name really confused me before, because
its meaning was changed.

In the old kernel(for example, the 4.19), it is
  bpf_trampoline_[BTF_ID]
while in the new kernel, it is
  bpf_trampoline_[ OBJ_ID | BTF_ID ]_[ SELECTOR ]

But I think that is not a big problem, because the user tools can be
changed to (key & 0x7fffffff) to make it backward compatible.

Currently there's no document on the name, so we can choose what we
prefer. After we doc it, we have to keep it backward compatible.
BTW, I think we should add a document on the name, otherwise the user
has to read the kernel code to parse it.

-- 
Regards
Yafang





[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