[PATCH 2/7] x86/tracing: pass ftrace_regs to function_graph_enter()

From: Sven Schnelle
Date: Wed Sep 04 2024 - 03:00:56 EST


Will be used later for printing function argument in the
function graph tracer.

Signed-off-by: Sven Schnelle <svens@xxxxxxxxxxxxx>
---
arch/x86/include/asm/ftrace.h | 2 +-
arch/x86/kernel/ftrace.c | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/x86/include/asm/ftrace.h b/arch/x86/include/asm/ftrace.h
index 0152a81d9b4a..9843d0c08e61 100644
--- a/arch/x86/include/asm/ftrace.h
+++ b/arch/x86/include/asm/ftrace.h
@@ -105,7 +105,7 @@ struct dyn_arch_ftrace {
#ifndef __ASSEMBLY__

void prepare_ftrace_return(unsigned long ip, unsigned long *parent,
- unsigned long frame_pointer);
+ unsigned long frame_pointer, struct ftrace_regs *regs);

#if defined(CONFIG_FUNCTION_TRACER) && defined(CONFIG_DYNAMIC_FTRACE)
extern void set_ftrace_ops_ro(void);
diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c
index b325f7e7e39a..a016b82de5e2 100644
--- a/arch/x86/kernel/ftrace.c
+++ b/arch/x86/kernel/ftrace.c
@@ -610,7 +610,7 @@ int ftrace_disable_ftrace_graph_caller(void)
* in current thread info.
*/
void prepare_ftrace_return(unsigned long ip, unsigned long *parent,
- unsigned long frame_pointer)
+ unsigned long frame_pointer, struct ftrace_regs *fregs)
{
unsigned long return_hooker = (unsigned long)&return_to_handler;
int bit;
@@ -637,7 +637,7 @@ void prepare_ftrace_return(unsigned long ip, unsigned long *parent,
if (bit < 0)
return;

- if (!function_graph_enter(*parent, ip, frame_pointer, parent, NULL))
+ if (!function_graph_enter(*parent, ip, frame_pointer, parent, fregs))
*parent = return_hooker;

ftrace_test_recursion_unlock(bit);
@@ -650,7 +650,7 @@ void ftrace_graph_func(unsigned long ip, unsigned long parent_ip,
struct pt_regs *regs = &fregs->regs;
unsigned long *stack = (unsigned long *)kernel_stack_pointer(regs);

- prepare_ftrace_return(ip, (unsigned long *)stack, 0);
+ prepare_ftrace_return(ip, (unsigned long *)stack, 0, fregs);
}
#endif

--
2.43.0