]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
function_graph: Restore direct mode when callbacks drop to one
authorShengming Hu <hu.shengming@zte.com.cn>
Fri, 13 Feb 2026 06:29:32 +0000 (14:29 +0800)
committerSteven Rostedt (Google) <rostedt@goodmis.org>
Fri, 13 Feb 2026 14:33:14 +0000 (09:33 -0500)
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.

Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20260213142932519cuWSpEXeS4-UnCvNXnK2P@zte.com.cn
Fixes: cc60ee813b503 ("function_graph: Use static_call and branch to optimize entry function")
Signed-off-by: Shengming Hu <hu.shengming@zte.com.cn>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
kernel/trace/fgraph.c

index cc48d16be43e0e6e4b962d7671d9427570c3ccc0..4df766c690f929c1b9c0374d4cdefe7402679217 100644 (file)
@@ -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)