[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240917100848.GB27384@willie-the-truck>
Date: Tue, 17 Sep 2024 11:08:48 +0100
From: Will Deacon <will@...nel.org>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: Catalin Marinas <catalin.marinas@....com>,
linux-arm-kernel@...ts.infradead.org,
"Masami Hiramatsu (Google)" <mhiramat@...nel.org>,
Florent Revest <revest@...omium.org>,
linux-trace-kernel@...r.kernel.org,
LKML <linux-kernel@...r.kernel.org>,
Alexei Starovoitov <ast@...nel.org>, Jiri Olsa <jolsa@...nel.org>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Mark Rutland <mark.rutland@....com>
Subject: Re: [PATCH v14 05/19] function_graph: Pass ftrace_regs to retfunc
On Sun, Sep 15, 2024 at 04:49:20AM -0400, Steven Rostedt wrote:
> On Fri, 13 Sep 2024 00:09:02 +0900
> "Masami Hiramatsu (Google)" <mhiramat@...nel.org> wrote:
>
> > From: Masami Hiramatsu (Google) <mhiramat@...nel.org>
> >
> > Pass ftrace_regs to the fgraph_ops::retfunc(). If ftrace_regs is not
> > available, it passes a NULL instead. User callback function can access
> > some registers (including return address) via this ftrace_regs.
> >
> > Signed-off-by: Masami Hiramatsu (Google) <mhiramat@...nel.org>
> > ---
> > Changes in v8:
> > - Pass ftrace_regs to retfunc, instead of adding retregfunc.
> > Changes in v6:
> > - update to use ftrace_regs_get_return_value() because of reordering
> > patches.
> > Changes in v3:
> > - Update for new multiple fgraph.
> > - Save the return address to instruction pointer in ftrace_regs.
> > ---
> > include/linux/ftrace.h | 3 ++-
> > kernel/trace/fgraph.c | 16 +++++++++++-----
> > kernel/trace/ftrace.c | 3 ++-
> > kernel/trace/trace.h | 3 ++-
> > kernel/trace/trace_functions_graph.c | 7 ++++---
> > kernel/trace/trace_irqsoff.c | 3 ++-
> > kernel/trace/trace_sched_wakeup.c | 3 ++-
> > kernel/trace/trace_selftest.c | 3 ++-
> > 8 files changed, 27 insertions(+), 14 deletions(-)
> >
> > diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
> > index 13987cd63553..e7c41d9988e1 100644
> > --- a/include/linux/ftrace.h
> > +++ b/include/linux/ftrace.h
> > @@ -1069,7 +1069,8 @@ struct fgraph_ops;
> >
> > /* Type of the callback handlers for tracing function graph*/
> > typedef void (*trace_func_graph_ret_t)(struct ftrace_graph_ret *,
> > - struct fgraph_ops *); /* return */
> > + struct fgraph_ops *,
> > + struct ftrace_regs *); /* return */
> > typedef int (*trace_func_graph_ent_t)(struct ftrace_graph_ent *,
> > struct fgraph_ops *,
> > struct ftrace_regs *); /* entry */
> > diff --git a/kernel/trace/fgraph.c b/kernel/trace/fgraph.c
> > index 30bebe43607d..6a3e2db16aa4 100644
> > --- a/kernel/trace/fgraph.c
> > +++ b/kernel/trace/fgraph.c
> > @@ -297,7 +297,8 @@ static int entry_run(struct ftrace_graph_ent *trace, struct fgraph_ops *ops,
> > }
> >
> > /* ftrace_graph_return set to this to tell some archs to run function graph */
> > -static void return_run(struct ftrace_graph_ret *trace, struct fgraph_ops *ops)
> > +static void return_run(struct ftrace_graph_ret *trace, struct fgraph_ops *ops,
> > + struct ftrace_regs *fregs)
> > {
> > }
> >
> > @@ -491,7 +492,8 @@ int ftrace_graph_entry_stub(struct ftrace_graph_ent *trace,
> > }
> >
> > static void ftrace_graph_ret_stub(struct ftrace_graph_ret *trace,
> > - struct fgraph_ops *gops)
> > + struct fgraph_ops *gops,
> > + struct ftrace_regs *fregs)
> > {
> > }
> >
> > @@ -787,6 +789,9 @@ __ftrace_return_to_handler(struct ftrace_regs *fregs, unsigned long frame_pointe
> > }
> >
> > trace.rettime = trace_clock_local();
> > + if (fregs)
> > + ftrace_regs_set_instruction_pointer(fregs, ret);
Where does the instruction pointer get used after this? The arm64
'return_to_handler' function doesn't look at it when we return.
Will
Powered by blists - more mailing lists