ftrace: pass fregs to arch_ftrace_set_direct_caller()
authorMark Rutland <mark.rutland@arm.com>
Thu, 3 Nov 2022 17:05:17 +0000 (17:05 +0000)
committerWill Deacon <will@kernel.org>
Fri, 18 Nov 2022 13:56:41 +0000 (13:56 +0000)
commit9705bc70960459ae09f4a5e77283973bb3a40f57
tree3bdda4192de93cf7e02abeceb833b315b4d0e179
parentf0c4d9fc9cc9462659728d168387191387e903cc
ftrace: pass fregs to arch_ftrace_set_direct_caller()

In subsequent patches we'll arrange for architectures to have an
ftrace_regs which is entirely distinct from pt_regs. In preparation for
this, we need to minimize the use of pt_regs to where strictly
necessary in the core ftrace code.

This patch changes the prototype of arch_ftrace_set_direct_caller() to
take ftrace_regs rather than pt_regs, and moves the extraction of the
pt_regs into arch_ftrace_set_direct_caller().

On x86, arch_ftrace_set_direct_caller() can be used even when
CONFIG_HAVE_DYNAMIC_FTRACE_WITH_ARGS=n, and <linux/ftrace.h> defines
struct ftrace_regs. Due to this, it's necessary to define
arch_ftrace_set_direct_caller() as a macro to avoid using an incomplete
type. I've also moved the body of arch_ftrace_set_direct_caller() after
the CONFIG_HAVE_DYNAMIC_FTRACE_WITH_ARGS=y defineidion of struct
ftrace_regs.

There should be no functional change as a result of this patch.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Florent Revest <revest@chromium.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Reviewed-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Link: https://lore.kernel.org/r/20221103170520.931305-2-mark.rutland@arm.com
Signed-off-by: Will Deacon <will@kernel.org>
arch/s390/include/asm/ftrace.h
arch/x86/include/asm/ftrace.h
include/linux/ftrace.h
kernel/trace/ftrace.c