Message ID | 20230403113552.2857693-1-revest@chromium.org |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2234297vqo; Mon, 3 Apr 2023 04:42:01 -0700 (PDT) X-Google-Smtp-Source: AKy350ZCtNOVuxHxpQtmhs/211lrkcOzYuGsx5hcWrKnziijW382B0X+Hj2RB8MSvFhqIQKB18Pl X-Received: by 2002:a17:907:7ea6:b0:944:18ef:c970 with SMTP id qb38-20020a1709077ea600b0094418efc970mr37317803ejc.32.1680522121668; Mon, 03 Apr 2023 04:42:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680522121; cv=none; d=google.com; s=arc-20160816; b=bldSMHa/kDHG0V9jrdlLf80jLXGnPWhMQiEucVfm9DP8P5IyoFNaZJC3GgJLz4LfIZ bB0exBDimKBieekoOpQBWMk9IWmwHgDOPy4YWJU9hxsUf1xWgogYhsZEie8cOt6kys4s aFBU0C27EP8LPzE8vvKlC13NNyBtnfnxzB2rq09Z4qr4b4uHCO6PV+F2o5WUje5h2c23 x+hJ/dV4Yn+n2y3qjnJnFAUFxtBm/ebzJiNEFBflNWWrkISQrShxE2HVVkPhfdBiHmGn ORbsl+YRqbr/ngknNGQk+162FVtReCEGHyb/QnuNcCmIQCAlAi8Jxfp1YMmNg472uTaD kV3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=i0HG+W1Nr/Zm5XRUMWQUndq8bum7JqRDYebIXh9Qbe0=; b=ydca2sMJMXKb0nwDzveirL+pkFzZHODenHQJ159dWegiq3bdLDMy0Ka9yglUmwwCPM RAP1vqptXdZrlInKUI2YNFIURua8F1cXK/zPQXaTLkjYjPe3j/WRD3Fw3fv3UJKSI+vE Po2LkiZ7uR/9LQ0CPawgbh0XYXUdKEke6H3hLDyQKN/2I0dUN7nILH1YqcDAluzO2Jk8 HZ/uP6JghNx9Kzaj5Jr8xpRs9m4u43LauYJ2LgkvLneBWqWFC6hSBzHZnagePVN3nWcr lL0FKas3NZUND7AZCCa0FIw6Y1uEavJ+GEus49K4RNo3FsRF+HiHob4f95HzQitHKhA+ bzbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ADin8NDR; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i14-20020aa7dd0e000000b00501cf1795cdsi7593382edv.112.2023.04.03.04.41.38; Mon, 03 Apr 2023 04:42:01 -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; dkim=pass header.i=@chromium.org header.s=google header.b=ADin8NDR; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232490AbjDCLgF (ORCPT <rfc822;zwp10758@gmail.com> + 99 others); Mon, 3 Apr 2023 07:36:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232136AbjDCLgD (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 3 Apr 2023 07:36:03 -0400 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0439E12CC6 for <linux-kernel@vger.kernel.org>; Mon, 3 Apr 2023 04:35:59 -0700 (PDT) Received: by mail-wm1-x336.google.com with SMTP id r19-20020a05600c459300b003eb3e2a5e7bso17917428wmo.0 for <linux-kernel@vger.kernel.org>; Mon, 03 Apr 2023 04:35:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1680521758; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=i0HG+W1Nr/Zm5XRUMWQUndq8bum7JqRDYebIXh9Qbe0=; b=ADin8NDRYe5sQ0hrQPtqSRLSxBB8ihn7EpyAUhlsyrOcCkUj61zdV9iPRft+pFLa0x E09qWvv0++B5plr6iXhNTTdYGo23EMPXVy1xwh6WqY7AGjsf4MFmGNH4LhqH19kBPAP7 dVdDRTCTSY0MHjb/HLXDSl+4C4hbkxyfphfSE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680521758; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=i0HG+W1Nr/Zm5XRUMWQUndq8bum7JqRDYebIXh9Qbe0=; b=D9EmlK/dcXmnWw4brTIC72yPheMFKEWtBECxDsk9SXWUyMm09cV+ObDg93CJx9/Xfz jfpBqwgyemaUJ0De88lixxQeCyvsESBf1zKFmyfamcsUsBxt+XQHAtbFOA3oDgJu4guD ESf6VV+t2saG6BVxX1QxBK6YeIqjQDBNCFomli1Rv/wH22ri9VPQYH/qax6LsHv6Qz/k 5ldFu5EmPC5YgSUUc4OIh61MD+wEMk5H+6r2YHabC1N6Y7D2n+DGmqz8gyNWIYEC9YnM B85F+55IsaGI48QiiT0viHhxjKDMvkAdZwnrnk55UcGcDZT4UKK5aKR62B9e0w69AOOK jxYw== X-Gm-Message-State: AO0yUKXAj9Pxpe2qfOvWBwnhSg0GScNjsQifhZWy+805Bru0+w9TS4Li 5ihoqCnvBYjCxhzIjo79R5LU4Q== X-Received: by 2002:a05:600c:2312:b0:3ee:b3bf:5f7c with SMTP id 18-20020a05600c231200b003eeb3bf5f7cmr27217057wmo.23.1680521758197; Mon, 03 Apr 2023 04:35:58 -0700 (PDT) Received: from revest.zrh.corp.google.com ([2a00:79e0:9d:6:b5a2:4ffd:8524:ac1]) by smtp.gmail.com with ESMTPSA id s15-20020a05600c45cf00b003eb2e33f327sm29841410wmo.2.2023.04.03.04.35.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Apr 2023 04:35:57 -0700 (PDT) From: Florent Revest <revest@chromium.org> To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, bpf@vger.kernel.org Cc: catalin.marinas@arm.com, will@kernel.org, rostedt@goodmis.org, mhiramat@kernel.org, mark.rutland@arm.com, ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, kpsingh@kernel.org, jolsa@kernel.org, xukuohai@huaweicloud.com, lihuafei1@huawei.com, Florent Revest <revest@chromium.org> Subject: [PATCH v5 0/4] Add ftrace direct call for arm64 Date: Mon, 3 Apr 2023 13:35:48 +0200 Message-Id: <20230403113552.2857693-1-revest@chromium.org> X-Mailer: git-send-email 2.40.0.423.gd6c402a77b-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762154184256427583?= X-GMAIL-MSGID: =?utf-8?q?1762155164227665688?= |
Series | Add ftrace direct call for arm64 | |
Message
Florent Revest
April 3, 2023, 11:35 a.m. UTC
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] 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 3) 3- tools/testing/selftests/bpf/test_progs (cf: patch 4) Changes since v4 [3]: - *Actually* added "BTI C" instructions at the beginning of each ftrace direct call sample (v4 was supposed to do that but I forgot to git commit --amend...) 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/20230403112059.2749695-1-revest@chromium.org/ Florent Revest (4): arm64: ftrace: Add direct call support arm64: ftrace: Simplify get_ftrace_plt 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 | 38 +++++++++ samples/ftrace/ftrace-direct-multi.c | 23 +++++ samples/ftrace/ftrace-direct-too.c | 26 ++++++ samples/ftrace/ftrace-direct.c | 24 ++++++ tools/testing/selftests/bpf/DENYLIST.aarch64 | 82 ++---------------- 11 files changed, 295 insertions(+), 102 deletions(-)