Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp7589448rwl; Tue, 10 Jan 2023 02:53:06 -0800 (PST) X-Google-Smtp-Source: AMrXdXtf6UpxI1wfmSMiihBmeXkme5B7a3UlZHS9KDjBkgRFpfiYhvK0uA9x4wIU6B0AV2abBZiA X-Received: by 2002:aa7:d513:0:b0:462:9baa:7507 with SMTP id y19-20020aa7d513000000b004629baa7507mr58225232edq.8.1673347986284; Tue, 10 Jan 2023 02:53:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673347986; cv=none; d=google.com; s=arc-20160816; b=UQMVmb1TT5ZodKDbLNR0ZUqCxDkd0ki/kE8YFMPw1YFfnDIejWYFFhVlCElrH1lntQ kWYLmeR35LcgQ0s+Tk/uawoLzGlEv/aqqd+obVQpPaRyZBOb62NOAsjhlob8b0IsegTq autmmunZM1zX2cyBTuh7Jy7ZECc+HHfJQ0bgM8CggfBLVByRUn+Yjcv2lvH3pEVAsVnD 57kDYneyqGOFKjCD3DajssuCSoJkdnybJeWxiordGz2NXM2qhNdSvPnjnDMt2D2gb2GC kMP+hdWsmBE7OftEFuRgC0Bnby+Vkm1WajRN2B826VRQ/c6LI9aMBG4f8HP4T9Va70XK dM0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=dRla943zIgv4ev8ZzjdVrSNQbJt2YqkWHuruD8BOZKs=; b=eQ89DBYQKQ9vb0U+hU+krfCXXLlFoSgVHEiQIEVOopD80z5CupSWjyRjCVG5HXjJMn cKJdCZZd3Wd0YZFkrrr/9q5kiwDCRMwnM57lLxGMT3B8ylx//wP106fmiuwyOcp81k9U 7mDdwtt4JrBhG4DNE+zmWvHI1WM34z5THpw0vhspnzSVTd7S3/46qyTQqvBnF2JC3lii MfTCP1nwGMocw9zNuVAQBvx3dd3q9yH8RmwkpWq1b68HdNuW5NcTsLtH30ky4QclaNQf 5EGHblLPw0zTXiXRp2HjMKD/TxByJHIMrvDCaSEesiqny4PLDpwjJtm+z2P8ofw2BY4G SJ/Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o15-20020a509b0f000000b0046c53c2be4asi2017792edi.365.2023.01.10.02.52.53; Tue, 10 Jan 2023 02:53:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231949AbjAJKcD (ORCPT + 53 others); Tue, 10 Jan 2023 05:32:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231373AbjAJKcA (ORCPT ); Tue, 10 Jan 2023 05:32:00 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 21D5F4086E; Tue, 10 Jan 2023 02:31:59 -0800 (PST) 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-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <34e0144b19e149d99719a5ffc834f228@AcuMS.aculab.com> X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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.