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 5032B37DEA9 for ; Sun, 22 Mar 2026 03:09:34 +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=1774148974; cv=none; b=DwfoUizzB9GoSImzKYKXbZ/lpYPmLg5socWCC/DXL0WipC0l6qBnDm4JiyHnKCACNS0pdP5i35ifDXZAdas2y6kC1wsnNoWfHJWH0LBXSXlpv4eBj9SyDO2pA6K3scnRG2lnFKOhn9amd3Ramr+xB4veSy162jcD5/ESVqoLAa0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774148974; c=relaxed/simple; bh=u3aqDEGH3wpQ9SDVAiCfC5NIrhSusCratN/XQgDz1yM=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=YGomkePh313ZFTZM1gtVsTeBNGdfvhLHJ/R3tychTkjc4dJJnKMcOVjIWpE4OQG452ivy9dgm6ilAXmAcGlo2vnNWwjTXYsq5AH8dXAHvI7FuG9q+uj3hlqv1GAQ6QUzci+X9f+ZuNIribXheEaGSHwiecOjlXeJdvfDcZAEx3Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=IcPInyZT; 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="IcPInyZT" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2EC42C2BCB3; Sun, 22 Mar 2026 03:09:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774148974; bh=u3aqDEGH3wpQ9SDVAiCfC5NIrhSusCratN/XQgDz1yM=; h=Date:From:To:Cc:Subject:References:From; b=IcPInyZTn/hEMxykl6MazSYSG6hfjdmUaZ+Tw5uyHPbFGRAO+EdoHXsLlBM3eJCjA WwARthQ8trZFVzGUO3LDW2P8VLzNMPozNA1j/XWvrs+My6bu3irI+MXA8bPikbfS5n tWh+kxo5pcWnH0Gu9kVqnXUGQ/M05qpGvnJx7T0mLx8YSAbsoWHLHo31cy4AInVKX3 jtj8Zp5neRfDJ72OdEQSYYdSVy/n9b6EtNEzJE3cEGJyVkfF83Kv1LfctJtFmtbPp8 eUaUKzXOdA3gh11oozORkrv7ATPsJ/jg0YofTblqP12Tt03J/KXOYQ+iP3jRd8217k jD9IW48cqUgPQ== Received: from rostedt by gandalf with local (Exim 4.99.1) (envelope-from ) id 1w49Cc-0000000B7lG-3YLS; Sat, 21 Mar 2026 23:10:10 -0400 Message-ID: <20260322031010.701213833@kernel.org> User-Agent: quilt/0.69 Date: Sat, 21 Mar 2026 23:09:59 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Menglong Dong , Song Liu , Jiri Olsa Subject: [for-linus][PATCH 5/5] ftrace: Use hash argument for tmp_ops in update_ftrace_direct_mod References: <20260322030954.198361547@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 From: Jiri Olsa The modify logic registers temporary ftrace_ops object (tmp_ops) to trigger the slow path for all direct callers to be able to safely modify attached addresses. At the moment we use ops->func_hash for tmp_ops filter, which represents all the systems attachments. It's faster to use just the passed hash filter, which contains only the modified sites and is always a subset of the ops->func_hash. Cc: Alexei Starovoitov Cc: Daniel Borkmann Cc: Andrii Nakryiko Cc: Menglong Dong Cc: Song Liu Link: https://patch.msgid.link/20260312123738.129926-1-jolsa@kernel.org Fixes: e93672f770d7 ("ftrace: Add update_ftrace_direct_mod function") Signed-off-by: Jiri Olsa Signed-off-by: Steven Rostedt (Google) --- kernel/trace/ftrace.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 8df69e702706..413310912609 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c @@ -6606,9 +6606,9 @@ int update_ftrace_direct_mod(struct ftrace_ops *ops, struct ftrace_hash *hash, b if (!orig_hash) goto unlock; - /* Enable the tmp_ops to have the same functions as the direct ops */ + /* Enable the tmp_ops to have the same functions as the hash object. */ ftrace_ops_init(&tmp_ops); - tmp_ops.func_hash = ops->func_hash; + tmp_ops.func_hash->filter_hash = hash; err = register_ftrace_function_nolock(&tmp_ops); if (err) -- 2.51.0