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 1DDFDC05027 for ; Thu, 2 Feb 2023 08:37:49 +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-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:CC:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=B7xG8JriEdyHct3oocbTLTgWQEjsbqIRMyhlyqCIKk8=; b=xPiTuDJbP65Q0u LjGxQo6LVl0tvRVmbfAVZg2ONbv5Y8Xfgv/OKIA2BMin/Ez0NRuwqPv6YpcHKWPMVsBkIfa/W/2Jy hihOaGpnXEnvJL5hD1VC0CkoGuizQpsi6wnlRqWy2WnRRMl6cpLHI9hZEKC3L0xOa4nF5QApERoiz dW6dQVbKyvuQYbnM1hyxdG6Woz4PzX1EFxoz1zIIxS8MuGYgrw2vyckTui7aGLTszquJdkWxn9gVN TNb4XIe5/mHtUgDx8+vW8eJFSzZrKidLfam8TN14Dr+F9V2R3CZL/DvevahLr4S8yFLb0U00T8kI8 kvXEc3mn2spx7axK0/bg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNV5O-00EzEe-Ms; Thu, 02 Feb 2023 08:36:50 +0000 Received: from szxga01-in.huawei.com ([45.249.212.187]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNV5J-00EzAL-86 for linux-arm-kernel@lists.infradead.org; Thu, 02 Feb 2023 08:36:47 +0000 Received: from kwepemi500013.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4P6sZg1zLqzfZ9N; Thu, 2 Feb 2023 16:36:27 +0800 (CST) Received: from [10.67.111.192] (10.67.111.192) by kwepemi500013.china.huawei.com (7.221.188.120) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 2 Feb 2023 16:36:37 +0800 Message-ID: <85af713d-00fe-b113-1331-1a44480c016f@huawei.com> Date: Thu, 2 Feb 2023 16:36:36 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [PATCH 0/8] Add ftrace direct call for arm64 Content-Language: en-US To: Florent Revest , , , , CC: , , , , , , , , , , References: <20230201163420.1579014-1-revest@chromium.org> From: Xu Kuohai In-Reply-To: <20230201163420.1579014-1-revest@chromium.org> X-Originating-IP: [10.67.111.192] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemi500013.china.huawei.com (7.221.188.120) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230202_003645_711895_ECFB7E3E X-CRM114-Status: GOOD ( 20.45 ) 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-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2/2/2023 12:34 AM, 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 apply on top of the arm64 tree which contains Mark Rutland's > series on CALL_OPS [1] under the for-next/ftrace tag. > > The first three patches consolidate the two existing ftrace APIs for registering > direct calls. They are split to make the reviewers lives easier but if it'd be a > preferred style, I'd be happy to squash them in the next revision. > Currently, there is both a _ftrace_direct and _ftrace_direct_multi API. Apart > from samples and selftests, there are no users of the _ftrace_direct API left > in-tree so this deletes it and renames the _ftrace_direct_multi API to > _ftrace_direct for simplicity. > > The main benefit of this refactoring is that, with the API that's left, an > ftrace_ops backing a direct call will only ever point to one direct call. We can > therefore store the direct called trampoline address in the ops (patch 4) and > look it up from the ftrace trampoline on arm64 (patch 7) in the case when the > destination would be out of reach of a BL instruction at the ftrace callsite. > (in this case, ftrace_caller acts as a lightweight intermediary trampoline) > > This series has been tested on both arm64 and x86_64 with: > 1- CONFIG_FTRACE_SELFTEST (cf: patch 6) > 2- samples/ftrace/*.ko (cf: patch 8) > 3- tools/testing/selftests/bpf/test_progs (both -t lsm and -t fentry_fexit) so it's time to update DENYLIST.aarch64 to unblock tests that failed due to lack of direct call. > > This follows up on prior art by Xu Kuohai [2]. > The implementation here is totally different but the fix for ftrace selftests > (patch 6) is a trivial rebase of a patch originally by Xu so I kept his > authorship and trailers untouched on that patch, I hope that's ok. > that's ok for me, thanks. > 1: https://lore.kernel.org/all/20230123134603.1064407-1-mark.rutland@arm.com/ > 2: https://lore.kernel.org/bpf/20220913162732.163631-1-xukuohai@huaweicloud.com/ > > Florent Revest (7): > ftrace: Replace uses of _ftrace_direct APIs with _ftrace_direct_multi > ftrace: Remove the legacy _ftrace_direct API > ftrace: Rename _ftrace_direct_multi APIs to _ftrace_direct APIs > ftrace: Store direct called addresses in their ops > ftrace: Make DIRECT_CALLS work WITH_ARGS and !WITH_REGS > arm64: ftrace: Add direct call support > arm64: ftrace: Add direct called trampoline samples support > > Xu Kuohai (1): > ftrace: Fix dead loop caused by direct call in ftrace selftest > > arch/arm64/Kconfig | 4 + > arch/arm64/include/asm/ftrace.h | 24 ++ > arch/arm64/kernel/asm-offsets.c | 6 + > arch/arm64/kernel/entry-ftrace.S | 70 +++- > arch/arm64/kernel/ftrace.c | 36 +- > include/linux/ftrace.h | 51 +-- > kernel/bpf/trampoline.c | 14 +- > kernel/trace/Kconfig | 2 +- > kernel/trace/ftrace.c | 433 +------------------- > kernel/trace/trace_selftest.c | 14 +- > samples/Kconfig | 2 +- > samples/ftrace/ftrace-direct-modify.c | 41 +- > samples/ftrace/ftrace-direct-multi-modify.c | 44 +- > samples/ftrace/ftrace-direct-multi.c | 28 +- > samples/ftrace/ftrace-direct-too.c | 35 +- > samples/ftrace/ftrace-direct.c | 33 +- > 16 files changed, 333 insertions(+), 504 deletions(-) > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel