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 6F13AC433F5 for ; Tue, 22 Feb 2022 16:09:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: 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=z3Dcwx+QMzd8Tb3Lbx0Bl4BTo654BeIA/itYAPkg5/c=; b=R4jdAeSGcfhD9a 2fAJMUOb1TauEoIh42+GiQI+hMZlIIBOhEB8sYAwxp3Dvw3fspI/Eiv8RgeCR1rJDEusngMUFSvGZ CJjM/pKBoShkvSKQyeZPKHnLXWq0cUG+XIe0XWyhJobhiDWsY3++uk+c1iDsF+D1Ah3u2ycGf+VCj O/NzWNI4bcVqZ9qr1jgAJG3ZeyruV7dNiDWn8Ggf7Gp1UMDzuELohZARW6BAPuN6s57zzBy+OIC/c s94ot1M8+zeYgj5keNfdCW0LSfdmklBo1OAZdws2IHGGOrfnEc79405A3lwIf4kdccu99Y+Dtdb2E +s/j69ssqflN/i6mGM2w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nMXhT-00AXFi-Kv; Tue, 22 Feb 2022 16:07:39 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nMXgz-00AX5b-8t for linux-arm-kernel@lists.infradead.org; Tue, 22 Feb 2022 16:07:10 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 030571063; Tue, 22 Feb 2022 08:07:08 -0800 (PST) Received: from lakrids (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A255C3F70D; Tue, 22 Feb 2022 08:07:06 -0800 (PST) Date: Tue, 22 Feb 2022 16:07:04 +0000 From: Mark Rutland To: Steven Rostedt Cc: Chengming Zhou , mingo@redhat.com, catalin.marinas@arm.com, will@kernel.org, broonie@kernel.org, songmuchun@bytedance.com, qirui.001@bytedance.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] arm64/ftrace: Make function graph use ftrace directly Message-ID: References: <20220222130049.81284-1-zhouchengming@bytedance.com> <20220222105218.28e3d5aa@gandalf.local.home> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220222105218.28e3d5aa@gandalf.local.home> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220222_080709_411780_DD09BD60 X-CRM114-Status: GOOD ( 17.54 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Feb 22, 2022 at 10:52:18AM -0500, Steven Rostedt wrote: > On Tue, 22 Feb 2022 21:00:49 +0800 > Chengming Zhou wrote: > > > As we do in commit 0c0593b45c9b ("x86/ftrace: Make function graph > > use ftrace directly"), we don't need special hook for graph tracer, > > but instead we use graph_ops:func function to install return_hooker. > > > > Since commit 3b23e4991fb6 ("arm64: implement ftrace with regs") add > > implementation for FTRACE_WITH_REGS on arm64, we can easily adopt > > the same optimization on arm64. > > Note. Ideally we want it to hook with DYNAMIC_FTARCE_WITH_ARGS, and not > FTRACE_WITH_REGS. If arm64 is like x86_64, saving all regs at every > function call has a bit more overhead than saving the minimum. The > DYNAMIC_FTRACE_WITH_ARGS, means that the minimum is still saved, but now > exposes the arguments and the stack pointer, which function_graph_tracer > needs. FWIW, I'd been meaning to take a look at that. On arm64 we can't really create a full pt_regs without taking an exception because there's a bunch of stuff in pt_regs that we can only snapshot at an exception boundary (e.g. PSTATE, which is what Arm calls the internal processor flags). I'd wanted to look at whether we could implement FTRACE_WITH_ARGS without FTRACE_WITH_REGS. For kprobes & kreprobes we snapshot the real flags at function entry time and give made up values at function return time, which is less than ideal because there'll be spurious differences in the flags across the two. It might be worth a chat at plumbers about how we could align this a bit better (e.g. with k(ret)probes having an args-only mode too). Thanks, Mark. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel