Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

function_graph: Restore direct mode when callbacks drop to one

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>

authored by

Shengming Hu and committed by
Steven Rostedt (Google)
53b2fae9 fa4820b8

+1 -1
+1 -1
kernel/trace/fgraph.c
··· 1303 1303 static_call_update(fgraph_func, func); 1304 1304 static_call_update(fgraph_retfunc, retfunc); 1305 1305 if (enable_branch) 1306 - static_branch_disable(&fgraph_do_direct); 1306 + static_branch_enable(&fgraph_do_direct); 1307 1307 } 1308 1308 1309 1309 static void ftrace_graph_disable_direct(bool disable_branch)