[RFC PATCH -next v2 3/4] arm64/ftrace: support dynamically allocated trampolines
Steven Rostedt
rostedt at goodmis.org
Mon May 9 11:22:03 PDT 2022
On Thu, 5 May 2022 12:15:38 +0900
Masami Hiramatsu <mhiramat at kernel.org> wrote:
> OK. But my interest is that the ftrace on arm64 can provide a limited
> access to registers via pt_regs or not. I don't mind the contained values
> so much because in the most case, 'users' will (most likely) access to the
> ARGs via BPF or tracefs (and we can just warn users if they try to access
> the registers which is not saved.) But if the arm64 ftrace only provides
> a special data structure, arch-independent code must have 2 different access
> code. That is inefficient. That is my concern.
> IOW, I'm interested in interface abstraction.
Note, ftrace now has a ftrace_regs structure that is passed to the
callbacks for the function tracer.
It then has an arch dependent helper function ftrace_get_regs(fregs), that
returns a pt_regs from the fregs only if the fregs has a full pt_regs to
return. If not, it returns NULL.
This was suggested by both Peter Zijlstra and Thomas Gleixner when I
introduced FTRACE_WITH_ARGS, where all functions can now get the arguments
from fregs, but not the full pt_regs. If a ftrace_ops has the REGS flag set
(using ftrace_regs_caller), the ftrace_get_regs(fregs) will return the
pt_regs, or it will return NULL if ftrace_regs_caller was not used.
This way the same parameter can provide full pt_regs or a subset, and have
an generic interface to tell the difference.
-- Steve
More information about the linux-arm-kernel
mailing list