From patchwork Mon Jan 15 12:54:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pu Lehui X-Patchwork-Id: 13519559 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 56572C3DA79 for ; Mon, 15 Jan 2024 12:54:29 +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=Ed5iopWa0NApwFboK+MeX539eFQA8TNqbGAie8LrVVE=; b=K4maLMWuW1KPUJ qfTh2x2z5RIuWBppCfDwQakGXo0C2sGiPakEqHU6Zkcdv2NhK7RDQV+TmoQPg1ctrWV0w1FcOD4dE kTHdNtaUPd26BkDquaoSGe33KM/K0rgww9hGWYWx0KtZKjQe8U695ApZRkywheOrCzvrWa/LUS4rb xhIK28m27X/eUfYPv3HvzuazHvI7BwH5awa7Wt69RXZdWr2S/hwsdXXqy4QIEtf2T1xFS2YSGCr/5 T2N/SgVv9ghHTaWFSGk5Vh+gZPdd8udGkNXvqVW0UTLpXvE3UlJq7/mLA8MRvk20sRSCTFK8erEAm G8ZudDssYPHfu4xFxjhQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rPMTr-008x4h-0h; Mon, 15 Jan 2024 12:54:19 +0000 Received: from szxga02-in.huawei.com ([45.249.212.188]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rPMTk-008x1X-2E for linux-riscv@lists.infradead.org; Mon, 15 Jan 2024 12:54:17 +0000 Received: from mail.maildlp.com (unknown [172.19.163.48]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4TDBrS6l0YzWmc4; Mon, 15 Jan 2024 20:52:56 +0800 (CST) Received: from kwepemd100009.china.huawei.com (unknown [7.221.188.135]) by mail.maildlp.com (Postfix) with ESMTPS id CF9FB180017; Mon, 15 Jan 2024 20:53:55 +0800 (CST) Received: from ultra.huawei.com (10.90.53.71) by kwepemd100009.china.huawei.com (7.221.188.135) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.1258.28; Mon, 15 Jan 2024 20:53:54 +0800 From: Pu Lehui To: , , CC: =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Palmer Dabbelt , Conor Dooley , Luke Nelson , Pu Lehui , Pu Lehui Subject: [PATCH bpf-next v3 0/6] Zbb support and code simplification for RV64 JIT Date: Mon, 15 Jan 2024 12:54:21 +0000 Message-ID: <20240115125427.2914015-1-pulehui@huawei.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Originating-IP: [10.90.53.71] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemd100009.china.huawei.com (7.221.188.135) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240115_045412_905130_707E0F7E X-CRM114-Status: UNSURE ( 3.84 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Add Zbb support [0] to optimize code size and performance of RV64 JIT. Meanwhile, adjust the code for unification and simplification. Tests test_bpf.ko and test_verifier have passed, as well as the relative testcases of test_progs*. Link: https://github.com/riscv/riscv-bitmanip/releases/download/1.0.0/bitmanip-1.0.0-38-g865e7a7.pdf [0] v3: - Change to early-exit code style and make code more explicit. v2: https://lore.kernel.org/bpf/20230919035839.3297328-1-pulehui@huaweicloud.com - Add runtime detection for Zbb instructions. - Correct formatting issues detected by checkpatch. v1: https://lore.kernel.org/bpf/20230913153413.1446068-1-pulehui@huaweicloud.com Pu Lehui (6): riscv, bpf: Unify 32-bit sign-extension to emit_sextw riscv, bpf: Unify 32-bit zero-extension to emit_zextw riscv, bpf: Simplify sext and zext logics in branch instructions riscv, bpf: Add necessary Zbb instructions riscv, bpf: Optimize sign-extention mov insns with Zbb support riscv, bpf: Optimize bswap insns with Zbb support arch/riscv/net/bpf_jit.h | 134 ++++++++++++++++++++ arch/riscv/net/bpf_jit_comp64.c | 210 +++++++++++--------------------- 2 files changed, 205 insertions(+), 139 deletions(-)