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 AE915C77B70 for ; Tue, 11 Apr 2023 15:58:06 +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=vU8PekgJgL/Z+DWDYsvLxzQ066EqMVlUse9H1d53pDA=; b=XcBGAfq4O2Mnar 967sOsaC1CZgCGf9yWNyS/quPA5wUyrkuimzPwj4MSoj6p5sSBaDthh7KYC0xCJ1pIPqbwHlql2rK f9VFKgrX3cNdN4rizJBP5N9rMI3u5wAZ5egvk87E/6yE7bgBq9zqicVrXlCKDw0O/gwZU1vDyhCo3 Heg7FQ+Lu63q8VAo97yQlJnLE+leQqhBleUAQ1bPuTwWQ5FtHE+rITOjEkxzroMuEswYK/47bFwIc DMga0f1ayaclw5BueAOB5YgEn3Q6u7BvoUzafWk3JPcll7VrmjZdDolrKXUhd6EfEBp9M/ihScrfD B0bMp6NHVMsqhsduxeyg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pmGMm-000Uez-13; Tue, 11 Apr 2023 15:57:08 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pmGMi-000Ucx-2i for linux-arm-kernel@lists.infradead.org; Tue, 11 Apr 2023 15:57: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 6EB32D75; Tue, 11 Apr 2023 08:57:38 -0700 (PDT) Received: from FVFF77S0Q05N (unknown [10.57.20.166]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 994CF3F73F; Tue, 11 Apr 2023 08:56:51 -0700 (PDT) Date: Tue, 11 Apr 2023 16:56:45 +0100 From: Mark Rutland To: Florent Revest , catalin.marinas@arm.com, will@kernel.org, rostedt@goodmis.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, bpf@vger.kernel.org, mhiramat@kernel.org, ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, kpsingh@kernel.org, jolsa@kernel.org, xukuohai@huaweicloud.com, lihuafei1@huawei.com Subject: Re: [PATCH v6 0/5] Add ftrace direct call for arm64 Message-ID: References: <20230405180250.2046566-1-revest@chromium.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230405180250.2046566-1-revest@chromium.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230411_085704_976018_E5E1231D X-CRM114-Status: GOOD ( 23.29 ) 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 Wed, Apr 05, 2023 at 08:02:45PM +0200, Florent Revest wrote: > This series adds ftrace direct call support to arm64. > This makes BPF tracing programs (fentry/fexit/fmod_ret/lsm) work on arm64. > > It is meant to be taken by the arm64 tree but it depends on the > trace-direct-v6.3-rc3 tag of the linux-trace tree: > git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git > That tag was created by Steven Rostedt so the arm64 tree can pull the prior work > this depends on. [1] Catalin, Will, are you happy to pick this via the arm64 tree, or for it to go via the trace tree? We'd been assuming the former, but it looks like there'll be a (simple) merge conflict with the series adding FUNCTION_GRAPH_RETVAL: https://lore.kernel.org/lkml/cover.1680954589.git.pengdonglin@sangfor.com.cn/ ... as both series add some definitions to arm64's asm-offsets.c in the same place, and all those additions need to be kept. Other than that, the two series are independent. IIUC Steve was hoping to take the FUNCTION_GRAPH_RETVAL series through the trace tree, and if that's still the plan, maybe both should go that way? Mark. > Thanks to the ftrace refactoring under that tag, an ftrace_ops backing a ftrace > direct call will only ever point to *one* direct call. This means we can look up > the direct called trampoline address stored in the ops from the ftrace_caller > trampoline in the case when the destination would be out of reach of a BL > instruction at the ftrace callsite. This fixes limitations of previous attempts > such as [2]. > > This series has been tested on arm64 with: > 1- CONFIG_FTRACE_SELFTEST > 2- samples/ftrace/*.ko (cf: patch 4) > 3- tools/testing/selftests/bpf/test_progs (cf: patch 5) > > Changes since v5 [3]: > - Fixed saving the fourth argument of handle_mm_fault in both the x86 (patch 3) > and arm64 (as part of patch 4) "ftrace-direct-too" sample trampolines > - Fixed the address of the traced function logged by some direct call samples > (ftrace-direct-multi and ftrace-direct-multi-modify) by moving lr into x0 > > 1: https://lore.kernel.org/all/ZB2Nl7fzpHoq5V20@FVFF77S0Q05N/ > 2: https://lore.kernel.org/all/20220913162732.163631-1-xukuohai@huaweicloud.com/ > 3: https://lore.kernel.org/bpf/20230403113552.2857693-1-revest@chromium.org/ > > Florent Revest (5): > arm64: ftrace: Add direct call support > arm64: ftrace: Simplify get_ftrace_plt > samples: ftrace: Save required argument registers in sample > trampolines > arm64: ftrace: Add direct call trampoline samples support > selftests/bpf: Update the tests deny list on aarch64 > > arch/arm64/Kconfig | 6 ++ > arch/arm64/include/asm/ftrace.h | 22 +++++ > arch/arm64/kernel/asm-offsets.c | 6 ++ > arch/arm64/kernel/entry-ftrace.S | 90 ++++++++++++++++---- > arch/arm64/kernel/ftrace.c | 46 +++++++--- > samples/ftrace/ftrace-direct-modify.c | 34 ++++++++ > samples/ftrace/ftrace-direct-multi-modify.c | 40 +++++++++ > samples/ftrace/ftrace-direct-multi.c | 24 ++++++ > samples/ftrace/ftrace-direct-too.c | 40 +++++++-- > samples/ftrace/ftrace-direct.c | 24 ++++++ > tools/testing/selftests/bpf/DENYLIST.aarch64 | 82 ++---------------- > 11 files changed, 306 insertions(+), 108 deletions(-) > > -- > 2.40.0.577.gac1e443424-goog > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel