From patchwork Wed Apr 3 04:17:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pu Lehui X-Patchwork-Id: 13614933 Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DFEDD40BE3; Wed, 3 Apr 2024 04:15:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712117753; cv=none; b=OiPYe2UBJdlotlmx5coXRalHi7FA/Lh4kn4vwlGz/DDHYSopD3Rqypz/rKnAbOBFHhKnqi9snOFxQaMzTD/2aYHaBaFcXHeUUJ1KjGQt2ZKSxUrigLzj/KsU4b6yHt0VslhvgO7vq9+g4+j2sWq4d8xktKSLjxHIyXRir0QD64Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712117753; c=relaxed/simple; bh=7F3qFy1UYpC9OdDKNs6SXP91GcMqokhWtUcvT/4lnLE=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Content-Type; b=Tow8iN8c5ijUhI+reKoF18hSmQhhkXL7YNuBi3zsX8dKKkqEinOAtGNuSxv0F5FHi6gYTb47i0/CXxOdiQXsVXJiFZD0ZhYmRljczaLXQWmvhxuaSE0Hvph5YdZt+sd3EjjyMhauNDJHP2/vb40Vm8CKGhwgcFIEGXQYkCHEOIA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.163.216]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4V8WdB4cJrz4f3kKX; Wed, 3 Apr 2024 12:15:42 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id D83F31A08FC; Wed, 3 Apr 2024 12:15:46 +0800 (CST) Received: from ultra.huawei.com (unknown [10.90.53.71]) by APP1 (Coremail) with SMTP id cCh0CgB3lA3y1wxmBsSZIw--.36823S2; Wed, 03 Apr 2024 12:15:46 +0800 (CST) From: Pu Lehui To: bpf@vger.kernel.org, linux-riscv@lists.infradead.org, netdev@vger.kernel.org Cc: =?utf-8?b?QmrDtnJuIFTDtnBlbA==?= , 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 , Pu Lehui , Pu Lehui Subject: [PATCH bpf-next v2 0/2] Add 12-argument support for RV64 bpf trampoline Date: Wed, 3 Apr 2024 04:17:08 +0000 Message-Id: <20240403041710.1416369-1-pulehui@huaweicloud.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-CM-TRANSID: cCh0CgB3lA3y1wxmBsSZIw--.36823S2 X-Coremail-Antispam: 1UD129KBjvJXoW7CF45KF1xuF4fXryktF4fXwb_yoW8WFyfpa 1xWr1fuFnYgF4aqry7Ja1UWryFqrWru345Ca17G34F9ayDtrW5AF1I9a4Yy345Wrn5u3y0 v343Kry5GF1DZ3DanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUvj14x267AKxVW5JVWrJwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26F1j6w1UM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26F4j 6r4UJwA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x0267AKxVW0oV Cq3wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0 I7IYx2IY67AKxVWUGVWUXwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r 4UM4x0Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwACI402YVCY1x02628v n2kIc2xKxwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F4 0E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_GFv_Wryl IxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxV AFwI0_Gr0_Cr1lIxAIcVCF04k26cxKx2IYs7xG6Fyj6rWUJwCI42IY6I8E87Iv67AKxVWU JVW8JwCI42IY6I8E87Iv6xkF7I0E14v26r4j6r4UJbIYCTnIWIevJa73UjIFyTuYvjfUF0 eHDUUUU X-CM-SenderInfo: psxovxtxl6x35dzhxuhorxvhhfrp/ X-Patchwork-Delegate: bpf@iogearbox.net 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] v2: - 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 (2): riscv, bpf: Add 12-argument support for RV64 bpf trampoline selftests/bpf: Add testcase where 7th argment is struct arch/riscv/net/bpf_jit_comp64.c | 65 +++++++++++++------ tools/testing/selftests/bpf/DENYLIST.aarch64 | 1 + .../selftests/bpf/bpf_testmod/bpf_testmod.c | 19 ++++++ .../selftests/bpf/prog_tests/tracing_struct.c | 13 ++++ .../selftests/bpf/progs/tracing_struct.c | 35 ++++++++++ 5 files changed, 114 insertions(+), 19 deletions(-)