Re: [PATCH RESEND v3 1/2] ftrace: cleanup ftrace_graph_caller enable and disable
From: Steven Rostedt
Date: Sat Apr 09 2022 - 10:31:07 EST
On Sat, 9 Apr 2022 16:54:59 +0800
Chengming Zhou <zhouchengming@xxxxxxxxxxxxx> wrote:
> --- a/kernel/trace/ftrace.c
> +++ b/kernel/trace/ftrace.c
> @@ -2721,6 +2721,26 @@ int __weak ftrace_arch_code_modify_post_process(void)
> return 0;
> }
>
> +#ifdef CONFIG_FUNCTION_GRAPH_TRACER
Actually, can you put this into fgraph.c instead. That only gets compiled
if the above config is enabled. Thus, you do not even need to add the
#ifdef around it.
I intend to move even more code into fgraph.c that is only for function
graph. I don't want to add any new code to ftrace.c for it.
-- Steve
> +/*
> + * archs can override this function if they must do something
> + * to enable hook for graph tracer.
> + */
> +int __weak ftrace_enable_ftrace_graph_caller(void)
> +{
> + return 0;
> +}
> +
> +/*
> + * archs can override this function if they must do something
> + * to disable hook for graph tracer.
> + */
> +int __weak ftrace_disable_ftrace_graph_caller(void)
> +{
> + return 0;
> +}
> +#endif
> +
> void ftrace_modify_all_code(int command)
> {
> int update = command & FTRACE_UPDATE_TRACE_FUNC;