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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 A1A7FCEF14A for ; Tue, 8 Oct 2024 10:07:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=i41cTgDGxYCF03sFAzCQfC4E35upvi9UYKHS+jZiY9c=; b=UCI77ynIPgReT8Yr+otDCBus/5 v71l682znVcpkx0LJyN0CvvS89LVWnu2ig1XVG7stGwRSf87nVKXO/7NkSVNoYwdGhL7xb5H/hUNS 1YpVyAe2dDfOs39Ad43dPq45j0/Y5N7dnic6JR4MMMEY9+mPC0kNGRY2mQ3xBnmfkfl2HLdSrONbN chcPl1mCUxiHNQ27ahVU0IXO545Qn41GQQGhecUu6S4oM/LWpl7g4j301mdY2QSsZ9jybbsTwCcTg f0iAdjN9EKjESdDC9socc49x8keAjb9BrE/P/Ua+I4CqLLYPt6Ga5l0+OzG9NBTLyj2wW/cIw2dZd ocVm/Vvw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1sy77G-00000005PZb-3hHc; Tue, 08 Oct 2024 10:06:54 +0000 Received: from nyc.source.kernel.org ([147.75.193.91]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1sy74Z-00000005P55-22Nv; Tue, 08 Oct 2024 10:04:08 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 43C2FA42600; Tue, 8 Oct 2024 10:03:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 49794C4CEC7; Tue, 8 Oct 2024 10:04:00 +0000 (UTC) Date: Tue, 8 Oct 2024 11:03:57 +0100 From: Catalin Marinas To: Steven Rostedt Cc: LKML , Linux Trace Kernel , linux-arm-kernel@lists.infradead.org, loongarch@lists.linux.dev, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, "linux-arch@vger.kernel.org" , "x86@kernel.org" , Masami Hiramatsu , Mathieu Desnoyers , Mark Rutland , Will Deacon , Huacai Chen , WANG Xuerui , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Naveen N Rao , Madhavan Srinivasan , Paul Walmsley , Palmer Dabbelt , Albert Ou , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen Subject: Re: [PATCH] ftrace: Make ftrace_regs abstract from direct use Message-ID: References: <20241007204743.41314f1d@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20241007204743.41314f1d@gandalf.local.home> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241008_030407_627503_43E28C9A X-CRM114-Status: GOOD ( 15.96 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Oct 07, 2024 at 08:47:43PM -0400, Steven Rostedt wrote: > From: Steven Rostedt > > ftrace_regs was created to hold registers that store information to save > function parameters, return value and stack. Since it is a subset of > pt_regs, it should only be used by its accessor functions. But because > pt_regs can easily be taken from ftrace_regs (on most archs), it is > tempting to use it directly. But when running on other architectures, it > may fail to build or worse, build but crash the kernel! > > Instead, make struct ftrace_regs an empty structure and have the > architectures define __arch_ftrace_regs and all the accessor functions > will typecast to it to get to the actual fields. This will help avoid > usage of ftrace_regs directly. > > Link: https://lore.kernel.org/all/20241007171027.629bdafd@gandalf.local.home/ > > Signed-off-by: Steven Rostedt (Google) > --- > Note, I tried to cros-compile the affected architectures, > but my builds failed for 32 bit powerpc and s390 (without this patch). > It mostly compiled, and the affected files seemed to build. > > arch/arm64/include/asm/ftrace.h | 20 +++++++++-------- > arch/arm64/kernel/asm-offsets.c | 22 +++++++++---------- > arch/arm64/kernel/ftrace.c | 10 ++++----- For arm64: Acked-by: Catalin Marinas