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

Steven Rostedt
2024-02-15T15:36:56Z

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

> From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
>
> 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@kernel.org>
> ---

> #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;