From patchwork Tue Jan 30 12:46:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pu Lehui X-Patchwork-Id: 13537527 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 EB903C47DDF for ; Tue, 30 Jan 2024 12:46:25 +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=VqopRfoaHciRcTg278pLuruN4fMycDSnTe3k9Aom8mA=; b=dbh0zuZ+76Jo7P poZrSdX8aPDs2aW+yuXUXOoPfJgA2qcToy0hDAuT9Q8XIeZ0Zq9tRMJxcAiTJW/A7u3bKRRL3bOjq WDc2BFKLlYtp2bldawQJaYs7eLt4+8tZmFrUUjH6gEQ0H60czPNjpJN/N4NcQbPwF6RdwN7kGs+Ig UThoEo/NaWKd2/F0ssLAMGn/RJxbElpU6ZMoPyG3i1z6qCZ81M6jW/46PozMDzrGbMpv3+VkCB6y8 f38jifz+53t3smeWq0B4qMQha/SZ9WDDCXKtwvsb+K6ZG5vmfAAlHM9E2nR8fNqEwupwc3Pbr0CrG 0aJCH0FGh4fsmZ73qE2w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rUnVO-0000000GitG-2DyR; Tue, 30 Jan 2024 12:46:22 +0000 Received: from [45.249.212.56] (helo=dggsgout12.his.huawei.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rUnVK-0000000GiqB-2Ek9 for linux-riscv@lists.infradead.org; Tue, 30 Jan 2024 12:46:20 +0000 Received: from mail.maildlp.com (unknown [172.19.163.216]) by dggsgout12.his.huawei.com (SkyGuard) with ESMTP id 4TPPzf70syz4f3kG1 for ; Tue, 30 Jan 2024 20:46:06 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id 1E2031A01E9 for ; Tue, 30 Jan 2024 20:46:11 +0800 (CST) Received: from ultra.huawei.com (unknown [10.90.53.71]) by APP1 (Coremail) with SMTP id cCh0CgCXZg+S77hllrfLCQ--.28270S2; Tue, 30 Jan 2024 20:46:10 +0800 (CST) From: Pu Lehui To: bpf@vger.kernel.org, linux-riscv@lists.infradead.org, netdev@vger.kernel.org Cc: =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= , Hou Tao , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Palmer Dabbelt , Luke Nelson , Pu Lehui , Pu Lehui Subject: [PATCH bpf-next 0/2] Enable inline bpf_kptr_xchg() for RV64 Date: Tue, 30 Jan 2024 12:46:57 +0000 Message-Id: <20240130124659.670321-1-pulehui@huaweicloud.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CM-TRANSID: cCh0CgCXZg+S77hllrfLCQ--.28270S2 X-Coremail-Antispam: 1UD129KBjvdXoW7XFyfWw47Jr48Xr1kXrWkJFb_yoW3AwbEkr y8Xw1DXFyYvryIvF4UKas8t398KrW3Xry5ZryIgF42yw1aqFs8ZFWku3s3JryUZrs3Zry7 JF4DXFWIyw13ujkaLaAFLSUrUUUUjb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbxxFF20E14v26ryj6rWUM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8w A2z4x0Y4vE2Ix0cI8IcVAFwI0_Xr0_Ar1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Cr0_ Gr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I0E14v26rxl6s 0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xII jxv20xvE14v26r106r15McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr 1lF7xvr2IYc2Ij64vIr41lF7I21c0EjII2zVCS5cI20VAGYxC7M4IIrI8v6xkF7I0E8cxa n2IY04v7MxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrV AFwI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVW8ZVWrXwCI c40Y0x0EwIxGrwCI42IY6xIIjxv20xvE14v26r1j6r1xMIIF0xvE2Ix0cI8IcVCY1x0267 AKxVW8JVWxJwCI42IY6xAIw20EY4v20xvaj40_Zr0_Wr1UMIIF0xvEx4A2jsIE14v26r1j 6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr1j6F4UJbIYCTnIWIevJa73UjIFyTuYvjfUF0 eHDUUUU X-CM-SenderInfo: psxovxtxl6x35dzhxuhorxvhhfrp/ X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240130_044618_783006_ECA63E49 X-CRM114-Status: UNSURE ( 5.45 ) 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 This patch is the RV64 implementation of inline bpf_kptr_xchg()[0]. RV64 JIT supports 64-bit BPF_XCHG atomic instructions. At the same time, the underlying implementation of xchg() and atomic64_xchg() in RV64 both are raw_xchg() that supported 64-bit. Therefore inline bpf_kptr_xchg() will have equivalent semantics. Let's inline it for better performance. link: https://lore.kernel.org/bpf/20240105104819.3916743-1-houtao@huaweicloud.com [0] Pu Lehui (2): riscv, bpf: Enable inline bpf_kptr_xchg() for RV64 selftests/bpf: Enable inline bpf_kptr_xchg() test for RV64 arch/riscv/net/bpf_jit_comp64.c | 5 +++++ tools/testing/selftests/bpf/prog_tests/kptr_xchg_inline.c | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) Acked-by: Björn Töpel