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

From: Björn Töpel
Date: Thu May 11 2023 - 15:44:11 EST


Song Shuai <suagrfillet@xxxxxxxxx> 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@xxxxxxxxx>
> Tested-by: Guo Ren <guoren@xxxxxxxxxx>
> Signed-off-by: Guo Ren <guoren@xxxxxxxxxx>

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

Acked-by: Björn Töpel <bjorn@xxxxxxxxxxxx>