Re: [PATCH v3 4/4] LoongArch: ftrace: Adjust register stack restore order in direct call trampolines

From: Steven Rostedt
Date: Tue Dec 16 2025 - 12:13:59 EST


On Tue, 16 Dec 2025 17:47:53 +0800
Chenghao Duan <duanchenghao@xxxxxxxxxx> wrote:

> Ensure that in the ftrace direct call logic, the CPU register state
> (with ra = parent return address) is restored to the correct state
> after the execution of the custom trampoline function and before
> returning to the traced function. Additionally, guarantee the
> correctness of the jump logic for jr t0 (traced function address).
>
> Reported-by: Youling Tang <tangyouling@xxxxxxxxxx>
> Signed-off-by: Chenghao Duan <duanchenghao@xxxxxxxxxx>
> ---
> samples/ftrace/ftrace-direct-modify.c | 8 ++++----
> samples/ftrace/ftrace-direct-multi-modify.c | 8 ++++----
> samples/ftrace/ftrace-direct-multi.c | 4 ++--
> samples/ftrace/ftrace-direct-too.c | 4 ++--
> samples/ftrace/ftrace-direct.c | 4 ++--
> 5 files changed, 14 insertions(+), 14 deletions(-)

This is all LoongArch specific, but in case you need this to go through
your tree:

Acked-by: Steven Rostedt (Google) <rostedt@xxxxxxxxxxx>

-- Steve