[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <63b0ba5a-a928-438e-84f9-93028dd72e54@roeck-us.net>
Date: Fri, 5 Sep 2025 19:34:16 -0700
From: Guenter Roeck <linux@...ck-us.net>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: Ye Weihua <yeweihua4@...wei.com>, Masami Hiramatsu <mhiramat@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
linux-trace-kernel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH -next] trace/fgraph: Fix the warning caused by missing
unregister notifier
On 9/5/25 19:30, Steven Rostedt wrote:
> On Fri, 5 Sep 2025 16:19:02 -0700
> Guenter Roeck <linux@...ck-us.net> wrote:
>
>>> +++ b/kernel/trace/fgraph.c
>>> @@ -1391,10 +1391,11 @@ int register_ftrace_graph(struct fgraph_ops *gops)
>>> error:
>>> if (ret) {
>>> ftrace_graph_active--;
>>> gops->saved_func = NULL;
>>> fgraph_lru_release_index(i);
>>> + unregister_pm_notifier(&ftrace_suspend_notifier);
>>
>> Is this really correct ? The pm notifier is only registered if
>> ftrace_graph_active==1, but not if it is larger than that.
>> The above code unregisters it unconditionally, even if
>> ftrace_graph_active > 1. I can see that the resulting double
>> unregistration in unregister_ftrace_graph() doesn't really
>> matter since the error return will be ignored, but is it really
>> irrelevant for the successful registered graphs no longer get the
>> benefit of the pm notifier callback ?
>
> Ah right, it should be:
>
> error:
> if (ret) {
> ftrace_graph_active--;
> gops->saved_func = NULL;
> fgraph_lru_release_index(i);
> if (!ftrace_graph_active)
> unregister_pm_notifier(&ftrace_suspend_notifier);
> }
> return ret;
>
> I missed that there's a:
>
> ret = ftrace_startup_subops(&graph_ops, &gops->ops, command);
> if (!ret)
> fgraph_array[i] = gops;
>
> Just before the error label, so the goto error isn't the only path there
> that can affect the ret variable.
>
> I could add a patch or you could send one.
>
I'll try to send a patch later tonight.
Guenter
Powered by blists - more mailing lists