[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220324183320.000d7088@gandalf.local.home>
Date: Thu, 24 Mar 2022 18:33:20 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Christophe Leroy <christophe.leroy@...roup.eu>
Cc: Ingo Molnar <mingo@...hat.com>, linux-kernel@...r.kernel.org,
linuxppc-dev@...ts.ozlabs.org
Subject: Re: [PATCH v1] ftrace: Make ftrace_graph_is_dead() static inline
On Thu, 24 Mar 2022 11:01:45 +0100
Christophe Leroy <christophe.leroy@...roup.eu> wrote:
> @@ -1006,7 +1006,20 @@ unsigned long ftrace_graph_ret_addr(struct task_struct *task, int *idx,
> extern int register_ftrace_graph(struct fgraph_ops *ops);
> extern void unregister_ftrace_graph(struct fgraph_ops *ops);
>
> -extern bool ftrace_graph_is_dead(void);
> +/**
> + * ftrace_graph_is_dead - returns true if ftrace_graph_stop() was called
> + *
> + * ftrace_graph_stop() is called when a severe error is detected in
> + * the function graph tracing. This function is called by the critical
> + * paths of function graph to keep those paths from doing any more harm.
> + */
> +extern bool kill_ftrace_graph;
> +
> +static inline bool ftrace_graph_is_dead(void)
> +{
> + return kill_ftrace_graph;
> +}
> +
> extern void ftrace_graph_stop(void);
The reason I did not expose that variable, is because I didn't want it to
be touched outside of the kernel/trace directory. Or the ftrace.c file for
that matter (although, I could put it in fgraph.c :-/)
What would be better, is to make it a static branch.
extern struct static_key fgraph_dead;
static inline bool ftrace_graph_is_dead(void)
{
if (static_key_false(&fgraph_dead))
return true;
return false;
}
That way we even get rid of the conditional branch.
Yeah, the fgraph_dead is still exposed for anyone to touch, but it still
requires a function to modify it, so I'm not as worried it will be touched
as easily.
-- Steve
Powered by blists - more mailing lists