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 4142AC54EBC for ; Tue, 10 Jan 2023 10:33:08 +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=/kxtXw8ugINCNtgTGgFet8NvpkERX0n8kVgHM7PeZyU=; b=VyhorXiYWJfLiv hXjREqJyhria3MtnAd1rtu3aG2OX7EPqQ1e2ioMOK+THmIiE9P6UZlVG3mIp3VfFnVhKfvN1V1LTh ePdbeX8fHBFP4NVbBWW5h+GbSqKhsGpkn/IeeOffttFizsYO52BdERIK0OyyhriYSObnvwjzMolPK F6eBYPnn2aFHJJJtYYHmQEOOBzCUKoP93AJmpJxSgyjAGaM1Y1FJFo7T2F3L7c1EQj9vX9NrEmgI0 TX9ByEr07TSRkYwUsjYLQqp7Ue+efSHPR/kwtlZHp9hPKCiXYDlPGGS8T2O0Niae8wSRAPd13c774 hvRcOWWNDr9nDhx9xE9Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pFBvM-006N62-EU; Tue, 10 Jan 2023 10:32:08 +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 1pFBvI-006N57-6s for linux-arm-kernel@lists.infradead.org; Tue, 10 Jan 2023 10:32:06 +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 C8A8A1FB; Tue, 10 Jan 2023 02:32:40 -0800 (PST) Received: from FVFF77S0Q05N (unknown [10.57.46.95]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 666273F587; Tue, 10 Jan 2023 02:31:56 -0800 (PST) Date: Tue, 10 Jan 2023 10:31:48 +0000 From: Mark Rutland To: David Laight Cc: "linux-arm-kernel@lists.infradead.org" , "catalin.marinas@arm.com" , "lenb@kernel.org" , "linux-acpi@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "mhiramat@kernel.org" , "ndesaulniers@google.com" , "ojeda@kernel.org" , "peterz@infradead.org" , "rafael.j.wysocki@intel.com" , "revest@chromium.org" , "robert.moore@intel.com" , "rostedt@goodmis.org" , "will@kernel.org" Subject: Re: [PATCH 0/8] arm64/ftrace: Add support for DYNAMIC_FTRACE_WITH_CALL_OPS Message-ID: References: <20230109135828.879136-1-mark.rutland@arm.com> <34e0144b19e149d99719a5ffc834f228@AcuMS.aculab.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <34e0144b19e149d99719a5ffc834f228@AcuMS.aculab.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230110_023204_314744_FD0273DA X-CRM114-Status: GOOD ( 26.19 ) 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, Jan 10, 2023 at 08:55:58AM +0000, David Laight wrote: > From: Mark Rutland > > Sent: 09 January 2023 13:58 > > > > This series adds a new DYNAMIC_FTRACE_WITH_CALL_OPS mechanism, and > > enables support for this on arm64. This significantly reduces the > > overhead of tracing when a callsite/tracee has a single associated > > tracer, avoids a number of issues that make it undesireably and > > infeasible to use dynamically-allocated trampolines (e.g. branch range > > limitations), and makes it possible to implement support for > > DYNAMIC_FTRACE_WITH_DIRECT_CALLS in future. > > > > The main idea is to give each ftrace callsite an associated pointer to > > an ftrace_ops. The architecture's ftrace_caller trampoline can recover > > the ops pointer and invoke ops->func from this without needing to use > > ftrace_ops_list_func, which has to iterate through all registered ops. > > > > To do this, we use -fpatchable-function-entry=M,N, there N NOPs are > > placed before the function entry point... > > Doesn't this bump the minimum gcc version up to something like 9.0 ? This doesn't bump the minimum GCC version, but users of older toolchains won't get the speedup. We already support -fpatchable-function-entry based ftrace with GCC 8+ (and this is necessary to play nicely with pointer authentication), for older GCC versions we still support using -pg / mcount. > How does it interact with the 'CFI stuff' that also uses the same area? There's some more detail in patch 8, but the summary is that they're mutually exclusive for now (enforce by Kconfig), and I'm working with others to get improved compiler support necessary for them to play nicely together. Currently LLVM will place the type-hash before the pre-function NOPs, which works if everything has pre-function NOPs, but doesn't work for calls between instrumented and non-instrumented functions, since as the latter don't have pre-function NOPs and the type hash is placed at a different offset. To make them work better together we'll need some improved compiler support, and I'm working with others for that currently. GCC doesn't currently have KCFI support, but the plan is to match whatever LLVM does. Atop that we'll need some trivial changes to the asm function macros, but without the underlying compiler support there's not much point. Thanks, Mark. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel