Message ID | 20240702013730.1082285-1-pulehui@huaweicloud.com (mailing list archive) |
---|---|
Headers | show
Return-Path: <linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org> 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 973E6C30653 for <linux-riscv@archiver.kernel.org>; Tue, 2 Jul 2024 01:36:09 +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:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=+pObjLpi0jvpXYn04HCUgf1VwyuTNgp6QYSIfV9sHDE=; b=wOd6PI7wkofty8 xwqwsZ9RjqqcKUl3oEIpTBhtXa+GZKU3164NU1ul2CYyEbtZzjnBv1qNmu24t95sfxhitvGbI9lI7 Efnb3ab/3LHn3HvzAXp/ARE2npCPaPWWRC+OKL1gcrlTOpBF9j65n6KxA4RB85UCr1B6577zuOG9b we/e+gyvhyGGtVq13Ikrx5Y93H55MfdWwCV1SGp2JutRtxF1cTiih+MHSmKV+Au7z3Xq+1X4t6hzc P/5vFtdAnL280im+UziQ0HNjLCRVEqZkNPhiKNQf/hQt8X0442bDkOZN7p+48gDz5zy0Qj/+LEivq fP1QT677JHzZQfd24FCg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sOSRB-00000005HSV-33PO; Tue, 02 Jul 2024 01:36:05 +0000 Received: from dggsgout11.his.huawei.com ([45.249.212.51]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sOSR6-00000005HPs-3djK for linux-riscv@lists.infradead.org; Tue, 02 Jul 2024 01:36:02 +0000 Received: from mail.maildlp.com (unknown [172.19.163.235]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4WClpv3YHMz4f3kvJ for <linux-riscv@lists.infradead.org>; Tue, 2 Jul 2024 09:35:35 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id E863E1A058E for <linux-riscv@lists.infradead.org>; Tue, 2 Jul 2024 09:35:47 +0800 (CST) Received: from ultra.huawei.com (unknown [10.90.53.71]) by APP1 (Coremail) with SMTP id cCh0CgCXwX1vWYNm+0GRAw--.62272S2; Tue, 02 Jul 2024 09:35:45 +0800 (CST) From: Pu Lehui <pulehui@huaweicloud.com> To: bpf@vger.kernel.org, linux-riscv@lists.infradead.org, netdev@vger.kernel.org Cc: =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= <bjorn@kernel.org>, Alexei Starovoitov <ast@kernel.org>, Daniel Borkmann <daniel@iogearbox.net>, Andrii Nakryiko <andrii@kernel.org>, Martin KaFai Lau <martin.lau@linux.dev>, Eduard Zingerman <eddyz87@gmail.com>, Song Liu <song@kernel.org>, Yonghong Song <yonghong.song@linux.dev>, John Fastabend <john.fastabend@gmail.com>, KP Singh <kpsingh@kernel.org>, Stanislav Fomichev <sdf@google.com>, Hao Luo <haoluo@google.com>, Jiri Olsa <jolsa@kernel.org>, Puranjay Mohan <puranjay@kernel.org>, Palmer Dabbelt <palmer@dabbelt.com>, Pu Lehui <pulehui@huawei.com> Subject: [PATCH bpf-next v5 0/3] Add 12-argument support for RV64 bpf trampoline Date: Tue, 2 Jul 2024 01:37:27 +0000 Message-Id: <20240702013730.1082285-1-pulehui@huaweicloud.com> X-Mailer: git-send-email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IevJa73UjIFyTuYvjxUFDGOUUUUU X-CM-SenderInfo: psxovxtxl6x35dzhxuhorxvhhfrp/ X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240701_183601_256383_3067C885 X-CRM114-Status: UNSURE ( 8.12 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: <linux-riscv.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-riscv>, <mailto:linux-riscv-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-riscv/> List-Post: <mailto:linux-riscv@lists.infradead.org> List-Help: <mailto:linux-riscv-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-riscv>, <mailto:linux-riscv-request@lists.infradead.org?subject=subscribe> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Sender: "linux-riscv" <linux-riscv-bounces@lists.infradead.org> Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org |
Series |
Add 12-argument support for RV64 bpf trampoline
|
expand
|
From: Pu Lehui <pulehui@huawei.com> This patch adds 12 function arguments support for riscv64 bpf trampoline. The current bpf trampoline supports <= sizeof(u64) bytes scalar arguments [0] and <= 16 bytes struct arguments [1]. Therefore, we focus on the situation where scalars are at most XLEN bits and aggregates whose total size does not exceed 2×XLEN bits in the riscv calling convention [2]. Link: https://elixir.bootlin.com/linux/v6.8/source/kernel/bpf/btf.c#L6184 [0] Link: https://elixir.bootlin.com/linux/v6.8/source/kernel/bpf/btf.c#L6769 [1] Link: https://github.com/riscv-non-isa/riscv-elf-psabi-doc/releases/download/draft-20230929-e5c800e661a53efe3c2678d71a306323b60eb13b/riscv-abi.pdf [2] v5: - Remove unnecessary copyright. v4: https://lore.kernel.org/all/20240622022129.3844473-1-pulehui@huaweicloud.com/ - Separate many args test logic from tracing_struct. (Daniel) v3: https://lore.kernel.org/all/20240403072818.1462811-1-pulehui@huaweicloud.com/ - Variable and macro name alignment: nr_reg_args: number of args in reg nr_stack_args: number of args on stack RV_MAX_REG_ARGS: macro for riscv max args in reg v2: https://lore.kernel.org/all/20240403041710.1416369-1-pulehui@huaweicloud.com/ - Add tracing_struct to DENYLIST.aarch64 while aarch64 does not yet support bpf trampoline with more than 8 args. - Change the macro RV_MAX_ARG_REGS to RV_MAX_ARGS_REG to synchronize with the variable definition below. - Add some comments for stk_arg_off and magic number of skip slots for loading args on stack. v1: https://lore.kernel.org/all/20240331092405.822571-1-pulehui@huaweicloud.com/ Pu Lehui (3): riscv, bpf: Add 12-argument support for RV64 bpf trampoline selftests/bpf: Factor out many args tests from tracing_struct selftests/bpf: Add testcase where 7th argment is struct arch/riscv/net/bpf_jit_comp64.c | 66 +++++++++---- tools/testing/selftests/bpf/DENYLIST.aarch64 | 1 + .../selftests/bpf/bpf_testmod/bpf_testmod.c | 19 ++++ .../selftests/bpf/prog_tests/tracing_struct.c | 46 ++++++++- .../selftests/bpf/progs/tracing_struct.c | 54 ----------- .../bpf/progs/tracing_struct_many_args.c | 95 +++++++++++++++++++ 6 files changed, 204 insertions(+), 77 deletions(-) create mode 100644 tools/testing/selftests/bpf/progs/tracing_struct_many_args.c