Re: [RFC PATCH] x86: add function metadata support

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

 



On Tue, 11 Feb 2025 20:03:38 +0800
Menglong Dong <menglong8.dong@xxxxxxxxx> wrote:


> 
> Another beneficiary can be ftrace. For now, all the kernel functions that
> are enabled by dynamic ftrace will be added to a filter hash. And hash
> lookup will happen when then traced functions are called, which has an
> impact on the performance, see
> __ftrace_ops_list_func() -> ftrace_ops_test(). With the per-function metadata
> support, we can store the information that if the ftrace ops is enabled on the
> kernel function to the metadata.

Note, ftrace only uses ftrace_ops_list if there's more than one callback
attached to the same function. Otherwise it calls directly to a single
trampoline, and is rather efficient. No meta data needed.

> > Arm64 and other archs add meta data before the functions too. Can we have
> > an effort to perhaps share these methods?  
> 
> I have not done research on arm64 yet. AFAIK, arm64 insn is 16-bytes aligned,
> so the way we process can be a little different here, as making kernel function
> non 16-bytes aligned can have a huge influence.

Arm64 already uses the meta data before every function. That's where it
stores a pointer to the ftrace_ops. So in ftrace, when there's a single
callback attached to a function in arm64, it jumps to a ftrace trampoline,
that will reference the function's meta data to find the ftrace_ops to use
for that callback.

If more than one callback is attached to the same function, then it acts
just like x86 and does the loop.

-- Steve




[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