Re: [PATCH v7 13/36] function_graph: Have the instances use their own ftrace_ops for filtering

From: Google
Date: Wed Feb 07 2024 - 09:03:05 EST


On Wed, 7 Feb 2024 00:09:54 +0900
"Masami Hiramatsu (Google)" <mhiramat@xxxxxxxxxx> wrote:

> diff --git a/arch/loongarch/kernel/ftrace_dyn.c b/arch/loongarch/kernel/ftrace_dyn.c
> index 73858c9029cc..81d18b911cc1 100644
> --- a/arch/loongarch/kernel/ftrace_dyn.c
> +++ b/arch/loongarch/kernel/ftrace_dyn.c
> @@ -241,10 +241,17 @@ void prepare_ftrace_return(unsigned long self_addr, unsigned long *parent)
> void ftrace_graph_func(unsigned long ip, unsigned long parent_ip,
> struct ftrace_ops *op, struct ftrace_regs *fregs)
> {
> + struct fgraph_ops *gops = container_of(op, struct fgraph_ops, ops);
> struct pt_regs *regs = &fregs->regs;
> unsigned long *parent = (unsigned long *)&regs->regs[1];
>
> - prepare_ftrace_return(ip, (unsigned long *)parent);
> + if (unlikely(atomic_read(&current->tracing_graph_pause)))
> + return;
> +
> + old = *parent;

Oops, this caused an error.

> +
> + if (!function_graph_enter_ops(old, ip, 0, parent, gops))

So this should be

if (!function_graph_enter_ops(*parent, ip, 0, parent, gops))

Thanks,

--
Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx>