From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3E8E84209B6; Sat, 28 Feb 2026 17:46:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772300769; cv=none; b=YtFXj5HKG71OHgtrSO7DZW3bcnCu+G7EflDeKOFGOhUNkOstUQZ78zAggtcSS6uKJOqCHZ3IqZyj6yxLtZZXFdSfrFA42KehcTgcl87LqzwM/AGlYJi02gyd5+dyfzsDTLs4DIgAJEoBsjJYC7XF9xv8aAV28hlpFF0KXbWl/uE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772300769; c=relaxed/simple; bh=kUE4WSTKMv+JLxw/HZxQybOAqh2nTAx9uk2KXDrhArE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=at7yUk23kcjDHNCO/J6xCvjKuB7pAFWKN54j4siwtYXFn9NhcV8epL2ZDuBjsxgR4jTsw8YBu083xi02KkexOnXFUeOUHePTvmhZzSAZDaZZeuEEjTWCE///6ERP+1O83BWjLHGOB/QSsoKhHZ+F8IVzB83u3Cbf/kuMWHRcrZY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=G71gpomC; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="G71gpomC" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8995CC19424; Sat, 28 Feb 2026 17:46:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772300769; bh=kUE4WSTKMv+JLxw/HZxQybOAqh2nTAx9uk2KXDrhArE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G71gpomCMDAPmEpytgbyG+DV8Hq3YiTZWM6lJOArJmNpOvfyD5BAXiVTF5oKCUbeQ btpiM+glMrIeYBp6nGL4j2FhKa26qApoAiWzelw215ebGZgnCwTv+vfgQBtFibYw9t QP+K9hu+7VxpBRrWzUTJKSF00TGq0ryLAQNqhqLJ563GqYKSL2+RlnkNZq3l+IYyEu VLm1dvB/TdqgbGRrlXdseQrmQvLVkTWIfWFlvzmSOB0VO1Zt3PT3o9XyvaEjgjE2pg JJwPfi8CvxfHbNY3ueurtxi0WTK/DkmAbW06bIFk+pwPmL/7k32VR3rW4E6tN2j89S q2AZhzDEvn88Q== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Shengming Hu , "Steven Rostedt (Google)" , Sasha Levin Subject: [PATCH 6.19 800/844] function_graph: Restore direct mode when callbacks drop to one Date: Sat, 28 Feb 2026 12:31:53 -0500 Message-ID: <20260228173244.1509663-801-sashal@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260228173244.1509663-1-sashal@kernel.org> References: <20260228173244.1509663-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Shengming Hu [ 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 Signed-off-by: Steven Rostedt (Google) Signed-off-by: Sasha Levin --- 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 cc48d16be43e0..4df766c690f92 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.51.0