[PATCH V10 3/4] riscv: ftrace: Add DYNAMIC_FTRACE_WITH_DIRECT_CALLS support

Björn Töpel bjorn at kernel.org
Thu May 11 12:42:03 PDT 2023


Song Shuai <suagrfillet at gmail.com> writes:

> This patch adds DYNAMIC_FTRACE_WITH_DIRECT_CALLS support for RISC-V.
>
> select the DYNAMIC_FTRACE_WITH_DIRECT_CALLS to provide the
> register_ftrace_direct[_multi] interfaces allowing users to register
> the customed trampoline (direct_caller) as the mcount for one or
> more target functions. And modify_ftrace_direct[_multi] are also
> provided for modifying direct_caller.
>
> To make the direct_caller and the other ftrace hooks (eg. function/fgraph
> tracer, k[ret]probes) co-exist, a temporary register is nominated to
> store the address of direct_caller in ftrace_regs_caller. After the
> setting of the address direct_caller by direct_ops->func and the
> RESTORE_REGS in ftrace_regs_caller, direct_caller will be jumped to
> by the `jr` inst.
>
> Signed-off-by: Song Shuai <suagrfillet at gmail.com>
> Tested-by: Guo Ren <guoren at kernel.org>
> Signed-off-by: Guo Ren <guoren at kernel.org>

Thank you for addressing my comments, and for your work on
WITH_DIRECT_CALLS!

Acked-by: Björn Töpel <bjorn at rivosinc.com>



More information about the linux-riscv mailing list