Re: [PATCH v7 22/36] function_graph: Add a new entry handler with parent_ip and ftrace_regs

From: Steven Rostedt
Date: Thu Feb 15 2024 - 10:38:39 EST


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

> From: Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx>
>
> Add a new entry handler to fgraph_ops as 'entryregfunc' which takes
> parent_ip and ftrace_regs. Note that the 'entryfunc' and 'entryregfunc'
> are mutual exclusive. You can set only one of them.
>
> Signed-off-by: Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx>
> ---

> #ifdef CONFIG_FUNCTION_GRAPH_TRACER
> @@ -1070,6 +1075,7 @@ extern int ftrace_graph_entry_stub(struct ftrace_graph_ent *trace, struct fgraph
> struct fgraph_ops {
> trace_func_graph_ent_t entryfunc;
> trace_func_graph_ret_t retfunc;
> + trace_func_graph_regs_ent_t entryregfunc;

if entryfunc and entryregfunc are mutually exclusive, then why not make them
into a union?

struct fgraph_ops {
union {
trace_func_graph_ent_t entryfunc;
trace_func_graph_regs_ent_t entryregfunc;
};
trace_func_graph_ret_t retfunc;

-- Steve



> struct ftrace_ops ops; /* for the hash lists */
> void *private;
> int idx;