Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp3406252rwj; Mon, 19 Dec 2022 18:19:57 -0800 (PST) X-Google-Smtp-Source: AMrXdXsbCvAJqRWVPbM1F9scM7XpT2VKIkJd8WKOv8uSUPDHUfu0M/cSbEcGWq92fJUbpElXXp6d X-Received: by 2002:a50:fc8c:0:b0:46b:9e14:73ed with SMTP id f12-20020a50fc8c000000b0046b9e1473edmr391013edq.39.1671502797544; Mon, 19 Dec 2022 18:19:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671502797; cv=none; d=google.com; s=arc-20160816; b=Cf78pxdBGbyMIok6UKn+5e8vUJ4ZxD0MGB0s8By2vECWBoIhvY71N6NcuOoGb5w//q QFcZBAQuyGM77uV69zWBkmcYBpVMyWIagLqw9uETh6RywsrCUQ2HTYcho1f1IR0aKwO1 ZdRnb2mb9FL+eo0wmPS4+p1RiIs/XebSNH5M3uFXiFAL8T52+3HeY8CmRXPDarsAJliH awG7TpZsIAhI7XE3ZRudk+TcKYiPrenDnX47oz4kwNPjL02E1EXaEIFHMY7I2RtxSfFo wWHF6zM3Qt/KqKedU4LQy3rZqLh9IRtxHsZL/BueasHA+UNstTZ88mTqD0Z2lHJC7F86 Putw== 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; bh=dQgVA9iskS63cotPP8pAMUENPqDsSU8J6j+T2mwpXv8=; b=sz9FXOqcDr59J0SI5SFdML4dSe3kXl1lb4TMwAvhh7jJ3v3xejJKecifqC3nDBqjHY 1JPhQ+t+WKsRtpCgX+XeZ52EpkF67908rBx2R040fTUvTrjVgr6hhWtvEi7Z3ZATVu3n 3/3DOgatq9oFVQVZomfh5oIdQlUFdudh5x9tT2Hhq5sXdvCBJzn1nb8jiWWs+q4M24U+ BYd3T5mfwc4glc8mrGCidiYbepR07Zwx2+VN4olnpGkAB4sDYLXzy6E7sBxN+jVgY8A+ +MumQcVOMikg6+3FlJ6dijPh2XvQQEFAUCBT6jHl7SZZy3df+w7wKUyMYOHNhU7JrBf6 EDXA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h8-20020a05640250c800b0046a6960c990si1492639edb.431.2022.12.19.18.19.40; Mon, 19 Dec 2022 18:19:57 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232975AbiLTCM1 (ORCPT + 70 others); Mon, 19 Dec 2022 21:12:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232726AbiLTCMT (ORCPT ); Mon, 19 Dec 2022 21:12:19 -0500 Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EFD5CA1B1; Mon, 19 Dec 2022 18:12:16 -0800 (PST) Received: from mail02.huawei.com (unknown [172.30.67.153]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4Nbg7b1zHxz4f3tpn; Tue, 20 Dec 2022 10:12:11 +0800 (CST) Received: from localhost.localdomain (unknown [10.67.175.61]) by APP4 (Coremail) with SMTP id gCh0CgDnT7P6GaFju6m1AA--.8438S2; Tue, 20 Dec 2022 10:12:12 +0800 (CST) From: Pu Lehui To: bpf@vger.kernel.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Cc: =?UTF-8?q?Bj=C3=B6rn=20T=C3=B6pel?= , Luke Nelson , Xi Wang , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Paul Walmsley , Palmer Dabbelt , Albert Ou , Pu Lehui , Pu Lehui Subject: [RFC PATCH RESEND bpf-next 0/4] Support bpf trampoline for RV64 Date: Tue, 20 Dec 2022 10:13:15 +0800 Message-Id: <20221220021319.1655871-1-pulehui@huaweicloud.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: gCh0CgDnT7P6GaFju6m1AA--.8438S2 X-Coremail-Antispam: 1UD129KBjvJXoW7tw17GrWfJw4xAF4fArWDurg_yoW8Gryfpa yFkry3CFyDXFy7Jwnaqa1UZ3WFv3ykX3W3Gw13J3yrCan8Xry7Jr1Yga15t34rCFyfuw1U twn0qr4jkas8Aa7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUvY14x267AKxVW5JVWrJwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26w1j6s0DM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r4U JVWxJr1l84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_Gc CE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E 2Ix0cI8IcVAFwI0_Jr0_Jr4lYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7xkEbVWUJV W8JwACjcxG0xvY0x0EwIxGrwACjI8F5VA0II8E6IAqYI8I648v4I1lFIxGxcIEc7CjxVA2 Y2ka0xkIwI1l42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4 xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r4a6rW5 MIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I 0E14v26r4j6F4UMIIF0xvE42xK8VAvwI8IcIk0rVWrZr1j6s0DMIIF0xvEx4A2jsIE14v2 6r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x0J UQvtAUUUUU= X-CM-SenderInfo: psxovxtxl6x35dzhxuhorxvhhfrp/ X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE autolearn=ham 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: X-Mailing-List: linux-kernel@vger.kernel.org BPF trampoline is the critical infrastructure of the bpf subsystem, acting as a mediator between kernel functions and BPF programs. Numerous important features, such as using ebpf program for zero overhead kernel introspection, rely on this key component. We can't wait to support bpf trampoline on RV64. The implementation of bpf trampoline was closely to x86 and arm64 for future development. As most of riscv cpu support unaligned memory accesses, we temporarily use patch [1] to facilitate testing. The test results are as follow, and test_verifier with no new failure ceses. - fexit_test:OK - fentry_test:OK - fentry_fexit:OK - fexit_stress:OK - fexit_bpf2bpf:OK - dummy_st_ops:OK - modify_return:OK - get_func_ip_test:OK - get_func_args_test:OK - trampoline_count:OK [1] https://lore.kernel.org/linux-riscv/20210916130855.4054926-2-chenhuang5@huawei.com/ Pu Lehui (4): bpf: Rollback to text_poke when arch not supported ftrace direct call riscv, bpf: Factor out emit_call for kernel and bpf context riscv, bpf: Add bpf_arch_text_poke support for RV64 riscv, bpf: Add bpf trampoline support for RV64 arch/riscv/net/bpf_jit.h | 5 + arch/riscv/net/bpf_jit_comp64.c | 483 ++++++++++++++++++++++++++++++-- kernel/bpf/trampoline.c | 8 +- 3 files changed, 471 insertions(+), 25 deletions(-) -- 2.25.1