* [PATCH] function_graph: restore direct mode when callbacks drop to one
@ 2026-02-13 2:34 hu.shengming
2026-02-13 3:47 ` Steven Rostedt
0 siblings, 1 reply; 3+ messages in thread
From: hu.shengming @ 2026-02-13 2:34 UTC (permalink / raw)
To: rostedt, mhiramat
Cc: mark.rutland, mathieu.desnoyers, linux-kernel, linux-trace-kernel,
zhang.run, yang.tao172, yang.yang29
From: Shengming Hu <hu.shengming@zte.com.cn>
When registering a second fgraph callback, direct path is disabled
and array loop is used instead.
When ftrace_graph_active falls back to one, we try to re-enable direct
mode via ftrace_graph_enable_direct(true, ...).
But ftrace_graph_enable_direct() incorrectly disables the static key
rather than enabling it.
This leaves fgraph_do_direct permanently off after first multi-callback
transition, so direct fast mode is never restored.
Fixes: cc60ee813b503 ("function_graph: Use static_call and branch to optimize entry function")
Signed-off-by: Shengming Hu <hu.shengming@zte.com.cn>
---
kernel/trace/fgraph.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/trace/fgraph.c b/kernel/trace/fgraph.c
index cc48d16be43e..4df766c690f9 100644
--- a/kernel/trace/fgraph.c
+++ b/kernel/trace/fgraph.c
@@ -1303,7 +1303,7 @@ static void ftrace_graph_enable_direct(bool enable_branch, struct fgraph_ops *go
static_call_update(fgraph_func, func);
static_call_update(fgraph_retfunc, retfunc);
if (enable_branch)
- static_branch_disable(&fgraph_do_direct);
+ static_branch_enable(&fgraph_do_direct);
}
static void ftrace_graph_disable_direct(bool disable_branch)
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] function_graph: restore direct mode when callbacks drop to one
2026-02-13 2:34 [PATCH] function_graph: restore direct mode when callbacks drop to one hu.shengming
@ 2026-02-13 3:47 ` Steven Rostedt
2026-02-13 6:34 ` hu.shengming
0 siblings, 1 reply; 3+ messages in thread
From: Steven Rostedt @ 2026-02-13 3:47 UTC (permalink / raw)
To: hu.shengming
Cc: mhiramat, mark.rutland, mathieu.desnoyers, linux-kernel,
linux-trace-kernel, zhang.run, yang.tao172, yang.yang29
On Fri, 13 Feb 2026 10:34:24 +0800 (CST)
<hu.shengming@zte.com.cn> wrote:
> From: Shengming Hu <hu.shengming@zte.com.cn>
>
> When registering a second fgraph callback, direct path is disabled
> and array loop is used instead.
> When ftrace_graph_active falls back to one, we try to re-enable direct
> mode via ftrace_graph_enable_direct(true, ...).
> But ftrace_graph_enable_direct() incorrectly disables the static key
> rather than enabling it.
> This leaves fgraph_do_direct permanently off after first multi-callback
> transition, so direct fast mode is never restored.
Good catch!
>
> Fixes: cc60ee813b503 ("function_graph: Use static_call and branch to optimize entry function")
> Signed-off-by: Shengming Hu <hu.shengming@zte.com.cn>
> ---
> kernel/trace/fgraph.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/trace/fgraph.c b/kernel/trace/fgraph.c
> index cc48d16be43e..4df766c690f9 100644
> --- a/kernel/trace/fgraph.c
> +++ b/kernel/trace/fgraph.c
> @@ -1303,7 +1303,7 @@ static void ftrace_graph_enable_direct(bool enable_branch, struct fgraph_ops *go
> static_call_update(fgraph_func, func);
> static_call_update(fgraph_retfunc, retfunc);
> if (enable_branch)
> - static_branch_disable(&fgraph_do_direct);
> + static_branch_enable(&fgraph_do_direct);
> }
Your email client killed your patch. it has huge white-space damage.
But because it's such a trivial change, I'll fix it up for you. But
next time please make sure your email client doesn't corrupt your
patches.
Thanks,
-- Steve
>
> static void ftrace_graph_disable_direct(bool disable_branch)
> --
> 2.25.1
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] function_graph: restore direct mode when callbacks drop to one
2026-02-13 3:47 ` Steven Rostedt
@ 2026-02-13 6:34 ` hu.shengming
0 siblings, 0 replies; 3+ messages in thread
From: hu.shengming @ 2026-02-13 6:34 UTC (permalink / raw)
To: rostedt
Cc: mhiramat, mark.rutland, mathieu.desnoyers, linux-kernel,
linux-trace-kernel, zhang.run, yang.tao172, yang.yang29
> On Fri, 13 Feb 2026 10:34:24 +0800 (CST)
> <hu.shengming@zte.com.cn> wrote:
>
> > From: Shengming Hu <hu.shengming@zte.com.cn>
> >
> > When registering a second fgraph callback, direct path is disabled
> > and array loop is used instead.
> > When ftrace_graph_active falls back to one, we try to re-enable direct
> > mode via ftrace_graph_enable_direct(true, ...).
> > But ftrace_graph_enable_direct() incorrectly disables the static key
> > rather than enabling it.
> > This leaves fgraph_do_direct permanently off after first multi-callback
> > transition, so direct fast mode is never restored.
>
> Good catch!
>
> >
> > Fixes: cc60ee813b503 ("function_graph: Use static_call and branch to optimize entry function")
> > Signed-off-by: Shengming Hu <hu.shengming@zte.com.cn>
> > ---
> > kernel/trace/fgraph.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/kernel/trace/fgraph.c b/kernel/trace/fgraph.c
> > index cc48d16be43e..4df766c690f9 100644
> > --- a/kernel/trace/fgraph.c
> > +++ b/kernel/trace/fgraph.c
> > @@ -1303,7 +1303,7 @@ static void ftrace_graph_enable_direct(bool enable_branch, struct fgraph_ops *go
> > static_call_update(fgraph_func, func);
> > static_call_update(fgraph_retfunc, retfunc);
> > if (enable_branch)
> > - static_branch_disable(&fgraph_do_direct);
> > + static_branch_enable(&fgraph_do_direct);
> > }
>
> Your email client killed your patch. it has huge white-space damage.
> But because it's such a trivial change, I'll fix it up for you. But
> next time please make sure your email client doesn't corrupt your
> patches.
>
> Thanks,
>
> -- Steve
Hi Steve,
I’ve identified the cause of the email formatting issue and have resent the patch.
https://lore.kernel.org/linux-trace-kernel/20260213142932519cuWSpEXeS4-UnCvNXnK2P@zte.com.cn/T/#u
Thank you very much for the reminder.
--
With Best Regards,
Shengming
>
> >
> > static void ftrace_graph_disable_direct(bool disable_branch)
> > --
> > 2.25.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-02-13 6:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-13 2:34 [PATCH] function_graph: restore direct mode when callbacks drop to one hu.shengming
2026-02-13 3:47 ` Steven Rostedt
2026-02-13 6:34 ` hu.shengming
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox