]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
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)
committerSasha Levin <sashal@kernel.org>
Wed, 4 Mar 2026 12:21:30 +0000 (07:21 -0500)
commitf8d02862e520baea496f9277aefbcadf95a25c8f
treec1a3adab2f6bcb402282a480c9905c494a45caba
parente4ff4e3ffcf9d5aad380cdd1d8cdc008bb34f97d
function_graph: Restore direct mode when callbacks drop to one

[ Upstream commit 53b2fae90ff01fede6520ca744ed5e8e366497ba ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/trace/fgraph.c