Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp5719775rwl; Tue, 11 Apr 2023 09:04:54 -0700 (PDT) X-Google-Smtp-Source: AKy350Yc2JJyNQAXu28bBXPybp5M5I812GJeQT80XHLTJzioFwY2TgKGM0s0P9fF/4vuOUReGVm1 X-Received: by 2002:a05:6a20:4b0a:b0:d7:b09b:a723 with SMTP id fp10-20020a056a204b0a00b000d7b09ba723mr15133816pzb.8.1681229093942; Tue, 11 Apr 2023 09:04:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681229093; cv=none; d=google.com; s=arc-20160816; b=Hfltcmp72tKbJKS9DgVpdaRA8Ru5GOrH8akj4+NjpuTuaEfaImMqSTkNBQq9hdLVjA xZzIlTjP2yUxKeoA2EO1jNYcCSAbKN4DJXqEt1QqXktKTENfZPVgK75FzPP4B24l5Pc9 PupYg8Gnw7MHvixchCphzHnFUvhEAFO31AsylrNGk8qX7dsO3rZKWrv9zYkAZ2zYRBiN FnGXTatplP8OByhPQ2xOaH48FTbOtX5+QMrS4sz7T8MkjrPWE9upw3+tge/C5vzmHznE QQV/0u3BLuVlB273gy9VwiVdt1sx55Njw0BKjxNJzpfv/6nMuF/LNdvzVWJverz6gnbg mPqg== 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=9BxYXaBxdWBo8+qSQFU2V6Av8gJ2kn534EPDYjImAfE=; b=fO5T0QBH9ddfg1Kba4ShECaAIfhOTNPrCMR9GSv0ZscaYUyEjsySurx/i912QqWyUH KzMsRWvo4JFEQMQsSyulxKfxHhkxzFNhMFlr/YeI/mTNmM/QvHYPum5cRFfZWY5OnQdA HZ04J5SGKeLq3ljW2DruiDFDze/rdRlbklXdEStu76yC0BEblIcv/VyQfiEl+YU1oxoB E5tB6nHMdYH2WkyNS+UTif4F1eeKuhEtl6O9qNxLxW2vaKGmYYJUKYAnIfz8ZEhwRxWZ eM5u6j3pxOxQulsOJ4SZ93BFhn/8eosD6APeL8AlU0QyuE8cM92UXnZozAyKMrBb/Idv jLYA== 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 f78-20020a623851000000b00638a9ca0026si4904344pfa.81.2023.04.11.09.04.41; Tue, 11 Apr 2023 09:04:53 -0700 (PDT) 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 S231211AbjDKP45 (ORCPT + 99 others); Tue, 11 Apr 2023 11:56:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231130AbjDKP4z (ORCPT ); Tue, 11 Apr 2023 11:56:55 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5CCA0E74; Tue, 11 Apr 2023 08:56:54 -0700 (PDT) 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-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230405180250.2046566-1-revest@chromium.org> X-Spam-Status: No, score=-2.3 required=5.0 tests=RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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 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 >