From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EE2FEC27C75 for ; Tue, 11 Jun 2024 15:15:03 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4VzC056m61z3fnP for ; Wed, 12 Jun 2024 01:15:01 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=goodmis.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=kernel.org (client-ip=2604:1380:40e1:4800::1; helo=sin.source.kernel.org; envelope-from=srs0=hook=nn=goodmis.org=rostedt@kernel.org; receiver=lists.ozlabs.org) Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4VzBzd2XhNz3cVF for ; Wed, 12 Jun 2024 01:14:37 +1000 (AEST) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 9A934CE19B3; Tue, 11 Jun 2024 15:14:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE6C1C2BD10; Tue, 11 Jun 2024 15:14:28 +0000 (UTC) Date: Tue, 11 Jun 2024 11:14:44 -0400 From: Steven Rostedt To: Naveen N Rao Subject: Re: [RFC PATCH v2 3/5] powerpc/ftrace: Unify 32-bit and 64-bit ftrace entry code Message-ID: <20240611111444.0786a633@gandalf.local.home> In-Reply-To: References: <20240610160632.089b6c04@gandalf.local.home> X-Mailer: Claws Mail 3.20.0git84 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Masahiro Yamada , Nicholas Piggin , Christophe Leroy , linuxppc-dev@lists.ozlabs.org, Masami Hiramatsu Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Tue, 11 Jun 2024 20:17:19 +0530 Naveen N Rao wrote: > > I know it's very unlikely, but in theory, I think the race exists. > > I *think* you are assuming that we will be patching back the 'stw' Yes, that was what I was assuming :-p > instruction here? So, there could be an issue if a cpu has executed the > nop instead of 'stw' and then sees the call to _mcount(). > > But, we don't patch back the 'stw' instruction. That is instead done as > part of ftrace_caller(), along with setting up an additional stack frame > to ensure reliable stack unwinding. Commit 41a506ef71eb > ("powerpc/ftrace: Create a dummy stackframe to fix stack unwind") has > more details. > > The primary motivation for this patch is to address differences in the > function profile sequence with various toolchains. Since commit > 0f71dcfb4aef ("powerpc/ftrace: Add support for > -fpatchable-function-entry"), we use the same two-instruction profile > sequence across 32-bit and 64-bit powerpc: > mflr r0 > bl ftrace_caller > > This has also been true on 64-bit powerpc with -mprofile-kernel, except > the very early versions of gcc that supported that option (gcc v5). > > On 32-bit powerpc, we used to use the three instruction sequence before > support for -fpatchable-function-entry was introduced. > > In this patch, we move all toolchain variants to use the two-instruction > sequence for consistency. OK, if you are not patching that back, then all should be good. -- Steve