From patchwork Sun Jul 14 08:27:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naveen N Rao X-Patchwork-Id: 13732623 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 96F944AECB; Sun, 14 Jul 2024 08:29:50 +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=1720945790; cv=none; b=TxS7M0uV8CM16414Bb2ElAnfl1qeUXgb6RDl64h6AU8XFJAbUXe+/PaVr9CHNrbZiFO9A9VyfMcwjmhcgZEqCiHnJPlftFAuCxzap4IeHYHjKH0TmI50Y1d01Vd8JSQarY9TPaxppH0V6QH+vm+dEODVmZWUvyPnlSlzyl8NKXY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720945790; c=relaxed/simple; bh=LJPviOMmRIjz0uro4r36QiA8kKEiN0rClRqnRvEe5pc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sHW24qi6OdhmxjD2ePbiZOiaAHeCo7VxUXLbe2GYoa4MS5A4+JyPzjMPFgEmvav0peb3HIqkeEZdfGpI+4sMwlxjzhl055QJWGTrK5glgfXQRYZwbUzw5s8SNOPPN/WBfOtbnH1HQvwJW7vhLTBy+mpeSNswNBJwU4ZiP1qAogM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Ug3WLnQh; 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="Ug3WLnQh" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 76AA3C116B1; Sun, 14 Jul 2024 08:29:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1720945790; bh=LJPviOMmRIjz0uro4r36QiA8kKEiN0rClRqnRvEe5pc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ug3WLnQhtxYBuJ3k5NkmRlo7cmPPGONQDtikam7v0eKto6gU2mk16oxGh+1+HxGR4 /JjEiD3VTDoYyrHzuBVgAlt7TlAVddyYeGuVmytB5zYxN1A4/PCUsr0WFJbyQi2bYM FASrcPigNL4lAUGQU5GhSslZCWjqUoLKXlWAgMYjhrU0an5dpQhUAU/290RkI4FsAD oYShdgBIqm3Fea0HO+v3Ag4jNNwRrD6IHZWKJ436F5mGy/+jojZ0bPS22hsrJ02Iz2 PXu1Pyy2IVUxvJCzw4LAAabMwxkAuEEmIdMf3lX24ZCCU/496TWOxWFZM9Z6Yo3N0o KH9kYrZSWOxvw== From: Naveen N Rao To: , , , linux-kbuild@vger.kernel.org, Cc: Michael Ellerman , Nicholas Piggin , Christophe Leroy , Steven Rostedt , Masami Hiramatsu , Mark Rutland , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Masahiro Yamada , Hari Bathini , Mahesh Salgaonkar , Vishal Chourasia Subject: [RFC PATCH v4 07/17] powerpc/ftrace: Skip instruction patching if the instructions are the same Date: Sun, 14 Jul 2024 13:57:43 +0530 Message-ID: <2aba0401f39fee0726e3342b21160d2b05bfa53b.1720942106.git.naveen@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-trace-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 To simplify upcoming changes to ftrace, add a check to skip actual instruction patching if the old and new instructions are the same. We still validate that the instruction is what we expect, but don't actually patch the same instruction again. Signed-off-by: Naveen N Rao --- arch/powerpc/kernel/trace/ftrace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/trace/ftrace.c b/arch/powerpc/kernel/trace/ftrace.c index fe0546fbac8e..719517265d39 100644 --- a/arch/powerpc/kernel/trace/ftrace.c +++ b/arch/powerpc/kernel/trace/ftrace.c @@ -82,7 +82,7 @@ static inline int ftrace_modify_code(unsigned long ip, ppc_inst_t old, ppc_inst_ { int ret = ftrace_validate_inst(ip, old); - if (!ret) + if (!ret && !ppc_inst_equal(old, new)) ret = patch_instruction((u32 *)ip, new); return ret;