From: Björn Töpel <bjorn@kernel.org> Date: 2021-10-28 13:20:47
Unfortunately selftest/bpf does not build for RV64. This series fixes
that.
* JIT requires more iterations to converge
* Some Makefile issues
* bpf_tracing.h was missing RISC-V macros for PT_REGS
More details are in each commit.
There are still many failing tests, but this is a start.
Cheers,
Björn
Björn Töpel (4):
riscv, bpf: Increase the maximum number of iterations
tools build: Add RISC-V to HOSTARCH parsing
riscv, libbpf: Add RISC-V (RV64) support to bpf_tracing.h
selftests/bpf: Fix broken riscv build
arch/riscv/net/bpf_jit_core.c | 2 +-
tools/lib/bpf/bpf_tracing.h | 32 ++++++++++++++++++++++++++++
tools/scripts/Makefile.arch | 3 ++-
tools/testing/selftests/bpf/Makefile | 3 ++-
4 files changed, 37 insertions(+), 3 deletions(-)
base-commit: b066abba3ef16a4a085d237e95da0de3f0b87713
--
2.32.0
From: Björn Töpel <bjorn@kernel.org> Date: 2021-10-28 13:20:49
Now that BPF programs can be up to 1M instructions, it is not uncommon
that a program requires more than the current 16 iterations to
converge.
Bump it to 32, which is enough for selftests/bpf, and test_bpf.ko.
Signed-off-by: Björn Töpel <bjorn@kernel.org>
---
arch/riscv/net/bpf_jit_core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -11,7 +11,7 @@#include"bpf_jit.h"/* Number of iterations to try until offsets converge. */-#define NR_JIT_ITERATIONS 16+#define NR_JIT_ITERATIONS 32staticintbuild_body(structrv_jit_context*ctx,boolextra_pass,int*offset){
From: Björn Töpel <bjorn@kernel.org> Date: 2021-10-28 13:20:53
Add RISC-V to the HOSTARCH parsing, so that ARCH is "riscv", and not
"riscv32" or "riscv64".
This affects the perf and libbpf builds, so that arch specific
includes are correctly picked up for RISC-V.
Signed-off-by: Björn Töpel <bjorn@kernel.org>
---
tools/scripts/Makefile.arch | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
@@ -24,6 +24,9 @@#elif defined(__TARGET_ARCH_sparc)#define bpf_target_sparc#define bpf_target_defined+#elif defined(__TARGET_ARCH_riscv)+#define bpf_target_riscv+#define bpf_target_defined#else/* Fall back to what the compiler says */
From: Björn Töpel <bjorn@kernel.org> Date: 2021-10-28 13:20:57
This patch is closely related to commit 6016df8fe874 ("selftests/bpf:
Fix broken riscv build"). When clang includes the system include
directories, but targeting BPF program, __BITS_PER_LONG defaults to
32, unless explicitly set. Workaround this problem, by explicitly
setting __BITS_PER_LONG to __riscv_xlen.
Signed-off-by: Björn Töpel <bjorn@kernel.org>
---
tools/testing/selftests/bpf/Makefile | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
From: Björn Töpel <hidden> Date: 2021-10-28 15:59:00
On Thu, 28 Oct 2021 at 15:20, Björn Töpel [off-list ref] wrote:
quoted hunk
This patch is closely related to commit 6016df8fe874 ("selftests/bpf:
Fix broken riscv build"). When clang includes the system include
directories, but targeting BPF program, __BITS_PER_LONG defaults to
32, unless explicitly set. Workaround this problem, by explicitly
setting __BITS_PER_LONG to __riscv_xlen.
Signed-off-by: Björn Töpel <bjorn@kernel.org>
---
tools/testing/selftests/bpf/Makefile | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)