Re: [PATCH] ftrace: Avoid needless updates of the ftrace function call

From: Song Shuai
Date: Wed Nov 23 2022 - 00:32:28 EST


Steven Rostedt <rostedt@xxxxxxxxxxx> 于2022年11月23日周三 03:17写道:
>
> On Wed, 23 Nov 2022 10:29:28 +0800
> Song Shuai <suagrfillet@xxxxxxxxx> wrote:
>
> > > @@ -2783,7 +2796,7 @@ void ftrace_modify_all_code(int command)
> > > * traced.
> > > */
> > > if (update) {
> > > - err = ftrace_update_ftrace_func(ftrace_ops_list_func);
> > > + err = update_ftrace_func(ftrace_ops_list_func);
> > > if (FTRACE_WARN_ON(err))
> > > return;
> > > }
> > > @@ -2799,7 +2812,7 @@ void ftrace_modify_all_code(int command)
> > > /* If irqs are disabled, we are in stop machine */
> > > if (!irqs_disabled())
> > > smp_call_function(ftrace_sync_ipi, NULL, 1);
> > > - err = ftrace_update_ftrace_func(ftrace_trace_function);
> > > + err = update_ftrace_func(ftrace_trace_function);
> > The helper function should only serve the ftrace_ops_list_func.
> >
> > And ftrace_trace_function is always different in this function with
> > FTRACE_UPDATE_TRACE_FUNC command.
> >
> > So this place should be left as it is.
>
> But it is needed to update the static variable. Without this change,
> then save_func will get set to ftrace_ops_list_func and never change
> after that and then the update to ftrace_ops_list_func will stop happening.
>
> -- Steve
Yes, you're right. Thx for your explanation.
-- Song