Re: [PATCH v1 1/2] LoongArch: Modify the jump logic of the trampoline
From: Tiezhu Yang
Date: Tue Dec 09 2025 - 19:49:39 EST
On 2025/12/9 下午5:34, Chenghao Duan wrote:
There are two methods to jump into the trampoline code for execution:
1. ftrace-managed.
2. Direct call.
Whether ftrace-managed or direct jump, ensure before trampoline entry:
t0=parent func return addr, ra=traced func return addr.
When managed by ftrace, the trampoline code execution flow utilizes
ftrace direct call, and it is required to ensure that the original
data in registers t0 and ra is not modification.
samples/ftrace/ftrace-direct_xxxx.c: update test code for ftrace direct
call (modify together).
Trampoline: adjust jump logic to use t0 (parent func return addr) and
ra (traced func return addr) as jump targets for respective scenarios
Signed-off-by: Youling Tang <tangyouling@xxxxxxxxxx>
When several people work on a single patch, please use the tag:
"Co-developed-by", for more info please see:
https://www.kernel.org/doc/html/latest/process/submitting-patches.html#when-to-use-acked-by-cc-and-co-developed-by
Signed-off-by: Chenghao Duan <duanchenghao@xxxxxxxxxx>
---
arch/loongarch/kernel/mcount_dyn.S | 14 +++++---
arch/loongarch/net/bpf_jit.c | 37 +++++++++++++++------
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 +--
7 files changed, 50 insertions(+), 29 deletions(-)
Thanks for the patch, it is good news.
Please split this patch into three parts:
(1) ftrace code
(2) sample test
(3) bpf code
and use proper patch subject and commit message for each patch.
Thanks,
Tiezhu