summaryrefslogtreecommitdiff
path: root/samples/ftrace/ftrace-direct-modify.c
diff options
context:
space:
mode:
authorNaveen N Rao <naveen@kernel.org>2024-10-30 12:38:48 +0530
committerMichael Ellerman <mpe@ellerman.id.au>2024-10-31 11:00:55 +1100
commita52f6043a2238d656ddd23ce0499cf4f12645faa (patch)
treeebe1db9c7dd95c9e11a84bfc6b17961cc8281cdf /samples/ftrace/ftrace-direct-modify.c
parente717754f0bb5c5347aac82232691340955735ce1 (diff)
downloadlwn-a52f6043a2238d656ddd23ce0499cf4f12645faa.tar.gz
lwn-a52f6043a2238d656ddd23ce0499cf4f12645faa.zip
powerpc/ftrace: Add support for DYNAMIC_FTRACE_WITH_DIRECT_CALLS
Add support for DYNAMIC_FTRACE_WITH_DIRECT_CALLS similar to the arm64 implementation. ftrace direct calls allow custom trampolines to be called into directly from function ftrace call sites, bypassing the ftrace trampoline completely. This functionality is currently utilized by BPF trampolines to hook into kernel function entries. Since we have limited relative branch range, we support ftrace direct calls through support for DYNAMIC_FTRACE_WITH_CALL_OPS. In this approach, ftrace trampoline is not entirely bypassed. Rather, it is re-purposed into a stub that reads direct_call field from the associated ftrace_ops structure and branches into that, if it is not NULL. For this, it is sufficient if we can ensure that the ftrace trampoline is reachable from all traceable functions. When multiple ftrace_ops are associated with a call site, we utilize a call back to set pt_regs->orig_gpr3 that can then be tested on the return path from the ftrace trampoline to branch into the direct caller. Signed-off-by: Naveen N Rao <naveen@kernel.org> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://patch.msgid.link/20241030070850.1361304-16-hbathini@linux.ibm.com
Diffstat (limited to 'samples/ftrace/ftrace-direct-modify.c')
0 files changed, 0 insertions, 0 deletions