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 DD722CF318A for ; Tue, 1 Oct 2024 23:52:24 +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:Content-Transfer-Encoding: Content-Type:Mime-Version:References:In-Reply-To:Message-Id:Subject:Cc:To: From:Date:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=8vg3bp4SdHOuDHYR4EcCZwNSQT7eGIzEdc5jKklo0SM=; b=Tf7Q/tfX8oduK5dPhU37zUb4pV lzQXG15XbsPhfn0LTHBEMOQdz0APfBn6S8H/EYW7F9j6qbdTx4mkWdLU8BSzDiUUJxp0C4yDwG4vf alZu+xnEtYJXs6GrSXvSmsMRgSo8ibsL5NHuN25YXYHQaOVFDi6+qK7GdmYw6l2OCk/ph+HEx1lkC L+MCnBOltJzDSxC1iPHlJKbItucm27f/r8agTs80ZReyDjpE9ZoNc9d6l0GgtndnenmFsMVK7+KYo l0feYml3H26+naAJJwM2/uoNEzSdpQ1VWCQ5/p3TdYuyYnfbVM0rUFGruGbsA0bLIDMWRxmYTan9l tiE8iLGg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1svmf6-00000004PZQ-1h11; Tue, 01 Oct 2024 23:52:12 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1svm1C-00000004K7a-3ya2 for linux-arm-kernel@bombadil.infradead.org; Tue, 01 Oct 2024 23:10:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:Content-Type :Mime-Version:References:In-Reply-To:Message-Id:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description; bh=8vg3bp4SdHOuDHYR4EcCZwNSQT7eGIzEdc5jKklo0SM=; b=c85V02kAPllve4caoC89LVbfQw /RNdgEdvpuCaHERRDuNeHGD4i5fOk3+1HjD9s02BaV4eZfg26VGivl0JSa43F9MR676AC0PAxZE8A BaNNmgDAwcyERpoko3PFnMNH0pTZpHGy0G4qtqMqXLAwVsD31UZxSJBwHBf+PXU4iJHsJeHbQe19b xgNUH4sVWrDkGWr1WElZOCjeLp8aVJ5rfu6+R6fTFXn107h/g6u7Gaau3JU+b9XGBhK+NItHJ0nzz MhSYnZcg1U6Wv0KhUAEoDnGZ25NRP+N9yPA+bkgmzDTowykMshH7xZ7RyZdpavD05NJdvZUWmDJXx yBoF1EnA==; Received: from dfw.source.kernel.org ([139.178.84.217]) by desiato.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1svm10-00000003L9m-150K for linux-arm-kernel@lists.infradead.org; Tue, 01 Oct 2024 23:10:48 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 940055C056E; Tue, 1 Oct 2024 23:10:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 79A67C4CEC6; Tue, 1 Oct 2024 23:10:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1727824242; bh=DcJk0ZurD4m477NZqGPsjHZFR3HoBgS1o2cMcYNYB2s=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=W/nIdavm1JqAX/giEtnJOkGz3xbjdMq6KQkVw4ljhSRaSLSeInkxiw57CPANodEdt BDUmGhFZm3fprZ+HevIktBUAx5izVq2R/JTp8im484EKY4oXw8NTt5t6oKNbAQp1kC e8yGKgKRY02ydyHb6dqxZyFPr4GJ8e9yA250mszB4bEa89E1LainJdofTupgX33ff2 LHU3kk6t+C1PUfcD4xRbxeFFbInkC08OQmL7FF6cple4SqU8vaHvD8uzGuqokjYtWd GNQDdGXc7GtxZBSNqO/lNAEZp+2CDk/O28MXbb+Aezidxvikak450fAzj1jNkx2SkF /ltNKeuVdCAyA== Date: Wed, 2 Oct 2024 08:10:37 +0900 From: Masami Hiramatsu (Google) To: Steven Rostedt Cc: Will Deacon , Catalin Marinas , linux-arm-kernel@lists.infradead.org, "Masami Hiramatsu (Google)" , Florent Revest , linux-trace-kernel@vger.kernel.org, LKML , Alexei Starovoitov , Jiri Olsa , Arnaldo Carvalho de Melo , Daniel Borkmann , Mark Rutland Subject: Re: [PATCH v14 04/19] function_graph: Replace fgraph_ret_regs with ftrace_regs Message-Id: <20241002081037.e9b825f7456ce4815eccad1b@kernel.org> In-Reply-To: <20240930145548.08c8f666@gandalf.local.home> References: <172615368656.133222.2336770908714920670.stgit@devnote2> <172615373091.133222.1812791604518973124.stgit@devnote2> <20240915051144.445681c2@rorschach.local.home> <20240917095538.GA27384@willie-the-truck> <20240930145548.08c8f666@gandalf.local.home> X-Mailer: Sylpheed 3.7.0 (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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241002_001046_805212_770B0099 X-CRM114-Status: GOOD ( 23.81 ) 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, 30 Sep 2024 14:55:48 -0400 Steven Rostedt wrote: > On Tue, 17 Sep 2024 10:55:39 +0100 > Will Deacon wrote: > > > The arm64 part looks good to me, although passing a partially-populated > > struct out of asm feels like it's going to cause us hard-to-debug > > problems down the line if any of those extra fields get used. How hard > > would it be to poison the unpopulated members of 'ftrace_regs'? > > The purpose of creating ftrace_regs was to allow a partially populated > pt_regs to be sent around, as Thomas Gleixner and Peter Zijlstra were > against using pt_regs that were not fully populated. Hence, I created > "ftrace_regs" for this purpose. > > ftrace_regs should never be accessed via its internal elements but only with > its accessor functions, as depending on the arch or functionality used, the > content of the structure should never be trusted. The accessor functions > will do all the verification needed. > > I may add some compiler hacks to enforce this. Something like: > > struct ftrace_regs { > void *nothing_to_see_here; > }; Yeah, OK. But sizeof(fregs) may be changed. (Shouldn't we do too?) > > And then change the arch code to be something like: > > // in arch/arm64/include/asm/ftrace.h: > > struct arch_ftrace_regs { > /* x0 - x8 */ > unsigned long regs[9]; > > #ifdef CONFIG_DYNAMIC_FTRACE_WITH_DIRECT_CALLS > unsigned long direct_tramp; > #else > unsigned long __unused; > #endif > > unsigned long fp; > unsigned long lr; > > unsigned long sp; > unsigned long pc; > }; And if it is pt_regs compatible, #define arch_ftrace_regs pt_regs ? > > #define get_arch_ftrace_regs(fregs) ((struct arch_ftrace_regs *)(fregs)) > > static __always_inline void > ftrace_regs_set_instruction_pointer(struct ftrace_regs *fregs, > unsigned long pc) > { > struct arch_ftrace_regs *afregs = get_ftrace_regs(fregs); > afregs->pc = pc; > } > > > -- Steve Thanks, -- Masami Hiramatsu (Google)