Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp2521060rwj; Mon, 19 Dec 2022 05:48:45 -0800 (PST) X-Google-Smtp-Source: AA0mqf5eJHLCATBf9baE6E4QcipoZj0vXYxvZ5oygHNorWXvCAEKI4NEQHuBF4anVbbCV4KEAQnE X-Received: by 2002:a17:90a:4685:b0:221:71fb:387a with SMTP id z5-20020a17090a468500b0022171fb387amr27680745pjf.40.1671457725615; Mon, 19 Dec 2022 05:48:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671457725; cv=none; d=google.com; s=arc-20160816; b=Rg0+Oz86oODDSh065OpJ/h9H0ta4/t0ovD8V3foP6GB+wP9uB1NC3Y61YwiPFlMa34 VjWi4qC3bzYT3vz4/L1LM8QCePM1IwcsnxC9qGRZQIejpXcsG1qrY2bz1mCzI/Xcd2pD 1O1w6cTaDvSrEHpwmfSokkLqTMYDrZlgDv6ySZkrX5pW/RRI7EVinPHfQ0Ad/4EAbuNP ym9rU++qYMX7UFRyOUjuIOmZdtSrMG1rCMDSIfuYqu1ZIEyRI/FI1Rg5aCqS28I4L8/I icbam3Sxo2DzLPi0qINDr54o0GyeOCxik3n5Y7oJo1HkJqVpsKTzmVYn370KDkb5MgVn 3Yiw== 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=qLKcf/jcLQMLsqtxDF7537OGV0uq77y8LtI7jmtLQq8=; b=UPzuf86ezWE40hFfA0s5CX7KxO32qmJgns4XibujB/usgdPM40ROYXIxsSGg2E55GV cqjx6slfKmX+tbFpsFfq4MnDMSIHZY84bpWnbOLa91DtKshcNpeSsKj8qyJMRS0uSse/ fm2kJLqCYNFbrVA9vngt4tUzv+OzUz/QZ4i8BxEzScYz3uCTWpkOYUeYSvUtOLK8LzFG YkIr77HUrQ+5PcNKytem3cnRxkbEqQv3ymsqGA9iaLx9qHwEO6zimo3N0WrpC+r833oA rj4vgzFB5DgCF47NXx1Yd4aEAe7jn16J2T/G9/pAHVFFLmheSzjQ3Q27F71gHqgkSIrC awLw== 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 c14-20020a17090abf0e00b002193e1a906esi15579292pjs.133.2022.12.19.05.48.36; Mon, 19 Dec 2022 05:48:45 -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 S232140AbiLSNgu (ORCPT + 70 others); Mon, 19 Dec 2022 08:36:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231786AbiLSNgg (ORCPT ); Mon, 19 Dec 2022 08:36:36 -0500 Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1E632605; Mon, 19 Dec 2022 05:36:34 -0800 (PST) Received: from mail02.huawei.com (unknown [172.30.67.169]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4NbLMc1NDtz4f3jqP; Mon, 19 Dec 2022 21:36:28 +0800 (CST) Received: from localhost.localdomain (unknown [10.67.175.61]) by APP2 (Coremail) with SMTP id Syh0CgAH++jcaKBjpueTAA--.19298S2; Mon, 19 Dec 2022 21:36:29 +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?= , 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 bpf-next 0/4] Support bpf trampoline for RV64 Date: Mon, 19 Dec 2022 21:37:32 +0800 Message-Id: <20221219133736.1387008-1-pulehui@huaweicloud.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: Syh0CgAH++jcaKBjpueTAA--.19298S2 X-Coremail-Antispam: 1UD129KBjvJXoW7tw17GrWfJw4xAF4fArWDurg_yoW8Gryfpa yFkry3CFyDXFy7Jwnaqa1UZ3WFv3ykX3W3Gw13J3yrCan8Xry7Jr1Yga15t34rCFyfu3WU trn0qF4jkas8Aa7anT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUvF14x267AKxVW5JVWrJwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26w1j6s0DM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r4U JVWxJr1l84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_Gc CE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E 2Ix0cI8IcVAFwI0_Jr0_Jr4lYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7xkEbVWUJV W8JwACjcxG0xvY0x0EwIxGrwACjI8F5VA0II8E6IAqYI8I648v4I1lFIxGxcIEc7CjxVA2 Y2ka0xkIwI1l42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4 xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r4a6rW5 MIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I 0E14v26r4j6F4UMIIF0xvE42xK8VAvwI8IcIk0rVWrJr0_WFyUJwCI42IY6I8E87Iv67AK xVWUJVW8JwCI42IY6I8E87Iv6xkF7I0E14v26r4j6r4UJbIYCTnIWIevJa73UjIFyTuYvj fUOmhFUUUUU 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 | 484 ++++++++++++++++++++++++++++++-- kernel/bpf/trampoline.c | 8 +- 3 files changed, 472 insertions(+), 25 deletions(-) -- 2.25.1