Messages in this thread | | | Date | Mon, 14 Feb 2022 22:54:23 +0530 | From | "Naveen N. Rao" <> | Subject | Re: [PATCH v2 11/13] powerpc/ftrace: directly call of function graph tracer by ftrace caller |
| |
Christophe Leroy wrote: > Modify function graph tracer to be handled directly by the standard > ftrace caller. > > This is made possible as powerpc now supports > CONFIG_DYNAMIC_FTRACE_WITH_ARGS. > > This change simplifies the call of function graph ftrace. > > Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu> > --- > arch/powerpc/include/asm/ftrace.h | 6 ++ > arch/powerpc/kernel/trace/ftrace.c | 11 ++++ > arch/powerpc/kernel/trace/ftrace_32.S | 53 +-------------- > .../powerpc/kernel/trace/ftrace_64_mprofile.S | 64 +------------------ > 4 files changed, 20 insertions(+), 114 deletions(-) > > diff --git a/arch/powerpc/include/asm/ftrace.h b/arch/powerpc/include/asm/ftrace.h > index 45c3d6f11daa..70b457097098 100644 > --- a/arch/powerpc/include/asm/ftrace.h > +++ b/arch/powerpc/include/asm/ftrace.h > @@ -38,6 +38,12 @@ static __always_inline void ftrace_instruction_pointer_set(struct ftrace_regs *f > { > regs_set_return_ip(&fregs->regs, ip); > } > + > +struct ftrace_ops; > + > +#define ftrace_graph_func ftrace_graph_func > +void ftrace_graph_func(unsigned long ip, unsigned long parent_ip, > + struct ftrace_ops *op, struct ftrace_regs *fregs); > #endif > #endif /* __ASSEMBLY__ */ > > diff --git a/arch/powerpc/kernel/trace/ftrace.c b/arch/powerpc/kernel/trace/ftrace.c > index ce673764cb69..74a176e394ef 100644 > --- a/arch/powerpc/kernel/trace/ftrace.c > +++ b/arch/powerpc/kernel/trace/ftrace.c > @@ -917,6 +917,9 @@ static int ftrace_modify_ftrace_graph_caller(bool enable) > unsigned long stub = (unsigned long)(&ftrace_graph_stub); > ppc_inst_t old, new; > > + if (IS_ENABLED(CONFIG_DYNAMIC_FTRACE_WITH_ARGS)) > + return 0; > + > old = ftrace_call_replace(ip, enable ? stub : addr, 0); > new = ftrace_call_replace(ip, enable ? addr : stub, 0); > > @@ -955,6 +958,14 @@ unsigned long prepare_ftrace_return(unsigned long parent, unsigned long ip, > out: > return parent; > }
For x86, commit 0c0593b45c9b4e ("x86/ftrace: Make function graph use ftrace directly") also adds recursion check before the call to function_graph_enter() in prepare_ftrace_return(). Do we need that on powerpc as well?
- Naveen
| |