]> git.baikalelectronics.ru Git - kernel.git/commit
ftrace/x86: Allow for arguments to be passed in to ftrace_regs by default
authorSteven Rostedt (VMware) <rostedt@goodmis.org>
Tue, 27 Oct 2020 14:55:55 +0000 (10:55 -0400)
committerSteven Rostedt (VMware) <rostedt@goodmis.org>
Fri, 13 Nov 2020 17:14:59 +0000 (12:14 -0500)
commitf68b9618f72dd8db6d68e501a5d90fcbb954e337
tree60f4ae7249955f386d0d5d30a673d726ae4b9df8
parente3bc30d2a5861b02f6d2b00fe205c6b50df0c8c1
ftrace/x86: Allow for arguments to be passed in to ftrace_regs by default

Currently, the only way to get access to the registers of a function via a
ftrace callback is to set the "FL_SAVE_REGS" bit in the ftrace_ops. But as this
saves all regs as if a breakpoint were to trigger (for use with kprobes), it
is expensive.

The regs are already saved on the stack for the default ftrace callbacks, as
that is required otherwise a function being traced will get the wrong
arguments and possibly crash. And on x86, the arguments are already stored
where they would be on a pt_regs structure to use that code for both the
regs version of a callback, it makes sense to pass that information always
to all functions.

If an architecture does this (as x86_64 now does), it is to set
HAVE_DYNAMIC_FTRACE_WITH_ARGS, and this will let the generic code that it
could have access to arguments without having to set the flags.

This also includes having the stack pointer being saved, which could be used
for accessing arguments on the stack, as well as having the function graph
tracer not require its own trampoline!

Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
arch/x86/Kconfig
arch/x86/include/asm/ftrace.h
arch/x86/kernel/ftrace_64.S
include/linux/ftrace.h
kernel/trace/Kconfig