Message ID | 20231026184337.563801-9-hengqi.chen@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Delegated to: | BPF |
Headers | show |
Series | bpf: Support cpu v4 instructions for LoongArch | expand |
Hi, Hengqi, On Fri, Oct 27, 2023 at 2:01 PM Hengqi Chen <hengqi.chen@gmail.com> wrote: > > Enable cpu v4 tests for LoongArch. Currently, we don't > have BPF trampoline in LoongArch JIT, so the fentry > test `test_ptr_struct_arg` still failed, will followup. > Test result attached below: > > # ./test_progs -t verifier_sdiv,verifier_movsx,verifier_ldsx,verifier_gotol,verifier_bswap > #316/1 verifier_bswap/BSWAP, 16:OK > #316/2 verifier_bswap/BSWAP, 16 @unpriv:OK > #316/3 verifier_bswap/BSWAP, 32:OK > #316/4 verifier_bswap/BSWAP, 32 @unpriv:OK > #316/5 verifier_bswap/BSWAP, 64:OK > #316/6 verifier_bswap/BSWAP, 64 @unpriv:OK > #316 verifier_bswap:OK > #330/1 verifier_gotol/gotol, small_imm:OK > #330/2 verifier_gotol/gotol, small_imm @unpriv:OK > #330 verifier_gotol:OK > #338/1 verifier_ldsx/LDSX, S8:OK > #338/2 verifier_ldsx/LDSX, S8 @unpriv:OK > #338/3 verifier_ldsx/LDSX, S16:OK > #338/4 verifier_ldsx/LDSX, S16 @unpriv:OK > #338/5 verifier_ldsx/LDSX, S32:OK > #338/6 verifier_ldsx/LDSX, S32 @unpriv:OK > #338/7 verifier_ldsx/LDSX, S8 range checking, privileged:OK > #338/8 verifier_ldsx/LDSX, S16 range checking:OK > #338/9 verifier_ldsx/LDSX, S16 range checking @unpriv:OK > #338/10 verifier_ldsx/LDSX, S32 range checking:OK > #338/11 verifier_ldsx/LDSX, S32 range checking @unpriv:OK > #338 verifier_ldsx:OK > #349/1 verifier_movsx/MOV32SX, S8:OK > #349/2 verifier_movsx/MOV32SX, S8 @unpriv:OK > #349/3 verifier_movsx/MOV32SX, S16:OK > #349/4 verifier_movsx/MOV32SX, S16 @unpriv:OK > #349/5 verifier_movsx/MOV64SX, S8:OK > #349/6 verifier_movsx/MOV64SX, S8 @unpriv:OK > #349/7 verifier_movsx/MOV64SX, S16:OK > #349/8 verifier_movsx/MOV64SX, S16 @unpriv:OK > #349/9 verifier_movsx/MOV64SX, S32:OK > #349/10 verifier_movsx/MOV64SX, S32 @unpriv:OK > #349/11 verifier_movsx/MOV32SX, S8, range_check:OK > #349/12 verifier_movsx/MOV32SX, S8, range_check @unpriv:OK > #349/13 verifier_movsx/MOV32SX, S16, range_check:OK > #349/14 verifier_movsx/MOV32SX, S16, range_check @unpriv:OK > #349/15 verifier_movsx/MOV32SX, S16, range_check 2:OK > #349/16 verifier_movsx/MOV32SX, S16, range_check 2 @unpriv:OK > #349/17 verifier_movsx/MOV64SX, S8, range_check:OK > #349/18 verifier_movsx/MOV64SX, S8, range_check @unpriv:OK > #349/19 verifier_movsx/MOV64SX, S16, range_check:OK > #349/20 verifier_movsx/MOV64SX, S16, range_check @unpriv:OK > #349/21 verifier_movsx/MOV64SX, S32, range_check:OK > #349/22 verifier_movsx/MOV64SX, S32, range_check @unpriv:OK > #349/23 verifier_movsx/MOV64SX, S16, R10 Sign Extension:OK > #349/24 verifier_movsx/MOV64SX, S16, R10 Sign Extension @unpriv:OK > #349 verifier_movsx:OK > #361/1 verifier_sdiv/SDIV32, non-zero imm divisor, check 1:OK > #361/2 verifier_sdiv/SDIV32, non-zero imm divisor, check 1 @unpriv:OK > #361/3 verifier_sdiv/SDIV32, non-zero imm divisor, check 2:OK > #361/4 verifier_sdiv/SDIV32, non-zero imm divisor, check 2 @unpriv:OK > #361/5 verifier_sdiv/SDIV32, non-zero imm divisor, check 3:OK > #361/6 verifier_sdiv/SDIV32, non-zero imm divisor, check 3 @unpriv:OK > #361/7 verifier_sdiv/SDIV32, non-zero imm divisor, check 4:OK > #361/8 verifier_sdiv/SDIV32, non-zero imm divisor, check 4 @unpriv:OK > #361/9 verifier_sdiv/SDIV32, non-zero imm divisor, check 5:OK > #361/10 verifier_sdiv/SDIV32, non-zero imm divisor, check 5 @unpriv:OK > #361/11 verifier_sdiv/SDIV32, non-zero imm divisor, check 6:OK > #361/12 verifier_sdiv/SDIV32, non-zero imm divisor, check 6 @unpriv:OK > #361/13 verifier_sdiv/SDIV32, non-zero imm divisor, check 7:OK > #361/14 verifier_sdiv/SDIV32, non-zero imm divisor, check 7 @unpriv:OK > #361/15 verifier_sdiv/SDIV32, non-zero imm divisor, check 8:OK > #361/16 verifier_sdiv/SDIV32, non-zero imm divisor, check 8 @unpriv:OK > #361/17 verifier_sdiv/SDIV32, non-zero reg divisor, check 1:OK > #361/18 verifier_sdiv/SDIV32, non-zero reg divisor, check 1 @unpriv:OK > #361/19 verifier_sdiv/SDIV32, non-zero reg divisor, check 2:OK > #361/20 verifier_sdiv/SDIV32, non-zero reg divisor, check 2 @unpriv:OK > #361/21 verifier_sdiv/SDIV32, non-zero reg divisor, check 3:OK > #361/22 verifier_sdiv/SDIV32, non-zero reg divisor, check 3 @unpriv:OK > #361/23 verifier_sdiv/SDIV32, non-zero reg divisor, check 4:OK > #361/24 verifier_sdiv/SDIV32, non-zero reg divisor, check 4 @unpriv:OK > #361/25 verifier_sdiv/SDIV32, non-zero reg divisor, check 5:OK > #361/26 verifier_sdiv/SDIV32, non-zero reg divisor, check 5 @unpriv:OK > #361/27 verifier_sdiv/SDIV32, non-zero reg divisor, check 6:OK > #361/28 verifier_sdiv/SDIV32, non-zero reg divisor, check 6 @unpriv:OK > #361/29 verifier_sdiv/SDIV32, non-zero reg divisor, check 7:OK > #361/30 verifier_sdiv/SDIV32, non-zero reg divisor, check 7 @unpriv:OK > #361/31 verifier_sdiv/SDIV32, non-zero reg divisor, check 8:OK > #361/32 verifier_sdiv/SDIV32, non-zero reg divisor, check 8 @unpriv:OK > #361/33 verifier_sdiv/SDIV64, non-zero imm divisor, check 1:OK > #361/34 verifier_sdiv/SDIV64, non-zero imm divisor, check 1 @unpriv:OK > #361/35 verifier_sdiv/SDIV64, non-zero imm divisor, check 2:OK > #361/36 verifier_sdiv/SDIV64, non-zero imm divisor, check 2 @unpriv:OK > #361/37 verifier_sdiv/SDIV64, non-zero imm divisor, check 3:OK > #361/38 verifier_sdiv/SDIV64, non-zero imm divisor, check 3 @unpriv:OK > #361/39 verifier_sdiv/SDIV64, non-zero imm divisor, check 4:OK > #361/40 verifier_sdiv/SDIV64, non-zero imm divisor, check 4 @unpriv:OK > #361/41 verifier_sdiv/SDIV64, non-zero imm divisor, check 5:OK > #361/42 verifier_sdiv/SDIV64, non-zero imm divisor, check 5 @unpriv:OK > #361/43 verifier_sdiv/SDIV64, non-zero imm divisor, check 6:OK > #361/44 verifier_sdiv/SDIV64, non-zero imm divisor, check 6 @unpriv:OK > #361/45 verifier_sdiv/SDIV64, non-zero reg divisor, check 1:OK > #361/46 verifier_sdiv/SDIV64, non-zero reg divisor, check 1 @unpriv:OK > #361/47 verifier_sdiv/SDIV64, non-zero reg divisor, check 2:OK > #361/48 verifier_sdiv/SDIV64, non-zero reg divisor, check 2 @unpriv:OK > #361/49 verifier_sdiv/SDIV64, non-zero reg divisor, check 3:OK > #361/50 verifier_sdiv/SDIV64, non-zero reg divisor, check 3 @unpriv:OK > #361/51 verifier_sdiv/SDIV64, non-zero reg divisor, check 4:OK > #361/52 verifier_sdiv/SDIV64, non-zero reg divisor, check 4 @unpriv:OK > #361/53 verifier_sdiv/SDIV64, non-zero reg divisor, check 5:OK > #361/54 verifier_sdiv/SDIV64, non-zero reg divisor, check 5 @unpriv:OK > #361/55 verifier_sdiv/SDIV64, non-zero reg divisor, check 6:OK > #361/56 verifier_sdiv/SDIV64, non-zero reg divisor, check 6 @unpriv:OK > #361/57 verifier_sdiv/SMOD32, non-zero imm divisor, check 1:OK > #361/58 verifier_sdiv/SMOD32, non-zero imm divisor, check 1 @unpriv:OK > #361/59 verifier_sdiv/SMOD32, non-zero imm divisor, check 2:OK > #361/60 verifier_sdiv/SMOD32, non-zero imm divisor, check 2 @unpriv:OK > #361/61 verifier_sdiv/SMOD32, non-zero imm divisor, check 3:OK > #361/62 verifier_sdiv/SMOD32, non-zero imm divisor, check 3 @unpriv:OK > #361/63 verifier_sdiv/SMOD32, non-zero imm divisor, check 4:OK > #361/64 verifier_sdiv/SMOD32, non-zero imm divisor, check 4 @unpriv:OK > #361/65 verifier_sdiv/SMOD32, non-zero imm divisor, check 5:OK > #361/66 verifier_sdiv/SMOD32, non-zero imm divisor, check 5 @unpriv:OK > #361/67 verifier_sdiv/SMOD32, non-zero imm divisor, check 6:OK > #361/68 verifier_sdiv/SMOD32, non-zero imm divisor, check 6 @unpriv:OK > #361/69 verifier_sdiv/SMOD32, non-zero reg divisor, check 1:OK > #361/70 verifier_sdiv/SMOD32, non-zero reg divisor, check 1 @unpriv:OK > #361/71 verifier_sdiv/SMOD32, non-zero reg divisor, check 2:OK > #361/72 verifier_sdiv/SMOD32, non-zero reg divisor, check 2 @unpriv:OK > #361/73 verifier_sdiv/SMOD32, non-zero reg divisor, check 3:OK > #361/74 verifier_sdiv/SMOD32, non-zero reg divisor, check 3 @unpriv:OK > #361/75 verifier_sdiv/SMOD32, non-zero reg divisor, check 4:OK > #361/76 verifier_sdiv/SMOD32, non-zero reg divisor, check 4 @unpriv:OK > #361/77 verifier_sdiv/SMOD32, non-zero reg divisor, check 5:OK > #361/78 verifier_sdiv/SMOD32, non-zero reg divisor, check 5 @unpriv:OK > #361/79 verifier_sdiv/SMOD32, non-zero reg divisor, check 6:OK > #361/80 verifier_sdiv/SMOD32, non-zero reg divisor, check 6 @unpriv:OK > #361/81 verifier_sdiv/SMOD64, non-zero imm divisor, check 1:OK > #361/82 verifier_sdiv/SMOD64, non-zero imm divisor, check 1 @unpriv:OK > #361/83 verifier_sdiv/SMOD64, non-zero imm divisor, check 2:OK > #361/84 verifier_sdiv/SMOD64, non-zero imm divisor, check 2 @unpriv:OK > #361/85 verifier_sdiv/SMOD64, non-zero imm divisor, check 3:OK > #361/86 verifier_sdiv/SMOD64, non-zero imm divisor, check 3 @unpriv:OK > #361/87 verifier_sdiv/SMOD64, non-zero imm divisor, check 4:OK > #361/88 verifier_sdiv/SMOD64, non-zero imm divisor, check 4 @unpriv:OK > #361/89 verifier_sdiv/SMOD64, non-zero imm divisor, check 5:OK > #361/90 verifier_sdiv/SMOD64, non-zero imm divisor, check 5 @unpriv:OK > #361/91 verifier_sdiv/SMOD64, non-zero imm divisor, check 6:OK > #361/92 verifier_sdiv/SMOD64, non-zero imm divisor, check 6 @unpriv:OK > #361/93 verifier_sdiv/SMOD64, non-zero imm divisor, check 7:OK > #361/94 verifier_sdiv/SMOD64, non-zero imm divisor, check 7 @unpriv:OK > #361/95 verifier_sdiv/SMOD64, non-zero imm divisor, check 8:OK > #361/96 verifier_sdiv/SMOD64, non-zero imm divisor, check 8 @unpriv:OK > #361/97 verifier_sdiv/SMOD64, non-zero reg divisor, check 1:OK > #361/98 verifier_sdiv/SMOD64, non-zero reg divisor, check 1 @unpriv:OK > #361/99 verifier_sdiv/SMOD64, non-zero reg divisor, check 2:OK > #361/100 verifier_sdiv/SMOD64, non-zero reg divisor, check 2 @unpriv:OK > #361/101 verifier_sdiv/SMOD64, non-zero reg divisor, check 3:OK > #361/102 verifier_sdiv/SMOD64, non-zero reg divisor, check 3 @unpriv:OK > #361/103 verifier_sdiv/SMOD64, non-zero reg divisor, check 4:OK > #361/104 verifier_sdiv/SMOD64, non-zero reg divisor, check 4 @unpriv:OK > #361/105 verifier_sdiv/SMOD64, non-zero reg divisor, check 5:OK > #361/106 verifier_sdiv/SMOD64, non-zero reg divisor, check 5 @unpriv:OK > #361/107 verifier_sdiv/SMOD64, non-zero reg divisor, check 6:OK > #361/108 verifier_sdiv/SMOD64, non-zero reg divisor, check 6 @unpriv:OK > #361/109 verifier_sdiv/SMOD64, non-zero reg divisor, check 7:OK > #361/110 verifier_sdiv/SMOD64, non-zero reg divisor, check 7 @unpriv:OK > #361/111 verifier_sdiv/SMOD64, non-zero reg divisor, check 8:OK > #361/112 verifier_sdiv/SMOD64, non-zero reg divisor, check 8 @unpriv:OK > #361/113 verifier_sdiv/SDIV32, zero divisor:OK > #361/114 verifier_sdiv/SDIV32, zero divisor @unpriv:OK > #361/115 verifier_sdiv/SDIV64, zero divisor:OK > #361/116 verifier_sdiv/SDIV64, zero divisor @unpriv:OK > #361/117 verifier_sdiv/SMOD32, zero divisor:OK > #361/118 verifier_sdiv/SMOD32, zero divisor @unpriv:OK > #361/119 verifier_sdiv/SMOD64, zero divisor:OK > #361/120 verifier_sdiv/SMOD64, zero divisor @unpriv:OK > #361 verifier_sdiv:OK > Summary: 5/163 PASSED, 0 SKIPPED, 0 FAILED > > # ./test_progs -t ldsx_insn > test_map_val_and_probed_memory:PASS:test_ldsx_insn__open 0 nsec > test_map_val_and_probed_memory:PASS:test_ldsx_insn__load 0 nsec > libbpf: prog 'test_ptr_struct_arg': failed to attach: ERROR: strerror_r(-524)=22 > libbpf: prog 'test_ptr_struct_arg': failed to auto-attach: -524 > test_map_val_and_probed_memory:FAIL:test_ldsx_insn__attach unexpected error: -524 (errno 524) > #116/1 ldsx_insn/map_val and probed_memory:FAIL > #116/2 ldsx_insn/ctx_member_sign_ext:OK > #116/3 ldsx_insn/ctx_member_narrow_sign_ext:OK > #116 ldsx_insn:FAIL Thank you for your effort, but why is there a failure? Can it be solved? Huacai > > All error logs: > test_map_val_and_probed_memory:PASS:test_ldsx_insn__open 0 nsec > test_map_val_and_probed_memory:PASS:test_ldsx_insn__load 0 nsec > libbpf: prog 'test_ptr_struct_arg': failed to attach: ERROR: strerror_r(-524)=22 > libbpf: prog 'test_ptr_struct_arg': failed to auto-attach: -524 > test_map_val_and_probed_memory:FAIL:test_ldsx_insn__attach unexpected error: -524 (errno 524) > #116/1 ldsx_insn/map_val and probed_memory:FAIL > #116 ldsx_insn:FAIL > Summary: 0/2 PASSED, 0 SKIPPED, 1 FAILED > > Signed-off-by: Hengqi Chen <hengqi.chen@gmail.com> > --- > tools/testing/selftests/bpf/progs/test_ldsx_insn.c | 3 ++- > tools/testing/selftests/bpf/progs/verifier_bswap.c | 3 ++- > tools/testing/selftests/bpf/progs/verifier_gotol.c | 3 ++- > tools/testing/selftests/bpf/progs/verifier_ldsx.c | 3 ++- > tools/testing/selftests/bpf/progs/verifier_movsx.c | 3 ++- > tools/testing/selftests/bpf/progs/verifier_sdiv.c | 3 ++- > 6 files changed, 12 insertions(+), 6 deletions(-) > > diff --git a/tools/testing/selftests/bpf/progs/test_ldsx_insn.c b/tools/testing/selftests/bpf/progs/test_ldsx_insn.c > index 3ddcb3777912..2a2a942737d7 100644 > --- a/tools/testing/selftests/bpf/progs/test_ldsx_insn.c > +++ b/tools/testing/selftests/bpf/progs/test_ldsx_insn.c > @@ -7,7 +7,8 @@ > > #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ > (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ > - defined(__TARGET_ARCH_s390)) && __clang_major__ >= 18 > + defined(__TARGET_ARCH_s390) || defined(__TARGET_ARCH_loongarch)) && \ > + __clang_major__ >= 18 > const volatile int skip = 0; > #else > const volatile int skip = 1; > diff --git a/tools/testing/selftests/bpf/progs/verifier_bswap.c b/tools/testing/selftests/bpf/progs/verifier_bswap.c > index 107525fb4a6a..e61755656e8d 100644 > --- a/tools/testing/selftests/bpf/progs/verifier_bswap.c > +++ b/tools/testing/selftests/bpf/progs/verifier_bswap.c > @@ -6,7 +6,8 @@ > > #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ > (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ > - defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390)) && \ > + defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390) || \ > + defined(__TARGET_ARCH_loongarch)) && \ > __clang_major__ >= 18 > > SEC("socket") > diff --git a/tools/testing/selftests/bpf/progs/verifier_gotol.c b/tools/testing/selftests/bpf/progs/verifier_gotol.c > index 9f202eda952f..d1edbcff9a18 100644 > --- a/tools/testing/selftests/bpf/progs/verifier_gotol.c > +++ b/tools/testing/selftests/bpf/progs/verifier_gotol.c > @@ -6,7 +6,8 @@ > > #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ > (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ > - defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390)) && \ > + defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390) || \ > + defined(__TARGET_ARCH_loongarch)) && \ > __clang_major__ >= 18 > > SEC("socket") > diff --git a/tools/testing/selftests/bpf/progs/verifier_ldsx.c b/tools/testing/selftests/bpf/progs/verifier_ldsx.c > index 375525329637..d4427d8e1217 100644 > --- a/tools/testing/selftests/bpf/progs/verifier_ldsx.c > +++ b/tools/testing/selftests/bpf/progs/verifier_ldsx.c > @@ -6,7 +6,8 @@ > > #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ > (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ > - defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390)) && \ > + defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390) || \ > + defined(__TARGET_ARCH_loongarch)) && \ > __clang_major__ >= 18 > > SEC("socket") > diff --git a/tools/testing/selftests/bpf/progs/verifier_movsx.c b/tools/testing/selftests/bpf/progs/verifier_movsx.c > index b2a04d1179d0..cbb9d6714f53 100644 > --- a/tools/testing/selftests/bpf/progs/verifier_movsx.c > +++ b/tools/testing/selftests/bpf/progs/verifier_movsx.c > @@ -6,7 +6,8 @@ > > #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ > (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ > - defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390)) && \ > + defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390) || \ > + defined(__TARGET_ARCH_loongarch)) && \ > __clang_major__ >= 18 > > SEC("socket") > diff --git a/tools/testing/selftests/bpf/progs/verifier_sdiv.c b/tools/testing/selftests/bpf/progs/verifier_sdiv.c > index 8fc5174808b2..2a2271cf0294 100644 > --- a/tools/testing/selftests/bpf/progs/verifier_sdiv.c > +++ b/tools/testing/selftests/bpf/progs/verifier_sdiv.c > @@ -6,7 +6,8 @@ > > #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ > (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ > - defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390)) && \ > + defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390) || \ > + defined(__TARGET_ARCH_loongarch)) && \ > __clang_major__ >= 18 > > SEC("socket") > -- > 2.34.1 >
On Fri, Oct 27, 2023 at 3:05 PM Huacai Chen <chenhuacai@kernel.org> wrote: > > Hi, Hengqi, > > On Fri, Oct 27, 2023 at 2:01 PM Hengqi Chen <hengqi.chen@gmail.com> wrote: > > > > Enable cpu v4 tests for LoongArch. Currently, we don't > > have BPF trampoline in LoongArch JIT, so the fentry > > test `test_ptr_struct_arg` still failed, will followup. > > Test result attached below: > > > > # ./test_progs -t verifier_sdiv,verifier_movsx,verifier_ldsx,verifier_gotol,verifier_bswap > > #316/1 verifier_bswap/BSWAP, 16:OK > > #316/2 verifier_bswap/BSWAP, 16 @unpriv:OK > > #316/3 verifier_bswap/BSWAP, 32:OK > > #316/4 verifier_bswap/BSWAP, 32 @unpriv:OK > > #316/5 verifier_bswap/BSWAP, 64:OK > > #316/6 verifier_bswap/BSWAP, 64 @unpriv:OK > > #316 verifier_bswap:OK > > #330/1 verifier_gotol/gotol, small_imm:OK > > #330/2 verifier_gotol/gotol, small_imm @unpriv:OK > > #330 verifier_gotol:OK > > #338/1 verifier_ldsx/LDSX, S8:OK > > #338/2 verifier_ldsx/LDSX, S8 @unpriv:OK > > #338/3 verifier_ldsx/LDSX, S16:OK > > #338/4 verifier_ldsx/LDSX, S16 @unpriv:OK > > #338/5 verifier_ldsx/LDSX, S32:OK > > #338/6 verifier_ldsx/LDSX, S32 @unpriv:OK > > #338/7 verifier_ldsx/LDSX, S8 range checking, privileged:OK > > #338/8 verifier_ldsx/LDSX, S16 range checking:OK > > #338/9 verifier_ldsx/LDSX, S16 range checking @unpriv:OK > > #338/10 verifier_ldsx/LDSX, S32 range checking:OK > > #338/11 verifier_ldsx/LDSX, S32 range checking @unpriv:OK > > #338 verifier_ldsx:OK > > #349/1 verifier_movsx/MOV32SX, S8:OK > > #349/2 verifier_movsx/MOV32SX, S8 @unpriv:OK > > #349/3 verifier_movsx/MOV32SX, S16:OK > > #349/4 verifier_movsx/MOV32SX, S16 @unpriv:OK > > #349/5 verifier_movsx/MOV64SX, S8:OK > > #349/6 verifier_movsx/MOV64SX, S8 @unpriv:OK > > #349/7 verifier_movsx/MOV64SX, S16:OK > > #349/8 verifier_movsx/MOV64SX, S16 @unpriv:OK > > #349/9 verifier_movsx/MOV64SX, S32:OK > > #349/10 verifier_movsx/MOV64SX, S32 @unpriv:OK > > #349/11 verifier_movsx/MOV32SX, S8, range_check:OK > > #349/12 verifier_movsx/MOV32SX, S8, range_check @unpriv:OK > > #349/13 verifier_movsx/MOV32SX, S16, range_check:OK > > #349/14 verifier_movsx/MOV32SX, S16, range_check @unpriv:OK > > #349/15 verifier_movsx/MOV32SX, S16, range_check 2:OK > > #349/16 verifier_movsx/MOV32SX, S16, range_check 2 @unpriv:OK > > #349/17 verifier_movsx/MOV64SX, S8, range_check:OK > > #349/18 verifier_movsx/MOV64SX, S8, range_check @unpriv:OK > > #349/19 verifier_movsx/MOV64SX, S16, range_check:OK > > #349/20 verifier_movsx/MOV64SX, S16, range_check @unpriv:OK > > #349/21 verifier_movsx/MOV64SX, S32, range_check:OK > > #349/22 verifier_movsx/MOV64SX, S32, range_check @unpriv:OK > > #349/23 verifier_movsx/MOV64SX, S16, R10 Sign Extension:OK > > #349/24 verifier_movsx/MOV64SX, S16, R10 Sign Extension @unpriv:OK > > #349 verifier_movsx:OK > > #361/1 verifier_sdiv/SDIV32, non-zero imm divisor, check 1:OK > > #361/2 verifier_sdiv/SDIV32, non-zero imm divisor, check 1 @unpriv:OK > > #361/3 verifier_sdiv/SDIV32, non-zero imm divisor, check 2:OK > > #361/4 verifier_sdiv/SDIV32, non-zero imm divisor, check 2 @unpriv:OK > > #361/5 verifier_sdiv/SDIV32, non-zero imm divisor, check 3:OK > > #361/6 verifier_sdiv/SDIV32, non-zero imm divisor, check 3 @unpriv:OK > > #361/7 verifier_sdiv/SDIV32, non-zero imm divisor, check 4:OK > > #361/8 verifier_sdiv/SDIV32, non-zero imm divisor, check 4 @unpriv:OK > > #361/9 verifier_sdiv/SDIV32, non-zero imm divisor, check 5:OK > > #361/10 verifier_sdiv/SDIV32, non-zero imm divisor, check 5 @unpriv:OK > > #361/11 verifier_sdiv/SDIV32, non-zero imm divisor, check 6:OK > > #361/12 verifier_sdiv/SDIV32, non-zero imm divisor, check 6 @unpriv:OK > > #361/13 verifier_sdiv/SDIV32, non-zero imm divisor, check 7:OK > > #361/14 verifier_sdiv/SDIV32, non-zero imm divisor, check 7 @unpriv:OK > > #361/15 verifier_sdiv/SDIV32, non-zero imm divisor, check 8:OK > > #361/16 verifier_sdiv/SDIV32, non-zero imm divisor, check 8 @unpriv:OK > > #361/17 verifier_sdiv/SDIV32, non-zero reg divisor, check 1:OK > > #361/18 verifier_sdiv/SDIV32, non-zero reg divisor, check 1 @unpriv:OK > > #361/19 verifier_sdiv/SDIV32, non-zero reg divisor, check 2:OK > > #361/20 verifier_sdiv/SDIV32, non-zero reg divisor, check 2 @unpriv:OK > > #361/21 verifier_sdiv/SDIV32, non-zero reg divisor, check 3:OK > > #361/22 verifier_sdiv/SDIV32, non-zero reg divisor, check 3 @unpriv:OK > > #361/23 verifier_sdiv/SDIV32, non-zero reg divisor, check 4:OK > > #361/24 verifier_sdiv/SDIV32, non-zero reg divisor, check 4 @unpriv:OK > > #361/25 verifier_sdiv/SDIV32, non-zero reg divisor, check 5:OK > > #361/26 verifier_sdiv/SDIV32, non-zero reg divisor, check 5 @unpriv:OK > > #361/27 verifier_sdiv/SDIV32, non-zero reg divisor, check 6:OK > > #361/28 verifier_sdiv/SDIV32, non-zero reg divisor, check 6 @unpriv:OK > > #361/29 verifier_sdiv/SDIV32, non-zero reg divisor, check 7:OK > > #361/30 verifier_sdiv/SDIV32, non-zero reg divisor, check 7 @unpriv:OK > > #361/31 verifier_sdiv/SDIV32, non-zero reg divisor, check 8:OK > > #361/32 verifier_sdiv/SDIV32, non-zero reg divisor, check 8 @unpriv:OK > > #361/33 verifier_sdiv/SDIV64, non-zero imm divisor, check 1:OK > > #361/34 verifier_sdiv/SDIV64, non-zero imm divisor, check 1 @unpriv:OK > > #361/35 verifier_sdiv/SDIV64, non-zero imm divisor, check 2:OK > > #361/36 verifier_sdiv/SDIV64, non-zero imm divisor, check 2 @unpriv:OK > > #361/37 verifier_sdiv/SDIV64, non-zero imm divisor, check 3:OK > > #361/38 verifier_sdiv/SDIV64, non-zero imm divisor, check 3 @unpriv:OK > > #361/39 verifier_sdiv/SDIV64, non-zero imm divisor, check 4:OK > > #361/40 verifier_sdiv/SDIV64, non-zero imm divisor, check 4 @unpriv:OK > > #361/41 verifier_sdiv/SDIV64, non-zero imm divisor, check 5:OK > > #361/42 verifier_sdiv/SDIV64, non-zero imm divisor, check 5 @unpriv:OK > > #361/43 verifier_sdiv/SDIV64, non-zero imm divisor, check 6:OK > > #361/44 verifier_sdiv/SDIV64, non-zero imm divisor, check 6 @unpriv:OK > > #361/45 verifier_sdiv/SDIV64, non-zero reg divisor, check 1:OK > > #361/46 verifier_sdiv/SDIV64, non-zero reg divisor, check 1 @unpriv:OK > > #361/47 verifier_sdiv/SDIV64, non-zero reg divisor, check 2:OK > > #361/48 verifier_sdiv/SDIV64, non-zero reg divisor, check 2 @unpriv:OK > > #361/49 verifier_sdiv/SDIV64, non-zero reg divisor, check 3:OK > > #361/50 verifier_sdiv/SDIV64, non-zero reg divisor, check 3 @unpriv:OK > > #361/51 verifier_sdiv/SDIV64, non-zero reg divisor, check 4:OK > > #361/52 verifier_sdiv/SDIV64, non-zero reg divisor, check 4 @unpriv:OK > > #361/53 verifier_sdiv/SDIV64, non-zero reg divisor, check 5:OK > > #361/54 verifier_sdiv/SDIV64, non-zero reg divisor, check 5 @unpriv:OK > > #361/55 verifier_sdiv/SDIV64, non-zero reg divisor, check 6:OK > > #361/56 verifier_sdiv/SDIV64, non-zero reg divisor, check 6 @unpriv:OK > > #361/57 verifier_sdiv/SMOD32, non-zero imm divisor, check 1:OK > > #361/58 verifier_sdiv/SMOD32, non-zero imm divisor, check 1 @unpriv:OK > > #361/59 verifier_sdiv/SMOD32, non-zero imm divisor, check 2:OK > > #361/60 verifier_sdiv/SMOD32, non-zero imm divisor, check 2 @unpriv:OK > > #361/61 verifier_sdiv/SMOD32, non-zero imm divisor, check 3:OK > > #361/62 verifier_sdiv/SMOD32, non-zero imm divisor, check 3 @unpriv:OK > > #361/63 verifier_sdiv/SMOD32, non-zero imm divisor, check 4:OK > > #361/64 verifier_sdiv/SMOD32, non-zero imm divisor, check 4 @unpriv:OK > > #361/65 verifier_sdiv/SMOD32, non-zero imm divisor, check 5:OK > > #361/66 verifier_sdiv/SMOD32, non-zero imm divisor, check 5 @unpriv:OK > > #361/67 verifier_sdiv/SMOD32, non-zero imm divisor, check 6:OK > > #361/68 verifier_sdiv/SMOD32, non-zero imm divisor, check 6 @unpriv:OK > > #361/69 verifier_sdiv/SMOD32, non-zero reg divisor, check 1:OK > > #361/70 verifier_sdiv/SMOD32, non-zero reg divisor, check 1 @unpriv:OK > > #361/71 verifier_sdiv/SMOD32, non-zero reg divisor, check 2:OK > > #361/72 verifier_sdiv/SMOD32, non-zero reg divisor, check 2 @unpriv:OK > > #361/73 verifier_sdiv/SMOD32, non-zero reg divisor, check 3:OK > > #361/74 verifier_sdiv/SMOD32, non-zero reg divisor, check 3 @unpriv:OK > > #361/75 verifier_sdiv/SMOD32, non-zero reg divisor, check 4:OK > > #361/76 verifier_sdiv/SMOD32, non-zero reg divisor, check 4 @unpriv:OK > > #361/77 verifier_sdiv/SMOD32, non-zero reg divisor, check 5:OK > > #361/78 verifier_sdiv/SMOD32, non-zero reg divisor, check 5 @unpriv:OK > > #361/79 verifier_sdiv/SMOD32, non-zero reg divisor, check 6:OK > > #361/80 verifier_sdiv/SMOD32, non-zero reg divisor, check 6 @unpriv:OK > > #361/81 verifier_sdiv/SMOD64, non-zero imm divisor, check 1:OK > > #361/82 verifier_sdiv/SMOD64, non-zero imm divisor, check 1 @unpriv:OK > > #361/83 verifier_sdiv/SMOD64, non-zero imm divisor, check 2:OK > > #361/84 verifier_sdiv/SMOD64, non-zero imm divisor, check 2 @unpriv:OK > > #361/85 verifier_sdiv/SMOD64, non-zero imm divisor, check 3:OK > > #361/86 verifier_sdiv/SMOD64, non-zero imm divisor, check 3 @unpriv:OK > > #361/87 verifier_sdiv/SMOD64, non-zero imm divisor, check 4:OK > > #361/88 verifier_sdiv/SMOD64, non-zero imm divisor, check 4 @unpriv:OK > > #361/89 verifier_sdiv/SMOD64, non-zero imm divisor, check 5:OK > > #361/90 verifier_sdiv/SMOD64, non-zero imm divisor, check 5 @unpriv:OK > > #361/91 verifier_sdiv/SMOD64, non-zero imm divisor, check 6:OK > > #361/92 verifier_sdiv/SMOD64, non-zero imm divisor, check 6 @unpriv:OK > > #361/93 verifier_sdiv/SMOD64, non-zero imm divisor, check 7:OK > > #361/94 verifier_sdiv/SMOD64, non-zero imm divisor, check 7 @unpriv:OK > > #361/95 verifier_sdiv/SMOD64, non-zero imm divisor, check 8:OK > > #361/96 verifier_sdiv/SMOD64, non-zero imm divisor, check 8 @unpriv:OK > > #361/97 verifier_sdiv/SMOD64, non-zero reg divisor, check 1:OK > > #361/98 verifier_sdiv/SMOD64, non-zero reg divisor, check 1 @unpriv:OK > > #361/99 verifier_sdiv/SMOD64, non-zero reg divisor, check 2:OK > > #361/100 verifier_sdiv/SMOD64, non-zero reg divisor, check 2 @unpriv:OK > > #361/101 verifier_sdiv/SMOD64, non-zero reg divisor, check 3:OK > > #361/102 verifier_sdiv/SMOD64, non-zero reg divisor, check 3 @unpriv:OK > > #361/103 verifier_sdiv/SMOD64, non-zero reg divisor, check 4:OK > > #361/104 verifier_sdiv/SMOD64, non-zero reg divisor, check 4 @unpriv:OK > > #361/105 verifier_sdiv/SMOD64, non-zero reg divisor, check 5:OK > > #361/106 verifier_sdiv/SMOD64, non-zero reg divisor, check 5 @unpriv:OK > > #361/107 verifier_sdiv/SMOD64, non-zero reg divisor, check 6:OK > > #361/108 verifier_sdiv/SMOD64, non-zero reg divisor, check 6 @unpriv:OK > > #361/109 verifier_sdiv/SMOD64, non-zero reg divisor, check 7:OK > > #361/110 verifier_sdiv/SMOD64, non-zero reg divisor, check 7 @unpriv:OK > > #361/111 verifier_sdiv/SMOD64, non-zero reg divisor, check 8:OK > > #361/112 verifier_sdiv/SMOD64, non-zero reg divisor, check 8 @unpriv:OK > > #361/113 verifier_sdiv/SDIV32, zero divisor:OK > > #361/114 verifier_sdiv/SDIV32, zero divisor @unpriv:OK > > #361/115 verifier_sdiv/SDIV64, zero divisor:OK > > #361/116 verifier_sdiv/SDIV64, zero divisor @unpriv:OK > > #361/117 verifier_sdiv/SMOD32, zero divisor:OK > > #361/118 verifier_sdiv/SMOD32, zero divisor @unpriv:OK > > #361/119 verifier_sdiv/SMOD64, zero divisor:OK > > #361/120 verifier_sdiv/SMOD64, zero divisor @unpriv:OK > > #361 verifier_sdiv:OK > > Summary: 5/163 PASSED, 0 SKIPPED, 0 FAILED > > > > # ./test_progs -t ldsx_insn > > test_map_val_and_probed_memory:PASS:test_ldsx_insn__open 0 nsec > > test_map_val_and_probed_memory:PASS:test_ldsx_insn__load 0 nsec > > libbpf: prog 'test_ptr_struct_arg': failed to attach: ERROR: strerror_r(-524)=22 > > libbpf: prog 'test_ptr_struct_arg': failed to auto-attach: -524 > > test_map_val_and_probed_memory:FAIL:test_ldsx_insn__attach unexpected error: -524 (errno 524) > > #116/1 ldsx_insn/map_val and probed_memory:FAIL > > #116/2 ldsx_insn/ctx_member_sign_ext:OK > > #116/3 ldsx_insn/ctx_member_narrow_sign_ext:OK > > #116 ldsx_insn:FAIL > Thank you for your effort, but why is there a failure? Can it be solved? > As I said in the above commit message, the feature is not implemented yet. I will follow up but not in this series. > Huacai > > > > > All error logs: > > test_map_val_and_probed_memory:PASS:test_ldsx_insn__open 0 nsec > > test_map_val_and_probed_memory:PASS:test_ldsx_insn__load 0 nsec > > libbpf: prog 'test_ptr_struct_arg': failed to attach: ERROR: strerror_r(-524)=22 > > libbpf: prog 'test_ptr_struct_arg': failed to auto-attach: -524 > > test_map_val_and_probed_memory:FAIL:test_ldsx_insn__attach unexpected error: -524 (errno 524) > > #116/1 ldsx_insn/map_val and probed_memory:FAIL > > #116 ldsx_insn:FAIL > > Summary: 0/2 PASSED, 0 SKIPPED, 1 FAILED > > > > Signed-off-by: Hengqi Chen <hengqi.chen@gmail.com> > > --- > > tools/testing/selftests/bpf/progs/test_ldsx_insn.c | 3 ++- > > tools/testing/selftests/bpf/progs/verifier_bswap.c | 3 ++- > > tools/testing/selftests/bpf/progs/verifier_gotol.c | 3 ++- > > tools/testing/selftests/bpf/progs/verifier_ldsx.c | 3 ++- > > tools/testing/selftests/bpf/progs/verifier_movsx.c | 3 ++- > > tools/testing/selftests/bpf/progs/verifier_sdiv.c | 3 ++- > > 6 files changed, 12 insertions(+), 6 deletions(-) > > > > diff --git a/tools/testing/selftests/bpf/progs/test_ldsx_insn.c b/tools/testing/selftests/bpf/progs/test_ldsx_insn.c > > index 3ddcb3777912..2a2a942737d7 100644 > > --- a/tools/testing/selftests/bpf/progs/test_ldsx_insn.c > > +++ b/tools/testing/selftests/bpf/progs/test_ldsx_insn.c > > @@ -7,7 +7,8 @@ > > > > #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ > > (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ > > - defined(__TARGET_ARCH_s390)) && __clang_major__ >= 18 > > + defined(__TARGET_ARCH_s390) || defined(__TARGET_ARCH_loongarch)) && \ > > + __clang_major__ >= 18 > > const volatile int skip = 0; > > #else > > const volatile int skip = 1; > > diff --git a/tools/testing/selftests/bpf/progs/verifier_bswap.c b/tools/testing/selftests/bpf/progs/verifier_bswap.c > > index 107525fb4a6a..e61755656e8d 100644 > > --- a/tools/testing/selftests/bpf/progs/verifier_bswap.c > > +++ b/tools/testing/selftests/bpf/progs/verifier_bswap.c > > @@ -6,7 +6,8 @@ > > > > #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ > > (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ > > - defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390)) && \ > > + defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390) || \ > > + defined(__TARGET_ARCH_loongarch)) && \ > > __clang_major__ >= 18 > > > > SEC("socket") > > diff --git a/tools/testing/selftests/bpf/progs/verifier_gotol.c b/tools/testing/selftests/bpf/progs/verifier_gotol.c > > index 9f202eda952f..d1edbcff9a18 100644 > > --- a/tools/testing/selftests/bpf/progs/verifier_gotol.c > > +++ b/tools/testing/selftests/bpf/progs/verifier_gotol.c > > @@ -6,7 +6,8 @@ > > > > #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ > > (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ > > - defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390)) && \ > > + defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390) || \ > > + defined(__TARGET_ARCH_loongarch)) && \ > > __clang_major__ >= 18 > > > > SEC("socket") > > diff --git a/tools/testing/selftests/bpf/progs/verifier_ldsx.c b/tools/testing/selftests/bpf/progs/verifier_ldsx.c > > index 375525329637..d4427d8e1217 100644 > > --- a/tools/testing/selftests/bpf/progs/verifier_ldsx.c > > +++ b/tools/testing/selftests/bpf/progs/verifier_ldsx.c > > @@ -6,7 +6,8 @@ > > > > #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ > > (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ > > - defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390)) && \ > > + defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390) || \ > > + defined(__TARGET_ARCH_loongarch)) && \ > > __clang_major__ >= 18 > > > > SEC("socket") > > diff --git a/tools/testing/selftests/bpf/progs/verifier_movsx.c b/tools/testing/selftests/bpf/progs/verifier_movsx.c > > index b2a04d1179d0..cbb9d6714f53 100644 > > --- a/tools/testing/selftests/bpf/progs/verifier_movsx.c > > +++ b/tools/testing/selftests/bpf/progs/verifier_movsx.c > > @@ -6,7 +6,8 @@ > > > > #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ > > (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ > > - defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390)) && \ > > + defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390) || \ > > + defined(__TARGET_ARCH_loongarch)) && \ > > __clang_major__ >= 18 > > > > SEC("socket") > > diff --git a/tools/testing/selftests/bpf/progs/verifier_sdiv.c b/tools/testing/selftests/bpf/progs/verifier_sdiv.c > > index 8fc5174808b2..2a2271cf0294 100644 > > --- a/tools/testing/selftests/bpf/progs/verifier_sdiv.c > > +++ b/tools/testing/selftests/bpf/progs/verifier_sdiv.c > > @@ -6,7 +6,8 @@ > > > > #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ > > (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ > > - defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390)) && \ > > + defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390) || \ > > + defined(__TARGET_ARCH_loongarch)) && \ > > __clang_major__ >= 18 > > > > SEC("socket") > > -- > > 2.34.1 > > >
On Fri, Oct 27, 2023 at 4:40 PM Hengqi Chen <hengqi.chen@gmail.com> wrote: > > On Fri, Oct 27, 2023 at 3:05 PM Huacai Chen <chenhuacai@kernel.org> wrote: > > > > Hi, Hengqi, > > > > On Fri, Oct 27, 2023 at 2:01 PM Hengqi Chen <hengqi.chen@gmail.com> wrote: > > > > > > Enable cpu v4 tests for LoongArch. Currently, we don't > > > have BPF trampoline in LoongArch JIT, so the fentry > > > test `test_ptr_struct_arg` still failed, will followup. > > > Test result attached below: > > > > > > # ./test_progs -t verifier_sdiv,verifier_movsx,verifier_ldsx,verifier_gotol,verifier_bswap > > > #316/1 verifier_bswap/BSWAP, 16:OK > > > #316/2 verifier_bswap/BSWAP, 16 @unpriv:OK > > > #316/3 verifier_bswap/BSWAP, 32:OK > > > #316/4 verifier_bswap/BSWAP, 32 @unpriv:OK > > > #316/5 verifier_bswap/BSWAP, 64:OK > > > #316/6 verifier_bswap/BSWAP, 64 @unpriv:OK > > > #316 verifier_bswap:OK > > > #330/1 verifier_gotol/gotol, small_imm:OK > > > #330/2 verifier_gotol/gotol, small_imm @unpriv:OK > > > #330 verifier_gotol:OK > > > #338/1 verifier_ldsx/LDSX, S8:OK > > > #338/2 verifier_ldsx/LDSX, S8 @unpriv:OK > > > #338/3 verifier_ldsx/LDSX, S16:OK > > > #338/4 verifier_ldsx/LDSX, S16 @unpriv:OK > > > #338/5 verifier_ldsx/LDSX, S32:OK > > > #338/6 verifier_ldsx/LDSX, S32 @unpriv:OK > > > #338/7 verifier_ldsx/LDSX, S8 range checking, privileged:OK > > > #338/8 verifier_ldsx/LDSX, S16 range checking:OK > > > #338/9 verifier_ldsx/LDSX, S16 range checking @unpriv:OK > > > #338/10 verifier_ldsx/LDSX, S32 range checking:OK > > > #338/11 verifier_ldsx/LDSX, S32 range checking @unpriv:OK > > > #338 verifier_ldsx:OK > > > #349/1 verifier_movsx/MOV32SX, S8:OK > > > #349/2 verifier_movsx/MOV32SX, S8 @unpriv:OK > > > #349/3 verifier_movsx/MOV32SX, S16:OK > > > #349/4 verifier_movsx/MOV32SX, S16 @unpriv:OK > > > #349/5 verifier_movsx/MOV64SX, S8:OK > > > #349/6 verifier_movsx/MOV64SX, S8 @unpriv:OK > > > #349/7 verifier_movsx/MOV64SX, S16:OK > > > #349/8 verifier_movsx/MOV64SX, S16 @unpriv:OK > > > #349/9 verifier_movsx/MOV64SX, S32:OK > > > #349/10 verifier_movsx/MOV64SX, S32 @unpriv:OK > > > #349/11 verifier_movsx/MOV32SX, S8, range_check:OK > > > #349/12 verifier_movsx/MOV32SX, S8, range_check @unpriv:OK > > > #349/13 verifier_movsx/MOV32SX, S16, range_check:OK > > > #349/14 verifier_movsx/MOV32SX, S16, range_check @unpriv:OK > > > #349/15 verifier_movsx/MOV32SX, S16, range_check 2:OK > > > #349/16 verifier_movsx/MOV32SX, S16, range_check 2 @unpriv:OK > > > #349/17 verifier_movsx/MOV64SX, S8, range_check:OK > > > #349/18 verifier_movsx/MOV64SX, S8, range_check @unpriv:OK > > > #349/19 verifier_movsx/MOV64SX, S16, range_check:OK > > > #349/20 verifier_movsx/MOV64SX, S16, range_check @unpriv:OK > > > #349/21 verifier_movsx/MOV64SX, S32, range_check:OK > > > #349/22 verifier_movsx/MOV64SX, S32, range_check @unpriv:OK > > > #349/23 verifier_movsx/MOV64SX, S16, R10 Sign Extension:OK > > > #349/24 verifier_movsx/MOV64SX, S16, R10 Sign Extension @unpriv:OK > > > #349 verifier_movsx:OK > > > #361/1 verifier_sdiv/SDIV32, non-zero imm divisor, check 1:OK > > > #361/2 verifier_sdiv/SDIV32, non-zero imm divisor, check 1 @unpriv:OK > > > #361/3 verifier_sdiv/SDIV32, non-zero imm divisor, check 2:OK > > > #361/4 verifier_sdiv/SDIV32, non-zero imm divisor, check 2 @unpriv:OK > > > #361/5 verifier_sdiv/SDIV32, non-zero imm divisor, check 3:OK > > > #361/6 verifier_sdiv/SDIV32, non-zero imm divisor, check 3 @unpriv:OK > > > #361/7 verifier_sdiv/SDIV32, non-zero imm divisor, check 4:OK > > > #361/8 verifier_sdiv/SDIV32, non-zero imm divisor, check 4 @unpriv:OK > > > #361/9 verifier_sdiv/SDIV32, non-zero imm divisor, check 5:OK > > > #361/10 verifier_sdiv/SDIV32, non-zero imm divisor, check 5 @unpriv:OK > > > #361/11 verifier_sdiv/SDIV32, non-zero imm divisor, check 6:OK > > > #361/12 verifier_sdiv/SDIV32, non-zero imm divisor, check 6 @unpriv:OK > > > #361/13 verifier_sdiv/SDIV32, non-zero imm divisor, check 7:OK > > > #361/14 verifier_sdiv/SDIV32, non-zero imm divisor, check 7 @unpriv:OK > > > #361/15 verifier_sdiv/SDIV32, non-zero imm divisor, check 8:OK > > > #361/16 verifier_sdiv/SDIV32, non-zero imm divisor, check 8 @unpriv:OK > > > #361/17 verifier_sdiv/SDIV32, non-zero reg divisor, check 1:OK > > > #361/18 verifier_sdiv/SDIV32, non-zero reg divisor, check 1 @unpriv:OK > > > #361/19 verifier_sdiv/SDIV32, non-zero reg divisor, check 2:OK > > > #361/20 verifier_sdiv/SDIV32, non-zero reg divisor, check 2 @unpriv:OK > > > #361/21 verifier_sdiv/SDIV32, non-zero reg divisor, check 3:OK > > > #361/22 verifier_sdiv/SDIV32, non-zero reg divisor, check 3 @unpriv:OK > > > #361/23 verifier_sdiv/SDIV32, non-zero reg divisor, check 4:OK > > > #361/24 verifier_sdiv/SDIV32, non-zero reg divisor, check 4 @unpriv:OK > > > #361/25 verifier_sdiv/SDIV32, non-zero reg divisor, check 5:OK > > > #361/26 verifier_sdiv/SDIV32, non-zero reg divisor, check 5 @unpriv:OK > > > #361/27 verifier_sdiv/SDIV32, non-zero reg divisor, check 6:OK > > > #361/28 verifier_sdiv/SDIV32, non-zero reg divisor, check 6 @unpriv:OK > > > #361/29 verifier_sdiv/SDIV32, non-zero reg divisor, check 7:OK > > > #361/30 verifier_sdiv/SDIV32, non-zero reg divisor, check 7 @unpriv:OK > > > #361/31 verifier_sdiv/SDIV32, non-zero reg divisor, check 8:OK > > > #361/32 verifier_sdiv/SDIV32, non-zero reg divisor, check 8 @unpriv:OK > > > #361/33 verifier_sdiv/SDIV64, non-zero imm divisor, check 1:OK > > > #361/34 verifier_sdiv/SDIV64, non-zero imm divisor, check 1 @unpriv:OK > > > #361/35 verifier_sdiv/SDIV64, non-zero imm divisor, check 2:OK > > > #361/36 verifier_sdiv/SDIV64, non-zero imm divisor, check 2 @unpriv:OK > > > #361/37 verifier_sdiv/SDIV64, non-zero imm divisor, check 3:OK > > > #361/38 verifier_sdiv/SDIV64, non-zero imm divisor, check 3 @unpriv:OK > > > #361/39 verifier_sdiv/SDIV64, non-zero imm divisor, check 4:OK > > > #361/40 verifier_sdiv/SDIV64, non-zero imm divisor, check 4 @unpriv:OK > > > #361/41 verifier_sdiv/SDIV64, non-zero imm divisor, check 5:OK > > > #361/42 verifier_sdiv/SDIV64, non-zero imm divisor, check 5 @unpriv:OK > > > #361/43 verifier_sdiv/SDIV64, non-zero imm divisor, check 6:OK > > > #361/44 verifier_sdiv/SDIV64, non-zero imm divisor, check 6 @unpriv:OK > > > #361/45 verifier_sdiv/SDIV64, non-zero reg divisor, check 1:OK > > > #361/46 verifier_sdiv/SDIV64, non-zero reg divisor, check 1 @unpriv:OK > > > #361/47 verifier_sdiv/SDIV64, non-zero reg divisor, check 2:OK > > > #361/48 verifier_sdiv/SDIV64, non-zero reg divisor, check 2 @unpriv:OK > > > #361/49 verifier_sdiv/SDIV64, non-zero reg divisor, check 3:OK > > > #361/50 verifier_sdiv/SDIV64, non-zero reg divisor, check 3 @unpriv:OK > > > #361/51 verifier_sdiv/SDIV64, non-zero reg divisor, check 4:OK > > > #361/52 verifier_sdiv/SDIV64, non-zero reg divisor, check 4 @unpriv:OK > > > #361/53 verifier_sdiv/SDIV64, non-zero reg divisor, check 5:OK > > > #361/54 verifier_sdiv/SDIV64, non-zero reg divisor, check 5 @unpriv:OK > > > #361/55 verifier_sdiv/SDIV64, non-zero reg divisor, check 6:OK > > > #361/56 verifier_sdiv/SDIV64, non-zero reg divisor, check 6 @unpriv:OK > > > #361/57 verifier_sdiv/SMOD32, non-zero imm divisor, check 1:OK > > > #361/58 verifier_sdiv/SMOD32, non-zero imm divisor, check 1 @unpriv:OK > > > #361/59 verifier_sdiv/SMOD32, non-zero imm divisor, check 2:OK > > > #361/60 verifier_sdiv/SMOD32, non-zero imm divisor, check 2 @unpriv:OK > > > #361/61 verifier_sdiv/SMOD32, non-zero imm divisor, check 3:OK > > > #361/62 verifier_sdiv/SMOD32, non-zero imm divisor, check 3 @unpriv:OK > > > #361/63 verifier_sdiv/SMOD32, non-zero imm divisor, check 4:OK > > > #361/64 verifier_sdiv/SMOD32, non-zero imm divisor, check 4 @unpriv:OK > > > #361/65 verifier_sdiv/SMOD32, non-zero imm divisor, check 5:OK > > > #361/66 verifier_sdiv/SMOD32, non-zero imm divisor, check 5 @unpriv:OK > > > #361/67 verifier_sdiv/SMOD32, non-zero imm divisor, check 6:OK > > > #361/68 verifier_sdiv/SMOD32, non-zero imm divisor, check 6 @unpriv:OK > > > #361/69 verifier_sdiv/SMOD32, non-zero reg divisor, check 1:OK > > > #361/70 verifier_sdiv/SMOD32, non-zero reg divisor, check 1 @unpriv:OK > > > #361/71 verifier_sdiv/SMOD32, non-zero reg divisor, check 2:OK > > > #361/72 verifier_sdiv/SMOD32, non-zero reg divisor, check 2 @unpriv:OK > > > #361/73 verifier_sdiv/SMOD32, non-zero reg divisor, check 3:OK > > > #361/74 verifier_sdiv/SMOD32, non-zero reg divisor, check 3 @unpriv:OK > > > #361/75 verifier_sdiv/SMOD32, non-zero reg divisor, check 4:OK > > > #361/76 verifier_sdiv/SMOD32, non-zero reg divisor, check 4 @unpriv:OK > > > #361/77 verifier_sdiv/SMOD32, non-zero reg divisor, check 5:OK > > > #361/78 verifier_sdiv/SMOD32, non-zero reg divisor, check 5 @unpriv:OK > > > #361/79 verifier_sdiv/SMOD32, non-zero reg divisor, check 6:OK > > > #361/80 verifier_sdiv/SMOD32, non-zero reg divisor, check 6 @unpriv:OK > > > #361/81 verifier_sdiv/SMOD64, non-zero imm divisor, check 1:OK > > > #361/82 verifier_sdiv/SMOD64, non-zero imm divisor, check 1 @unpriv:OK > > > #361/83 verifier_sdiv/SMOD64, non-zero imm divisor, check 2:OK > > > #361/84 verifier_sdiv/SMOD64, non-zero imm divisor, check 2 @unpriv:OK > > > #361/85 verifier_sdiv/SMOD64, non-zero imm divisor, check 3:OK > > > #361/86 verifier_sdiv/SMOD64, non-zero imm divisor, check 3 @unpriv:OK > > > #361/87 verifier_sdiv/SMOD64, non-zero imm divisor, check 4:OK > > > #361/88 verifier_sdiv/SMOD64, non-zero imm divisor, check 4 @unpriv:OK > > > #361/89 verifier_sdiv/SMOD64, non-zero imm divisor, check 5:OK > > > #361/90 verifier_sdiv/SMOD64, non-zero imm divisor, check 5 @unpriv:OK > > > #361/91 verifier_sdiv/SMOD64, non-zero imm divisor, check 6:OK > > > #361/92 verifier_sdiv/SMOD64, non-zero imm divisor, check 6 @unpriv:OK > > > #361/93 verifier_sdiv/SMOD64, non-zero imm divisor, check 7:OK > > > #361/94 verifier_sdiv/SMOD64, non-zero imm divisor, check 7 @unpriv:OK > > > #361/95 verifier_sdiv/SMOD64, non-zero imm divisor, check 8:OK > > > #361/96 verifier_sdiv/SMOD64, non-zero imm divisor, check 8 @unpriv:OK > > > #361/97 verifier_sdiv/SMOD64, non-zero reg divisor, check 1:OK > > > #361/98 verifier_sdiv/SMOD64, non-zero reg divisor, check 1 @unpriv:OK > > > #361/99 verifier_sdiv/SMOD64, non-zero reg divisor, check 2:OK > > > #361/100 verifier_sdiv/SMOD64, non-zero reg divisor, check 2 @unpriv:OK > > > #361/101 verifier_sdiv/SMOD64, non-zero reg divisor, check 3:OK > > > #361/102 verifier_sdiv/SMOD64, non-zero reg divisor, check 3 @unpriv:OK > > > #361/103 verifier_sdiv/SMOD64, non-zero reg divisor, check 4:OK > > > #361/104 verifier_sdiv/SMOD64, non-zero reg divisor, check 4 @unpriv:OK > > > #361/105 verifier_sdiv/SMOD64, non-zero reg divisor, check 5:OK > > > #361/106 verifier_sdiv/SMOD64, non-zero reg divisor, check 5 @unpriv:OK > > > #361/107 verifier_sdiv/SMOD64, non-zero reg divisor, check 6:OK > > > #361/108 verifier_sdiv/SMOD64, non-zero reg divisor, check 6 @unpriv:OK > > > #361/109 verifier_sdiv/SMOD64, non-zero reg divisor, check 7:OK > > > #361/110 verifier_sdiv/SMOD64, non-zero reg divisor, check 7 @unpriv:OK > > > #361/111 verifier_sdiv/SMOD64, non-zero reg divisor, check 8:OK > > > #361/112 verifier_sdiv/SMOD64, non-zero reg divisor, check 8 @unpriv:OK > > > #361/113 verifier_sdiv/SDIV32, zero divisor:OK > > > #361/114 verifier_sdiv/SDIV32, zero divisor @unpriv:OK > > > #361/115 verifier_sdiv/SDIV64, zero divisor:OK > > > #361/116 verifier_sdiv/SDIV64, zero divisor @unpriv:OK > > > #361/117 verifier_sdiv/SMOD32, zero divisor:OK > > > #361/118 verifier_sdiv/SMOD32, zero divisor @unpriv:OK > > > #361/119 verifier_sdiv/SMOD64, zero divisor:OK > > > #361/120 verifier_sdiv/SMOD64, zero divisor @unpriv:OK > > > #361 verifier_sdiv:OK > > > Summary: 5/163 PASSED, 0 SKIPPED, 0 FAILED > > > > > > # ./test_progs -t ldsx_insn > > > test_map_val_and_probed_memory:PASS:test_ldsx_insn__open 0 nsec > > > test_map_val_and_probed_memory:PASS:test_ldsx_insn__load 0 nsec > > > libbpf: prog 'test_ptr_struct_arg': failed to attach: ERROR: strerror_r(-524)=22 > > > libbpf: prog 'test_ptr_struct_arg': failed to auto-attach: -524 > > > test_map_val_and_probed_memory:FAIL:test_ldsx_insn__attach unexpected error: -524 (errno 524) > > > #116/1 ldsx_insn/map_val and probed_memory:FAIL > > > #116/2 ldsx_insn/ctx_member_sign_ext:OK > > > #116/3 ldsx_insn/ctx_member_narrow_sign_ext:OK > > > #116 ldsx_insn:FAIL > > Thank you for your effort, but why is there a failure? Can it be solved? > > > > As I said in the above commit message, the feature is not implemented yet. > I will follow up but not in this series. Why not in this series? Too difficult to implement? Huacai > > > Huacai > > > > > > > > All error logs: > > > test_map_val_and_probed_memory:PASS:test_ldsx_insn__open 0 nsec > > > test_map_val_and_probed_memory:PASS:test_ldsx_insn__load 0 nsec > > > libbpf: prog 'test_ptr_struct_arg': failed to attach: ERROR: strerror_r(-524)=22 > > > libbpf: prog 'test_ptr_struct_arg': failed to auto-attach: -524 > > > test_map_val_and_probed_memory:FAIL:test_ldsx_insn__attach unexpected error: -524 (errno 524) > > > #116/1 ldsx_insn/map_val and probed_memory:FAIL > > > #116 ldsx_insn:FAIL > > > Summary: 0/2 PASSED, 0 SKIPPED, 1 FAILED > > > > > > Signed-off-by: Hengqi Chen <hengqi.chen@gmail.com> > > > --- > > > tools/testing/selftests/bpf/progs/test_ldsx_insn.c | 3 ++- > > > tools/testing/selftests/bpf/progs/verifier_bswap.c | 3 ++- > > > tools/testing/selftests/bpf/progs/verifier_gotol.c | 3 ++- > > > tools/testing/selftests/bpf/progs/verifier_ldsx.c | 3 ++- > > > tools/testing/selftests/bpf/progs/verifier_movsx.c | 3 ++- > > > tools/testing/selftests/bpf/progs/verifier_sdiv.c | 3 ++- > > > 6 files changed, 12 insertions(+), 6 deletions(-) > > > > > > diff --git a/tools/testing/selftests/bpf/progs/test_ldsx_insn.c b/tools/testing/selftests/bpf/progs/test_ldsx_insn.c > > > index 3ddcb3777912..2a2a942737d7 100644 > > > --- a/tools/testing/selftests/bpf/progs/test_ldsx_insn.c > > > +++ b/tools/testing/selftests/bpf/progs/test_ldsx_insn.c > > > @@ -7,7 +7,8 @@ > > > > > > #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ > > > (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ > > > - defined(__TARGET_ARCH_s390)) && __clang_major__ >= 18 > > > + defined(__TARGET_ARCH_s390) || defined(__TARGET_ARCH_loongarch)) && \ > > > + __clang_major__ >= 18 > > > const volatile int skip = 0; > > > #else > > > const volatile int skip = 1; > > > diff --git a/tools/testing/selftests/bpf/progs/verifier_bswap.c b/tools/testing/selftests/bpf/progs/verifier_bswap.c > > > index 107525fb4a6a..e61755656e8d 100644 > > > --- a/tools/testing/selftests/bpf/progs/verifier_bswap.c > > > +++ b/tools/testing/selftests/bpf/progs/verifier_bswap.c > > > @@ -6,7 +6,8 @@ > > > > > > #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ > > > (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ > > > - defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390)) && \ > > > + defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390) || \ > > > + defined(__TARGET_ARCH_loongarch)) && \ > > > __clang_major__ >= 18 > > > > > > SEC("socket") > > > diff --git a/tools/testing/selftests/bpf/progs/verifier_gotol.c b/tools/testing/selftests/bpf/progs/verifier_gotol.c > > > index 9f202eda952f..d1edbcff9a18 100644 > > > --- a/tools/testing/selftests/bpf/progs/verifier_gotol.c > > > +++ b/tools/testing/selftests/bpf/progs/verifier_gotol.c > > > @@ -6,7 +6,8 @@ > > > > > > #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ > > > (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ > > > - defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390)) && \ > > > + defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390) || \ > > > + defined(__TARGET_ARCH_loongarch)) && \ > > > __clang_major__ >= 18 > > > > > > SEC("socket") > > > diff --git a/tools/testing/selftests/bpf/progs/verifier_ldsx.c b/tools/testing/selftests/bpf/progs/verifier_ldsx.c > > > index 375525329637..d4427d8e1217 100644 > > > --- a/tools/testing/selftests/bpf/progs/verifier_ldsx.c > > > +++ b/tools/testing/selftests/bpf/progs/verifier_ldsx.c > > > @@ -6,7 +6,8 @@ > > > > > > #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ > > > (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ > > > - defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390)) && \ > > > + defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390) || \ > > > + defined(__TARGET_ARCH_loongarch)) && \ > > > __clang_major__ >= 18 > > > > > > SEC("socket") > > > diff --git a/tools/testing/selftests/bpf/progs/verifier_movsx.c b/tools/testing/selftests/bpf/progs/verifier_movsx.c > > > index b2a04d1179d0..cbb9d6714f53 100644 > > > --- a/tools/testing/selftests/bpf/progs/verifier_movsx.c > > > +++ b/tools/testing/selftests/bpf/progs/verifier_movsx.c > > > @@ -6,7 +6,8 @@ > > > > > > #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ > > > (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ > > > - defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390)) && \ > > > + defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390) || \ > > > + defined(__TARGET_ARCH_loongarch)) && \ > > > __clang_major__ >= 18 > > > > > > SEC("socket") > > > diff --git a/tools/testing/selftests/bpf/progs/verifier_sdiv.c b/tools/testing/selftests/bpf/progs/verifier_sdiv.c > > > index 8fc5174808b2..2a2271cf0294 100644 > > > --- a/tools/testing/selftests/bpf/progs/verifier_sdiv.c > > > +++ b/tools/testing/selftests/bpf/progs/verifier_sdiv.c > > > @@ -6,7 +6,8 @@ > > > > > > #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ > > > (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ > > > - defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390)) && \ > > > + defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390) || \ > > > + defined(__TARGET_ARCH_loongarch)) && \ > > > __clang_major__ >= 18 > > > > > > SEC("socket") > > > -- > > > 2.34.1 > > > > >
On Fri, Oct 27, 2023 at 4:42 PM Huacai Chen <chenhuacai@kernel.org> wrote: > > On Fri, Oct 27, 2023 at 4:40 PM Hengqi Chen <hengqi.chen@gmail.com> wrote: > > > > On Fri, Oct 27, 2023 at 3:05 PM Huacai Chen <chenhuacai@kernel.org> wrote: > > > > > > Hi, Hengqi, > > > > > > On Fri, Oct 27, 2023 at 2:01 PM Hengqi Chen <hengqi.chen@gmail.com> wrote: > > > > > > > > Enable cpu v4 tests for LoongArch. Currently, we don't > > > > have BPF trampoline in LoongArch JIT, so the fentry > > > > test `test_ptr_struct_arg` still failed, will followup. > > > > Test result attached below: > > > > > > > > # ./test_progs -t verifier_sdiv,verifier_movsx,verifier_ldsx,verifier_gotol,verifier_bswap > > > > #316/1 verifier_bswap/BSWAP, 16:OK > > > > #316/2 verifier_bswap/BSWAP, 16 @unpriv:OK > > > > #316/3 verifier_bswap/BSWAP, 32:OK > > > > #316/4 verifier_bswap/BSWAP, 32 @unpriv:OK > > > > #316/5 verifier_bswap/BSWAP, 64:OK > > > > #316/6 verifier_bswap/BSWAP, 64 @unpriv:OK > > > > #316 verifier_bswap:OK > > > > #330/1 verifier_gotol/gotol, small_imm:OK > > > > #330/2 verifier_gotol/gotol, small_imm @unpriv:OK > > > > #330 verifier_gotol:OK > > > > #338/1 verifier_ldsx/LDSX, S8:OK > > > > #338/2 verifier_ldsx/LDSX, S8 @unpriv:OK > > > > #338/3 verifier_ldsx/LDSX, S16:OK > > > > #338/4 verifier_ldsx/LDSX, S16 @unpriv:OK > > > > #338/5 verifier_ldsx/LDSX, S32:OK > > > > #338/6 verifier_ldsx/LDSX, S32 @unpriv:OK > > > > #338/7 verifier_ldsx/LDSX, S8 range checking, privileged:OK > > > > #338/8 verifier_ldsx/LDSX, S16 range checking:OK > > > > #338/9 verifier_ldsx/LDSX, S16 range checking @unpriv:OK > > > > #338/10 verifier_ldsx/LDSX, S32 range checking:OK > > > > #338/11 verifier_ldsx/LDSX, S32 range checking @unpriv:OK > > > > #338 verifier_ldsx:OK > > > > #349/1 verifier_movsx/MOV32SX, S8:OK > > > > #349/2 verifier_movsx/MOV32SX, S8 @unpriv:OK > > > > #349/3 verifier_movsx/MOV32SX, S16:OK > > > > #349/4 verifier_movsx/MOV32SX, S16 @unpriv:OK > > > > #349/5 verifier_movsx/MOV64SX, S8:OK > > > > #349/6 verifier_movsx/MOV64SX, S8 @unpriv:OK > > > > #349/7 verifier_movsx/MOV64SX, S16:OK > > > > #349/8 verifier_movsx/MOV64SX, S16 @unpriv:OK > > > > #349/9 verifier_movsx/MOV64SX, S32:OK > > > > #349/10 verifier_movsx/MOV64SX, S32 @unpriv:OK > > > > #349/11 verifier_movsx/MOV32SX, S8, range_check:OK > > > > #349/12 verifier_movsx/MOV32SX, S8, range_check @unpriv:OK > > > > #349/13 verifier_movsx/MOV32SX, S16, range_check:OK > > > > #349/14 verifier_movsx/MOV32SX, S16, range_check @unpriv:OK > > > > #349/15 verifier_movsx/MOV32SX, S16, range_check 2:OK > > > > #349/16 verifier_movsx/MOV32SX, S16, range_check 2 @unpriv:OK > > > > #349/17 verifier_movsx/MOV64SX, S8, range_check:OK > > > > #349/18 verifier_movsx/MOV64SX, S8, range_check @unpriv:OK > > > > #349/19 verifier_movsx/MOV64SX, S16, range_check:OK > > > > #349/20 verifier_movsx/MOV64SX, S16, range_check @unpriv:OK > > > > #349/21 verifier_movsx/MOV64SX, S32, range_check:OK > > > > #349/22 verifier_movsx/MOV64SX, S32, range_check @unpriv:OK > > > > #349/23 verifier_movsx/MOV64SX, S16, R10 Sign Extension:OK > > > > #349/24 verifier_movsx/MOV64SX, S16, R10 Sign Extension @unpriv:OK > > > > #349 verifier_movsx:OK > > > > #361/1 verifier_sdiv/SDIV32, non-zero imm divisor, check 1:OK > > > > #361/2 verifier_sdiv/SDIV32, non-zero imm divisor, check 1 @unpriv:OK > > > > #361/3 verifier_sdiv/SDIV32, non-zero imm divisor, check 2:OK > > > > #361/4 verifier_sdiv/SDIV32, non-zero imm divisor, check 2 @unpriv:OK > > > > #361/5 verifier_sdiv/SDIV32, non-zero imm divisor, check 3:OK > > > > #361/6 verifier_sdiv/SDIV32, non-zero imm divisor, check 3 @unpriv:OK > > > > #361/7 verifier_sdiv/SDIV32, non-zero imm divisor, check 4:OK > > > > #361/8 verifier_sdiv/SDIV32, non-zero imm divisor, check 4 @unpriv:OK > > > > #361/9 verifier_sdiv/SDIV32, non-zero imm divisor, check 5:OK > > > > #361/10 verifier_sdiv/SDIV32, non-zero imm divisor, check 5 @unpriv:OK > > > > #361/11 verifier_sdiv/SDIV32, non-zero imm divisor, check 6:OK > > > > #361/12 verifier_sdiv/SDIV32, non-zero imm divisor, check 6 @unpriv:OK > > > > #361/13 verifier_sdiv/SDIV32, non-zero imm divisor, check 7:OK > > > > #361/14 verifier_sdiv/SDIV32, non-zero imm divisor, check 7 @unpriv:OK > > > > #361/15 verifier_sdiv/SDIV32, non-zero imm divisor, check 8:OK > > > > #361/16 verifier_sdiv/SDIV32, non-zero imm divisor, check 8 @unpriv:OK > > > > #361/17 verifier_sdiv/SDIV32, non-zero reg divisor, check 1:OK > > > > #361/18 verifier_sdiv/SDIV32, non-zero reg divisor, check 1 @unpriv:OK > > > > #361/19 verifier_sdiv/SDIV32, non-zero reg divisor, check 2:OK > > > > #361/20 verifier_sdiv/SDIV32, non-zero reg divisor, check 2 @unpriv:OK > > > > #361/21 verifier_sdiv/SDIV32, non-zero reg divisor, check 3:OK > > > > #361/22 verifier_sdiv/SDIV32, non-zero reg divisor, check 3 @unpriv:OK > > > > #361/23 verifier_sdiv/SDIV32, non-zero reg divisor, check 4:OK > > > > #361/24 verifier_sdiv/SDIV32, non-zero reg divisor, check 4 @unpriv:OK > > > > #361/25 verifier_sdiv/SDIV32, non-zero reg divisor, check 5:OK > > > > #361/26 verifier_sdiv/SDIV32, non-zero reg divisor, check 5 @unpriv:OK > > > > #361/27 verifier_sdiv/SDIV32, non-zero reg divisor, check 6:OK > > > > #361/28 verifier_sdiv/SDIV32, non-zero reg divisor, check 6 @unpriv:OK > > > > #361/29 verifier_sdiv/SDIV32, non-zero reg divisor, check 7:OK > > > > #361/30 verifier_sdiv/SDIV32, non-zero reg divisor, check 7 @unpriv:OK > > > > #361/31 verifier_sdiv/SDIV32, non-zero reg divisor, check 8:OK > > > > #361/32 verifier_sdiv/SDIV32, non-zero reg divisor, check 8 @unpriv:OK > > > > #361/33 verifier_sdiv/SDIV64, non-zero imm divisor, check 1:OK > > > > #361/34 verifier_sdiv/SDIV64, non-zero imm divisor, check 1 @unpriv:OK > > > > #361/35 verifier_sdiv/SDIV64, non-zero imm divisor, check 2:OK > > > > #361/36 verifier_sdiv/SDIV64, non-zero imm divisor, check 2 @unpriv:OK > > > > #361/37 verifier_sdiv/SDIV64, non-zero imm divisor, check 3:OK > > > > #361/38 verifier_sdiv/SDIV64, non-zero imm divisor, check 3 @unpriv:OK > > > > #361/39 verifier_sdiv/SDIV64, non-zero imm divisor, check 4:OK > > > > #361/40 verifier_sdiv/SDIV64, non-zero imm divisor, check 4 @unpriv:OK > > > > #361/41 verifier_sdiv/SDIV64, non-zero imm divisor, check 5:OK > > > > #361/42 verifier_sdiv/SDIV64, non-zero imm divisor, check 5 @unpriv:OK > > > > #361/43 verifier_sdiv/SDIV64, non-zero imm divisor, check 6:OK > > > > #361/44 verifier_sdiv/SDIV64, non-zero imm divisor, check 6 @unpriv:OK > > > > #361/45 verifier_sdiv/SDIV64, non-zero reg divisor, check 1:OK > > > > #361/46 verifier_sdiv/SDIV64, non-zero reg divisor, check 1 @unpriv:OK > > > > #361/47 verifier_sdiv/SDIV64, non-zero reg divisor, check 2:OK > > > > #361/48 verifier_sdiv/SDIV64, non-zero reg divisor, check 2 @unpriv:OK > > > > #361/49 verifier_sdiv/SDIV64, non-zero reg divisor, check 3:OK > > > > #361/50 verifier_sdiv/SDIV64, non-zero reg divisor, check 3 @unpriv:OK > > > > #361/51 verifier_sdiv/SDIV64, non-zero reg divisor, check 4:OK > > > > #361/52 verifier_sdiv/SDIV64, non-zero reg divisor, check 4 @unpriv:OK > > > > #361/53 verifier_sdiv/SDIV64, non-zero reg divisor, check 5:OK > > > > #361/54 verifier_sdiv/SDIV64, non-zero reg divisor, check 5 @unpriv:OK > > > > #361/55 verifier_sdiv/SDIV64, non-zero reg divisor, check 6:OK > > > > #361/56 verifier_sdiv/SDIV64, non-zero reg divisor, check 6 @unpriv:OK > > > > #361/57 verifier_sdiv/SMOD32, non-zero imm divisor, check 1:OK > > > > #361/58 verifier_sdiv/SMOD32, non-zero imm divisor, check 1 @unpriv:OK > > > > #361/59 verifier_sdiv/SMOD32, non-zero imm divisor, check 2:OK > > > > #361/60 verifier_sdiv/SMOD32, non-zero imm divisor, check 2 @unpriv:OK > > > > #361/61 verifier_sdiv/SMOD32, non-zero imm divisor, check 3:OK > > > > #361/62 verifier_sdiv/SMOD32, non-zero imm divisor, check 3 @unpriv:OK > > > > #361/63 verifier_sdiv/SMOD32, non-zero imm divisor, check 4:OK > > > > #361/64 verifier_sdiv/SMOD32, non-zero imm divisor, check 4 @unpriv:OK > > > > #361/65 verifier_sdiv/SMOD32, non-zero imm divisor, check 5:OK > > > > #361/66 verifier_sdiv/SMOD32, non-zero imm divisor, check 5 @unpriv:OK > > > > #361/67 verifier_sdiv/SMOD32, non-zero imm divisor, check 6:OK > > > > #361/68 verifier_sdiv/SMOD32, non-zero imm divisor, check 6 @unpriv:OK > > > > #361/69 verifier_sdiv/SMOD32, non-zero reg divisor, check 1:OK > > > > #361/70 verifier_sdiv/SMOD32, non-zero reg divisor, check 1 @unpriv:OK > > > > #361/71 verifier_sdiv/SMOD32, non-zero reg divisor, check 2:OK > > > > #361/72 verifier_sdiv/SMOD32, non-zero reg divisor, check 2 @unpriv:OK > > > > #361/73 verifier_sdiv/SMOD32, non-zero reg divisor, check 3:OK > > > > #361/74 verifier_sdiv/SMOD32, non-zero reg divisor, check 3 @unpriv:OK > > > > #361/75 verifier_sdiv/SMOD32, non-zero reg divisor, check 4:OK > > > > #361/76 verifier_sdiv/SMOD32, non-zero reg divisor, check 4 @unpriv:OK > > > > #361/77 verifier_sdiv/SMOD32, non-zero reg divisor, check 5:OK > > > > #361/78 verifier_sdiv/SMOD32, non-zero reg divisor, check 5 @unpriv:OK > > > > #361/79 verifier_sdiv/SMOD32, non-zero reg divisor, check 6:OK > > > > #361/80 verifier_sdiv/SMOD32, non-zero reg divisor, check 6 @unpriv:OK > > > > #361/81 verifier_sdiv/SMOD64, non-zero imm divisor, check 1:OK > > > > #361/82 verifier_sdiv/SMOD64, non-zero imm divisor, check 1 @unpriv:OK > > > > #361/83 verifier_sdiv/SMOD64, non-zero imm divisor, check 2:OK > > > > #361/84 verifier_sdiv/SMOD64, non-zero imm divisor, check 2 @unpriv:OK > > > > #361/85 verifier_sdiv/SMOD64, non-zero imm divisor, check 3:OK > > > > #361/86 verifier_sdiv/SMOD64, non-zero imm divisor, check 3 @unpriv:OK > > > > #361/87 verifier_sdiv/SMOD64, non-zero imm divisor, check 4:OK > > > > #361/88 verifier_sdiv/SMOD64, non-zero imm divisor, check 4 @unpriv:OK > > > > #361/89 verifier_sdiv/SMOD64, non-zero imm divisor, check 5:OK > > > > #361/90 verifier_sdiv/SMOD64, non-zero imm divisor, check 5 @unpriv:OK > > > > #361/91 verifier_sdiv/SMOD64, non-zero imm divisor, check 6:OK > > > > #361/92 verifier_sdiv/SMOD64, non-zero imm divisor, check 6 @unpriv:OK > > > > #361/93 verifier_sdiv/SMOD64, non-zero imm divisor, check 7:OK > > > > #361/94 verifier_sdiv/SMOD64, non-zero imm divisor, check 7 @unpriv:OK > > > > #361/95 verifier_sdiv/SMOD64, non-zero imm divisor, check 8:OK > > > > #361/96 verifier_sdiv/SMOD64, non-zero imm divisor, check 8 @unpriv:OK > > > > #361/97 verifier_sdiv/SMOD64, non-zero reg divisor, check 1:OK > > > > #361/98 verifier_sdiv/SMOD64, non-zero reg divisor, check 1 @unpriv:OK > > > > #361/99 verifier_sdiv/SMOD64, non-zero reg divisor, check 2:OK > > > > #361/100 verifier_sdiv/SMOD64, non-zero reg divisor, check 2 @unpriv:OK > > > > #361/101 verifier_sdiv/SMOD64, non-zero reg divisor, check 3:OK > > > > #361/102 verifier_sdiv/SMOD64, non-zero reg divisor, check 3 @unpriv:OK > > > > #361/103 verifier_sdiv/SMOD64, non-zero reg divisor, check 4:OK > > > > #361/104 verifier_sdiv/SMOD64, non-zero reg divisor, check 4 @unpriv:OK > > > > #361/105 verifier_sdiv/SMOD64, non-zero reg divisor, check 5:OK > > > > #361/106 verifier_sdiv/SMOD64, non-zero reg divisor, check 5 @unpriv:OK > > > > #361/107 verifier_sdiv/SMOD64, non-zero reg divisor, check 6:OK > > > > #361/108 verifier_sdiv/SMOD64, non-zero reg divisor, check 6 @unpriv:OK > > > > #361/109 verifier_sdiv/SMOD64, non-zero reg divisor, check 7:OK > > > > #361/110 verifier_sdiv/SMOD64, non-zero reg divisor, check 7 @unpriv:OK > > > > #361/111 verifier_sdiv/SMOD64, non-zero reg divisor, check 8:OK > > > > #361/112 verifier_sdiv/SMOD64, non-zero reg divisor, check 8 @unpriv:OK > > > > #361/113 verifier_sdiv/SDIV32, zero divisor:OK > > > > #361/114 verifier_sdiv/SDIV32, zero divisor @unpriv:OK > > > > #361/115 verifier_sdiv/SDIV64, zero divisor:OK > > > > #361/116 verifier_sdiv/SDIV64, zero divisor @unpriv:OK > > > > #361/117 verifier_sdiv/SMOD32, zero divisor:OK > > > > #361/118 verifier_sdiv/SMOD32, zero divisor @unpriv:OK > > > > #361/119 verifier_sdiv/SMOD64, zero divisor:OK > > > > #361/120 verifier_sdiv/SMOD64, zero divisor @unpriv:OK > > > > #361 verifier_sdiv:OK > > > > Summary: 5/163 PASSED, 0 SKIPPED, 0 FAILED > > > > > > > > # ./test_progs -t ldsx_insn > > > > test_map_val_and_probed_memory:PASS:test_ldsx_insn__open 0 nsec > > > > test_map_val_and_probed_memory:PASS:test_ldsx_insn__load 0 nsec > > > > libbpf: prog 'test_ptr_struct_arg': failed to attach: ERROR: strerror_r(-524)=22 > > > > libbpf: prog 'test_ptr_struct_arg': failed to auto-attach: -524 > > > > test_map_val_and_probed_memory:FAIL:test_ldsx_insn__attach unexpected error: -524 (errno 524) > > > > #116/1 ldsx_insn/map_val and probed_memory:FAIL > > > > #116/2 ldsx_insn/ctx_member_sign_ext:OK > > > > #116/3 ldsx_insn/ctx_member_narrow_sign_ext:OK > > > > #116 ldsx_insn:FAIL > > > Thank you for your effort, but why is there a failure? Can it be solved? > > > > > > > As I said in the above commit message, the feature is not implemented yet. > > I will follow up but not in this series. > Why not in this series? Because that's a separate feature, and don't have to couple with this one, I guess. > Too difficult to implement? It takes time anyway. I wish there was more docs on the magic instruction opcodes. :) > Huacai > > > > > Huacai > > > > > > > > > > > All error logs: > > > > test_map_val_and_probed_memory:PASS:test_ldsx_insn__open 0 nsec > > > > test_map_val_and_probed_memory:PASS:test_ldsx_insn__load 0 nsec > > > > libbpf: prog 'test_ptr_struct_arg': failed to attach: ERROR: strerror_r(-524)=22 > > > > libbpf: prog 'test_ptr_struct_arg': failed to auto-attach: -524 > > > > test_map_val_and_probed_memory:FAIL:test_ldsx_insn__attach unexpected error: -524 (errno 524) > > > > #116/1 ldsx_insn/map_val and probed_memory:FAIL > > > > #116 ldsx_insn:FAIL > > > > Summary: 0/2 PASSED, 0 SKIPPED, 1 FAILED > > > > > > > > Signed-off-by: Hengqi Chen <hengqi.chen@gmail.com> > > > > --- > > > > tools/testing/selftests/bpf/progs/test_ldsx_insn.c | 3 ++- > > > > tools/testing/selftests/bpf/progs/verifier_bswap.c | 3 ++- > > > > tools/testing/selftests/bpf/progs/verifier_gotol.c | 3 ++- > > > > tools/testing/selftests/bpf/progs/verifier_ldsx.c | 3 ++- > > > > tools/testing/selftests/bpf/progs/verifier_movsx.c | 3 ++- > > > > tools/testing/selftests/bpf/progs/verifier_sdiv.c | 3 ++- > > > > 6 files changed, 12 insertions(+), 6 deletions(-) > > > > > > > > diff --git a/tools/testing/selftests/bpf/progs/test_ldsx_insn.c b/tools/testing/selftests/bpf/progs/test_ldsx_insn.c > > > > index 3ddcb3777912..2a2a942737d7 100644 > > > > --- a/tools/testing/selftests/bpf/progs/test_ldsx_insn.c > > > > +++ b/tools/testing/selftests/bpf/progs/test_ldsx_insn.c > > > > @@ -7,7 +7,8 @@ > > > > > > > > #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ > > > > (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ > > > > - defined(__TARGET_ARCH_s390)) && __clang_major__ >= 18 > > > > + defined(__TARGET_ARCH_s390) || defined(__TARGET_ARCH_loongarch)) && \ > > > > + __clang_major__ >= 18 > > > > const volatile int skip = 0; > > > > #else > > > > const volatile int skip = 1; > > > > diff --git a/tools/testing/selftests/bpf/progs/verifier_bswap.c b/tools/testing/selftests/bpf/progs/verifier_bswap.c > > > > index 107525fb4a6a..e61755656e8d 100644 > > > > --- a/tools/testing/selftests/bpf/progs/verifier_bswap.c > > > > +++ b/tools/testing/selftests/bpf/progs/verifier_bswap.c > > > > @@ -6,7 +6,8 @@ > > > > > > > > #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ > > > > (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ > > > > - defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390)) && \ > > > > + defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390) || \ > > > > + defined(__TARGET_ARCH_loongarch)) && \ > > > > __clang_major__ >= 18 > > > > > > > > SEC("socket") > > > > diff --git a/tools/testing/selftests/bpf/progs/verifier_gotol.c b/tools/testing/selftests/bpf/progs/verifier_gotol.c > > > > index 9f202eda952f..d1edbcff9a18 100644 > > > > --- a/tools/testing/selftests/bpf/progs/verifier_gotol.c > > > > +++ b/tools/testing/selftests/bpf/progs/verifier_gotol.c > > > > @@ -6,7 +6,8 @@ > > > > > > > > #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ > > > > (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ > > > > - defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390)) && \ > > > > + defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390) || \ > > > > + defined(__TARGET_ARCH_loongarch)) && \ > > > > __clang_major__ >= 18 > > > > > > > > SEC("socket") > > > > diff --git a/tools/testing/selftests/bpf/progs/verifier_ldsx.c b/tools/testing/selftests/bpf/progs/verifier_ldsx.c > > > > index 375525329637..d4427d8e1217 100644 > > > > --- a/tools/testing/selftests/bpf/progs/verifier_ldsx.c > > > > +++ b/tools/testing/selftests/bpf/progs/verifier_ldsx.c > > > > @@ -6,7 +6,8 @@ > > > > > > > > #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ > > > > (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ > > > > - defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390)) && \ > > > > + defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390) || \ > > > > + defined(__TARGET_ARCH_loongarch)) && \ > > > > __clang_major__ >= 18 > > > > > > > > SEC("socket") > > > > diff --git a/tools/testing/selftests/bpf/progs/verifier_movsx.c b/tools/testing/selftests/bpf/progs/verifier_movsx.c > > > > index b2a04d1179d0..cbb9d6714f53 100644 > > > > --- a/tools/testing/selftests/bpf/progs/verifier_movsx.c > > > > +++ b/tools/testing/selftests/bpf/progs/verifier_movsx.c > > > > @@ -6,7 +6,8 @@ > > > > > > > > #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ > > > > (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ > > > > - defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390)) && \ > > > > + defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390) || \ > > > > + defined(__TARGET_ARCH_loongarch)) && \ > > > > __clang_major__ >= 18 > > > > > > > > SEC("socket") > > > > diff --git a/tools/testing/selftests/bpf/progs/verifier_sdiv.c b/tools/testing/selftests/bpf/progs/verifier_sdiv.c > > > > index 8fc5174808b2..2a2271cf0294 100644 > > > > --- a/tools/testing/selftests/bpf/progs/verifier_sdiv.c > > > > +++ b/tools/testing/selftests/bpf/progs/verifier_sdiv.c > > > > @@ -6,7 +6,8 @@ > > > > > > > > #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ > > > > (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ > > > > - defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390)) && \ > > > > + defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390) || \ > > > > + defined(__TARGET_ARCH_loongarch)) && \ > > > > __clang_major__ >= 18 > > > > > > > > SEC("socket") > > > > -- > > > > 2.34.1 > > > > > > >
Hi, Hengqi, On Fri, Oct 27, 2023 at 5:41 PM Hengqi Chen <hengqi.chen@gmail.com> wrote: > > On Fri, Oct 27, 2023 at 4:42 PM Huacai Chen <chenhuacai@kernel.org> wrote: > > > > On Fri, Oct 27, 2023 at 4:40 PM Hengqi Chen <hengqi.chen@gmail.com> wrote: > > > > > > On Fri, Oct 27, 2023 at 3:05 PM Huacai Chen <chenhuacai@kernel.org> wrote: > > > > > > > > Hi, Hengqi, > > > > > > > > On Fri, Oct 27, 2023 at 2:01 PM Hengqi Chen <hengqi.chen@gmail.com> wrote: > > > > > > > > > > Enable cpu v4 tests for LoongArch. Currently, we don't > > > > > have BPF trampoline in LoongArch JIT, so the fentry > > > > > test `test_ptr_struct_arg` still failed, will followup. > > > > > Test result attached below: > > > > > > > > > > # ./test_progs -t verifier_sdiv,verifier_movsx,verifier_ldsx,verifier_gotol,verifier_bswap > > > > > #316/1 verifier_bswap/BSWAP, 16:OK > > > > > #316/2 verifier_bswap/BSWAP, 16 @unpriv:OK > > > > > #316/3 verifier_bswap/BSWAP, 32:OK > > > > > #316/4 verifier_bswap/BSWAP, 32 @unpriv:OK > > > > > #316/5 verifier_bswap/BSWAP, 64:OK > > > > > #316/6 verifier_bswap/BSWAP, 64 @unpriv:OK > > > > > #316 verifier_bswap:OK > > > > > #330/1 verifier_gotol/gotol, small_imm:OK > > > > > #330/2 verifier_gotol/gotol, small_imm @unpriv:OK > > > > > #330 verifier_gotol:OK > > > > > #338/1 verifier_ldsx/LDSX, S8:OK > > > > > #338/2 verifier_ldsx/LDSX, S8 @unpriv:OK > > > > > #338/3 verifier_ldsx/LDSX, S16:OK > > > > > #338/4 verifier_ldsx/LDSX, S16 @unpriv:OK > > > > > #338/5 verifier_ldsx/LDSX, S32:OK > > > > > #338/6 verifier_ldsx/LDSX, S32 @unpriv:OK > > > > > #338/7 verifier_ldsx/LDSX, S8 range checking, privileged:OK > > > > > #338/8 verifier_ldsx/LDSX, S16 range checking:OK > > > > > #338/9 verifier_ldsx/LDSX, S16 range checking @unpriv:OK > > > > > #338/10 verifier_ldsx/LDSX, S32 range checking:OK > > > > > #338/11 verifier_ldsx/LDSX, S32 range checking @unpriv:OK > > > > > #338 verifier_ldsx:OK > > > > > #349/1 verifier_movsx/MOV32SX, S8:OK > > > > > #349/2 verifier_movsx/MOV32SX, S8 @unpriv:OK > > > > > #349/3 verifier_movsx/MOV32SX, S16:OK > > > > > #349/4 verifier_movsx/MOV32SX, S16 @unpriv:OK > > > > > #349/5 verifier_movsx/MOV64SX, S8:OK > > > > > #349/6 verifier_movsx/MOV64SX, S8 @unpriv:OK > > > > > #349/7 verifier_movsx/MOV64SX, S16:OK > > > > > #349/8 verifier_movsx/MOV64SX, S16 @unpriv:OK > > > > > #349/9 verifier_movsx/MOV64SX, S32:OK > > > > > #349/10 verifier_movsx/MOV64SX, S32 @unpriv:OK > > > > > #349/11 verifier_movsx/MOV32SX, S8, range_check:OK > > > > > #349/12 verifier_movsx/MOV32SX, S8, range_check @unpriv:OK > > > > > #349/13 verifier_movsx/MOV32SX, S16, range_check:OK > > > > > #349/14 verifier_movsx/MOV32SX, S16, range_check @unpriv:OK > > > > > #349/15 verifier_movsx/MOV32SX, S16, range_check 2:OK > > > > > #349/16 verifier_movsx/MOV32SX, S16, range_check 2 @unpriv:OK > > > > > #349/17 verifier_movsx/MOV64SX, S8, range_check:OK > > > > > #349/18 verifier_movsx/MOV64SX, S8, range_check @unpriv:OK > > > > > #349/19 verifier_movsx/MOV64SX, S16, range_check:OK > > > > > #349/20 verifier_movsx/MOV64SX, S16, range_check @unpriv:OK > > > > > #349/21 verifier_movsx/MOV64SX, S32, range_check:OK > > > > > #349/22 verifier_movsx/MOV64SX, S32, range_check @unpriv:OK > > > > > #349/23 verifier_movsx/MOV64SX, S16, R10 Sign Extension:OK > > > > > #349/24 verifier_movsx/MOV64SX, S16, R10 Sign Extension @unpriv:OK > > > > > #349 verifier_movsx:OK > > > > > #361/1 verifier_sdiv/SDIV32, non-zero imm divisor, check 1:OK > > > > > #361/2 verifier_sdiv/SDIV32, non-zero imm divisor, check 1 @unpriv:OK > > > > > #361/3 verifier_sdiv/SDIV32, non-zero imm divisor, check 2:OK > > > > > #361/4 verifier_sdiv/SDIV32, non-zero imm divisor, check 2 @unpriv:OK > > > > > #361/5 verifier_sdiv/SDIV32, non-zero imm divisor, check 3:OK > > > > > #361/6 verifier_sdiv/SDIV32, non-zero imm divisor, check 3 @unpriv:OK > > > > > #361/7 verifier_sdiv/SDIV32, non-zero imm divisor, check 4:OK > > > > > #361/8 verifier_sdiv/SDIV32, non-zero imm divisor, check 4 @unpriv:OK > > > > > #361/9 verifier_sdiv/SDIV32, non-zero imm divisor, check 5:OK > > > > > #361/10 verifier_sdiv/SDIV32, non-zero imm divisor, check 5 @unpriv:OK > > > > > #361/11 verifier_sdiv/SDIV32, non-zero imm divisor, check 6:OK > > > > > #361/12 verifier_sdiv/SDIV32, non-zero imm divisor, check 6 @unpriv:OK > > > > > #361/13 verifier_sdiv/SDIV32, non-zero imm divisor, check 7:OK > > > > > #361/14 verifier_sdiv/SDIV32, non-zero imm divisor, check 7 @unpriv:OK > > > > > #361/15 verifier_sdiv/SDIV32, non-zero imm divisor, check 8:OK > > > > > #361/16 verifier_sdiv/SDIV32, non-zero imm divisor, check 8 @unpriv:OK > > > > > #361/17 verifier_sdiv/SDIV32, non-zero reg divisor, check 1:OK > > > > > #361/18 verifier_sdiv/SDIV32, non-zero reg divisor, check 1 @unpriv:OK > > > > > #361/19 verifier_sdiv/SDIV32, non-zero reg divisor, check 2:OK > > > > > #361/20 verifier_sdiv/SDIV32, non-zero reg divisor, check 2 @unpriv:OK > > > > > #361/21 verifier_sdiv/SDIV32, non-zero reg divisor, check 3:OK > > > > > #361/22 verifier_sdiv/SDIV32, non-zero reg divisor, check 3 @unpriv:OK > > > > > #361/23 verifier_sdiv/SDIV32, non-zero reg divisor, check 4:OK > > > > > #361/24 verifier_sdiv/SDIV32, non-zero reg divisor, check 4 @unpriv:OK > > > > > #361/25 verifier_sdiv/SDIV32, non-zero reg divisor, check 5:OK > > > > > #361/26 verifier_sdiv/SDIV32, non-zero reg divisor, check 5 @unpriv:OK > > > > > #361/27 verifier_sdiv/SDIV32, non-zero reg divisor, check 6:OK > > > > > #361/28 verifier_sdiv/SDIV32, non-zero reg divisor, check 6 @unpriv:OK > > > > > #361/29 verifier_sdiv/SDIV32, non-zero reg divisor, check 7:OK > > > > > #361/30 verifier_sdiv/SDIV32, non-zero reg divisor, check 7 @unpriv:OK > > > > > #361/31 verifier_sdiv/SDIV32, non-zero reg divisor, check 8:OK > > > > > #361/32 verifier_sdiv/SDIV32, non-zero reg divisor, check 8 @unpriv:OK > > > > > #361/33 verifier_sdiv/SDIV64, non-zero imm divisor, check 1:OK > > > > > #361/34 verifier_sdiv/SDIV64, non-zero imm divisor, check 1 @unpriv:OK > > > > > #361/35 verifier_sdiv/SDIV64, non-zero imm divisor, check 2:OK > > > > > #361/36 verifier_sdiv/SDIV64, non-zero imm divisor, check 2 @unpriv:OK > > > > > #361/37 verifier_sdiv/SDIV64, non-zero imm divisor, check 3:OK > > > > > #361/38 verifier_sdiv/SDIV64, non-zero imm divisor, check 3 @unpriv:OK > > > > > #361/39 verifier_sdiv/SDIV64, non-zero imm divisor, check 4:OK > > > > > #361/40 verifier_sdiv/SDIV64, non-zero imm divisor, check 4 @unpriv:OK > > > > > #361/41 verifier_sdiv/SDIV64, non-zero imm divisor, check 5:OK > > > > > #361/42 verifier_sdiv/SDIV64, non-zero imm divisor, check 5 @unpriv:OK > > > > > #361/43 verifier_sdiv/SDIV64, non-zero imm divisor, check 6:OK > > > > > #361/44 verifier_sdiv/SDIV64, non-zero imm divisor, check 6 @unpriv:OK > > > > > #361/45 verifier_sdiv/SDIV64, non-zero reg divisor, check 1:OK > > > > > #361/46 verifier_sdiv/SDIV64, non-zero reg divisor, check 1 @unpriv:OK > > > > > #361/47 verifier_sdiv/SDIV64, non-zero reg divisor, check 2:OK > > > > > #361/48 verifier_sdiv/SDIV64, non-zero reg divisor, check 2 @unpriv:OK > > > > > #361/49 verifier_sdiv/SDIV64, non-zero reg divisor, check 3:OK > > > > > #361/50 verifier_sdiv/SDIV64, non-zero reg divisor, check 3 @unpriv:OK > > > > > #361/51 verifier_sdiv/SDIV64, non-zero reg divisor, check 4:OK > > > > > #361/52 verifier_sdiv/SDIV64, non-zero reg divisor, check 4 @unpriv:OK > > > > > #361/53 verifier_sdiv/SDIV64, non-zero reg divisor, check 5:OK > > > > > #361/54 verifier_sdiv/SDIV64, non-zero reg divisor, check 5 @unpriv:OK > > > > > #361/55 verifier_sdiv/SDIV64, non-zero reg divisor, check 6:OK > > > > > #361/56 verifier_sdiv/SDIV64, non-zero reg divisor, check 6 @unpriv:OK > > > > > #361/57 verifier_sdiv/SMOD32, non-zero imm divisor, check 1:OK > > > > > #361/58 verifier_sdiv/SMOD32, non-zero imm divisor, check 1 @unpriv:OK > > > > > #361/59 verifier_sdiv/SMOD32, non-zero imm divisor, check 2:OK > > > > > #361/60 verifier_sdiv/SMOD32, non-zero imm divisor, check 2 @unpriv:OK > > > > > #361/61 verifier_sdiv/SMOD32, non-zero imm divisor, check 3:OK > > > > > #361/62 verifier_sdiv/SMOD32, non-zero imm divisor, check 3 @unpriv:OK > > > > > #361/63 verifier_sdiv/SMOD32, non-zero imm divisor, check 4:OK > > > > > #361/64 verifier_sdiv/SMOD32, non-zero imm divisor, check 4 @unpriv:OK > > > > > #361/65 verifier_sdiv/SMOD32, non-zero imm divisor, check 5:OK > > > > > #361/66 verifier_sdiv/SMOD32, non-zero imm divisor, check 5 @unpriv:OK > > > > > #361/67 verifier_sdiv/SMOD32, non-zero imm divisor, check 6:OK > > > > > #361/68 verifier_sdiv/SMOD32, non-zero imm divisor, check 6 @unpriv:OK > > > > > #361/69 verifier_sdiv/SMOD32, non-zero reg divisor, check 1:OK > > > > > #361/70 verifier_sdiv/SMOD32, non-zero reg divisor, check 1 @unpriv:OK > > > > > #361/71 verifier_sdiv/SMOD32, non-zero reg divisor, check 2:OK > > > > > #361/72 verifier_sdiv/SMOD32, non-zero reg divisor, check 2 @unpriv:OK > > > > > #361/73 verifier_sdiv/SMOD32, non-zero reg divisor, check 3:OK > > > > > #361/74 verifier_sdiv/SMOD32, non-zero reg divisor, check 3 @unpriv:OK > > > > > #361/75 verifier_sdiv/SMOD32, non-zero reg divisor, check 4:OK > > > > > #361/76 verifier_sdiv/SMOD32, non-zero reg divisor, check 4 @unpriv:OK > > > > > #361/77 verifier_sdiv/SMOD32, non-zero reg divisor, check 5:OK > > > > > #361/78 verifier_sdiv/SMOD32, non-zero reg divisor, check 5 @unpriv:OK > > > > > #361/79 verifier_sdiv/SMOD32, non-zero reg divisor, check 6:OK > > > > > #361/80 verifier_sdiv/SMOD32, non-zero reg divisor, check 6 @unpriv:OK > > > > > #361/81 verifier_sdiv/SMOD64, non-zero imm divisor, check 1:OK > > > > > #361/82 verifier_sdiv/SMOD64, non-zero imm divisor, check 1 @unpriv:OK > > > > > #361/83 verifier_sdiv/SMOD64, non-zero imm divisor, check 2:OK > > > > > #361/84 verifier_sdiv/SMOD64, non-zero imm divisor, check 2 @unpriv:OK > > > > > #361/85 verifier_sdiv/SMOD64, non-zero imm divisor, check 3:OK > > > > > #361/86 verifier_sdiv/SMOD64, non-zero imm divisor, check 3 @unpriv:OK > > > > > #361/87 verifier_sdiv/SMOD64, non-zero imm divisor, check 4:OK > > > > > #361/88 verifier_sdiv/SMOD64, non-zero imm divisor, check 4 @unpriv:OK > > > > > #361/89 verifier_sdiv/SMOD64, non-zero imm divisor, check 5:OK > > > > > #361/90 verifier_sdiv/SMOD64, non-zero imm divisor, check 5 @unpriv:OK > > > > > #361/91 verifier_sdiv/SMOD64, non-zero imm divisor, check 6:OK > > > > > #361/92 verifier_sdiv/SMOD64, non-zero imm divisor, check 6 @unpriv:OK > > > > > #361/93 verifier_sdiv/SMOD64, non-zero imm divisor, check 7:OK > > > > > #361/94 verifier_sdiv/SMOD64, non-zero imm divisor, check 7 @unpriv:OK > > > > > #361/95 verifier_sdiv/SMOD64, non-zero imm divisor, check 8:OK > > > > > #361/96 verifier_sdiv/SMOD64, non-zero imm divisor, check 8 @unpriv:OK > > > > > #361/97 verifier_sdiv/SMOD64, non-zero reg divisor, check 1:OK > > > > > #361/98 verifier_sdiv/SMOD64, non-zero reg divisor, check 1 @unpriv:OK > > > > > #361/99 verifier_sdiv/SMOD64, non-zero reg divisor, check 2:OK > > > > > #361/100 verifier_sdiv/SMOD64, non-zero reg divisor, check 2 @unpriv:OK > > > > > #361/101 verifier_sdiv/SMOD64, non-zero reg divisor, check 3:OK > > > > > #361/102 verifier_sdiv/SMOD64, non-zero reg divisor, check 3 @unpriv:OK > > > > > #361/103 verifier_sdiv/SMOD64, non-zero reg divisor, check 4:OK > > > > > #361/104 verifier_sdiv/SMOD64, non-zero reg divisor, check 4 @unpriv:OK > > > > > #361/105 verifier_sdiv/SMOD64, non-zero reg divisor, check 5:OK > > > > > #361/106 verifier_sdiv/SMOD64, non-zero reg divisor, check 5 @unpriv:OK > > > > > #361/107 verifier_sdiv/SMOD64, non-zero reg divisor, check 6:OK > > > > > #361/108 verifier_sdiv/SMOD64, non-zero reg divisor, check 6 @unpriv:OK > > > > > #361/109 verifier_sdiv/SMOD64, non-zero reg divisor, check 7:OK > > > > > #361/110 verifier_sdiv/SMOD64, non-zero reg divisor, check 7 @unpriv:OK > > > > > #361/111 verifier_sdiv/SMOD64, non-zero reg divisor, check 8:OK > > > > > #361/112 verifier_sdiv/SMOD64, non-zero reg divisor, check 8 @unpriv:OK > > > > > #361/113 verifier_sdiv/SDIV32, zero divisor:OK > > > > > #361/114 verifier_sdiv/SDIV32, zero divisor @unpriv:OK > > > > > #361/115 verifier_sdiv/SDIV64, zero divisor:OK > > > > > #361/116 verifier_sdiv/SDIV64, zero divisor @unpriv:OK > > > > > #361/117 verifier_sdiv/SMOD32, zero divisor:OK > > > > > #361/118 verifier_sdiv/SMOD32, zero divisor @unpriv:OK > > > > > #361/119 verifier_sdiv/SMOD64, zero divisor:OK > > > > > #361/120 verifier_sdiv/SMOD64, zero divisor @unpriv:OK > > > > > #361 verifier_sdiv:OK > > > > > Summary: 5/163 PASSED, 0 SKIPPED, 0 FAILED > > > > > > > > > > # ./test_progs -t ldsx_insn > > > > > test_map_val_and_probed_memory:PASS:test_ldsx_insn__open 0 nsec > > > > > test_map_val_and_probed_memory:PASS:test_ldsx_insn__load 0 nsec > > > > > libbpf: prog 'test_ptr_struct_arg': failed to attach: ERROR: strerror_r(-524)=22 > > > > > libbpf: prog 'test_ptr_struct_arg': failed to auto-attach: -524 > > > > > test_map_val_and_probed_memory:FAIL:test_ldsx_insn__attach unexpected error: -524 (errno 524) > > > > > #116/1 ldsx_insn/map_val and probed_memory:FAIL > > > > > #116/2 ldsx_insn/ctx_member_sign_ext:OK > > > > > #116/3 ldsx_insn/ctx_member_narrow_sign_ext:OK > > > > > #116 ldsx_insn:FAIL > > > > Thank you for your effort, but why is there a failure? Can it be solved? > > > > > > > > > > As I said in the above commit message, the feature is not implemented yet. > > > I will follow up but not in this series. > > Why not in this series? > > Because that's a separate feature, and don't have to couple with this > one, I guess. OK, I know. > > > Too difficult to implement? > > It takes time anyway. > I wish there was more docs on the magic instruction opcodes. :) Then let Tiezhu review this series since he is a BPF expert. Huacai > > > Huacai > > > > > > > Huacai > > > > > > > > > > > > > > All error logs: > > > > > test_map_val_and_probed_memory:PASS:test_ldsx_insn__open 0 nsec > > > > > test_map_val_and_probed_memory:PASS:test_ldsx_insn__load 0 nsec > > > > > libbpf: prog 'test_ptr_struct_arg': failed to attach: ERROR: strerror_r(-524)=22 > > > > > libbpf: prog 'test_ptr_struct_arg': failed to auto-attach: -524 > > > > > test_map_val_and_probed_memory:FAIL:test_ldsx_insn__attach unexpected error: -524 (errno 524) > > > > > #116/1 ldsx_insn/map_val and probed_memory:FAIL > > > > > #116 ldsx_insn:FAIL > > > > > Summary: 0/2 PASSED, 0 SKIPPED, 1 FAILED > > > > > > > > > > Signed-off-by: Hengqi Chen <hengqi.chen@gmail.com> > > > > > --- > > > > > tools/testing/selftests/bpf/progs/test_ldsx_insn.c | 3 ++- > > > > > tools/testing/selftests/bpf/progs/verifier_bswap.c | 3 ++- > > > > > tools/testing/selftests/bpf/progs/verifier_gotol.c | 3 ++- > > > > > tools/testing/selftests/bpf/progs/verifier_ldsx.c | 3 ++- > > > > > tools/testing/selftests/bpf/progs/verifier_movsx.c | 3 ++- > > > > > tools/testing/selftests/bpf/progs/verifier_sdiv.c | 3 ++- > > > > > 6 files changed, 12 insertions(+), 6 deletions(-) > > > > > > > > > > diff --git a/tools/testing/selftests/bpf/progs/test_ldsx_insn.c b/tools/testing/selftests/bpf/progs/test_ldsx_insn.c > > > > > index 3ddcb3777912..2a2a942737d7 100644 > > > > > --- a/tools/testing/selftests/bpf/progs/test_ldsx_insn.c > > > > > +++ b/tools/testing/selftests/bpf/progs/test_ldsx_insn.c > > > > > @@ -7,7 +7,8 @@ > > > > > > > > > > #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ > > > > > (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ > > > > > - defined(__TARGET_ARCH_s390)) && __clang_major__ >= 18 > > > > > + defined(__TARGET_ARCH_s390) || defined(__TARGET_ARCH_loongarch)) && \ > > > > > + __clang_major__ >= 18 > > > > > const volatile int skip = 0; > > > > > #else > > > > > const volatile int skip = 1; > > > > > diff --git a/tools/testing/selftests/bpf/progs/verifier_bswap.c b/tools/testing/selftests/bpf/progs/verifier_bswap.c > > > > > index 107525fb4a6a..e61755656e8d 100644 > > > > > --- a/tools/testing/selftests/bpf/progs/verifier_bswap.c > > > > > +++ b/tools/testing/selftests/bpf/progs/verifier_bswap.c > > > > > @@ -6,7 +6,8 @@ > > > > > > > > > > #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ > > > > > (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ > > > > > - defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390)) && \ > > > > > + defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390) || \ > > > > > + defined(__TARGET_ARCH_loongarch)) && \ > > > > > __clang_major__ >= 18 > > > > > > > > > > SEC("socket") > > > > > diff --git a/tools/testing/selftests/bpf/progs/verifier_gotol.c b/tools/testing/selftests/bpf/progs/verifier_gotol.c > > > > > index 9f202eda952f..d1edbcff9a18 100644 > > > > > --- a/tools/testing/selftests/bpf/progs/verifier_gotol.c > > > > > +++ b/tools/testing/selftests/bpf/progs/verifier_gotol.c > > > > > @@ -6,7 +6,8 @@ > > > > > > > > > > #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ > > > > > (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ > > > > > - defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390)) && \ > > > > > + defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390) || \ > > > > > + defined(__TARGET_ARCH_loongarch)) && \ > > > > > __clang_major__ >= 18 > > > > > > > > > > SEC("socket") > > > > > diff --git a/tools/testing/selftests/bpf/progs/verifier_ldsx.c b/tools/testing/selftests/bpf/progs/verifier_ldsx.c > > > > > index 375525329637..d4427d8e1217 100644 > > > > > --- a/tools/testing/selftests/bpf/progs/verifier_ldsx.c > > > > > +++ b/tools/testing/selftests/bpf/progs/verifier_ldsx.c > > > > > @@ -6,7 +6,8 @@ > > > > > > > > > > #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ > > > > > (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ > > > > > - defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390)) && \ > > > > > + defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390) || \ > > > > > + defined(__TARGET_ARCH_loongarch)) && \ > > > > > __clang_major__ >= 18 > > > > > > > > > > SEC("socket") > > > > > diff --git a/tools/testing/selftests/bpf/progs/verifier_movsx.c b/tools/testing/selftests/bpf/progs/verifier_movsx.c > > > > > index b2a04d1179d0..cbb9d6714f53 100644 > > > > > --- a/tools/testing/selftests/bpf/progs/verifier_movsx.c > > > > > +++ b/tools/testing/selftests/bpf/progs/verifier_movsx.c > > > > > @@ -6,7 +6,8 @@ > > > > > > > > > > #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ > > > > > (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ > > > > > - defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390)) && \ > > > > > + defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390) || \ > > > > > + defined(__TARGET_ARCH_loongarch)) && \ > > > > > __clang_major__ >= 18 > > > > > > > > > > SEC("socket") > > > > > diff --git a/tools/testing/selftests/bpf/progs/verifier_sdiv.c b/tools/testing/selftests/bpf/progs/verifier_sdiv.c > > > > > index 8fc5174808b2..2a2271cf0294 100644 > > > > > --- a/tools/testing/selftests/bpf/progs/verifier_sdiv.c > > > > > +++ b/tools/testing/selftests/bpf/progs/verifier_sdiv.c > > > > > @@ -6,7 +6,8 @@ > > > > > > > > > > #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ > > > > > (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ > > > > > - defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390)) && \ > > > > > + defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390) || \ > > > > > + defined(__TARGET_ARCH_loongarch)) && \ > > > > > __clang_major__ >= 18 > > > > > > > > > > SEC("socket") > > > > > -- > > > > > 2.34.1 > > > > > > > > > >
Hi, Hengqi, I applied this series here: https://github.com/chenhuacai/linux/commits/loongarch-next But I have some problems, see below. On Fri, Oct 27, 2023 at 2:01 PM Hengqi Chen <hengqi.chen@gmail.com> wrote: > > Enable cpu v4 tests for LoongArch. Currently, we don't > have BPF trampoline in LoongArch JIT, so the fentry > test `test_ptr_struct_arg` still failed, will followup. > Test result attached below: > > # ./test_progs -t verifier_sdiv,verifier_movsx,verifier_ldsx,verifier_gotol,verifier_bswap If I disable unprivileged bpf, these tests pass, but unprivileged tests are skipped; if I enable unprivileged bpf, the 'verifier_movsx' causes the system hang. > #316/1 verifier_bswap/BSWAP, 16:OK > #316/2 verifier_bswap/BSWAP, 16 @unpriv:OK > #316/3 verifier_bswap/BSWAP, 32:OK > #316/4 verifier_bswap/BSWAP, 32 @unpriv:OK > #316/5 verifier_bswap/BSWAP, 64:OK > #316/6 verifier_bswap/BSWAP, 64 @unpriv:OK > #316 verifier_bswap:OK > #330/1 verifier_gotol/gotol, small_imm:OK > #330/2 verifier_gotol/gotol, small_imm @unpriv:OK > #330 verifier_gotol:OK > #338/1 verifier_ldsx/LDSX, S8:OK > #338/2 verifier_ldsx/LDSX, S8 @unpriv:OK > #338/3 verifier_ldsx/LDSX, S16:OK > #338/4 verifier_ldsx/LDSX, S16 @unpriv:OK > #338/5 verifier_ldsx/LDSX, S32:OK > #338/6 verifier_ldsx/LDSX, S32 @unpriv:OK > #338/7 verifier_ldsx/LDSX, S8 range checking, privileged:OK > #338/8 verifier_ldsx/LDSX, S16 range checking:OK > #338/9 verifier_ldsx/LDSX, S16 range checking @unpriv:OK > #338/10 verifier_ldsx/LDSX, S32 range checking:OK > #338/11 verifier_ldsx/LDSX, S32 range checking @unpriv:OK > #338 verifier_ldsx:OK > #349/1 verifier_movsx/MOV32SX, S8:OK > #349/2 verifier_movsx/MOV32SX, S8 @unpriv:OK > #349/3 verifier_movsx/MOV32SX, S16:OK > #349/4 verifier_movsx/MOV32SX, S16 @unpriv:OK > #349/5 verifier_movsx/MOV64SX, S8:OK > #349/6 verifier_movsx/MOV64SX, S8 @unpriv:OK > #349/7 verifier_movsx/MOV64SX, S16:OK > #349/8 verifier_movsx/MOV64SX, S16 @unpriv:OK > #349/9 verifier_movsx/MOV64SX, S32:OK > #349/10 verifier_movsx/MOV64SX, S32 @unpriv:OK > #349/11 verifier_movsx/MOV32SX, S8, range_check:OK > #349/12 verifier_movsx/MOV32SX, S8, range_check @unpriv:OK > #349/13 verifier_movsx/MOV32SX, S16, range_check:OK > #349/14 verifier_movsx/MOV32SX, S16, range_check @unpriv:OK > #349/15 verifier_movsx/MOV32SX, S16, range_check 2:OK > #349/16 verifier_movsx/MOV32SX, S16, range_check 2 @unpriv:OK > #349/17 verifier_movsx/MOV64SX, S8, range_check:OK > #349/18 verifier_movsx/MOV64SX, S8, range_check @unpriv:OK > #349/19 verifier_movsx/MOV64SX, S16, range_check:OK > #349/20 verifier_movsx/MOV64SX, S16, range_check @unpriv:OK > #349/21 verifier_movsx/MOV64SX, S32, range_check:OK > #349/22 verifier_movsx/MOV64SX, S32, range_check @unpriv:OK > #349/23 verifier_movsx/MOV64SX, S16, R10 Sign Extension:OK > #349/24 verifier_movsx/MOV64SX, S16, R10 Sign Extension @unpriv:OK > #349 verifier_movsx:OK > #361/1 verifier_sdiv/SDIV32, non-zero imm divisor, check 1:OK > #361/2 verifier_sdiv/SDIV32, non-zero imm divisor, check 1 @unpriv:OK > #361/3 verifier_sdiv/SDIV32, non-zero imm divisor, check 2:OK > #361/4 verifier_sdiv/SDIV32, non-zero imm divisor, check 2 @unpriv:OK > #361/5 verifier_sdiv/SDIV32, non-zero imm divisor, check 3:OK > #361/6 verifier_sdiv/SDIV32, non-zero imm divisor, check 3 @unpriv:OK > #361/7 verifier_sdiv/SDIV32, non-zero imm divisor, check 4:OK > #361/8 verifier_sdiv/SDIV32, non-zero imm divisor, check 4 @unpriv:OK > #361/9 verifier_sdiv/SDIV32, non-zero imm divisor, check 5:OK > #361/10 verifier_sdiv/SDIV32, non-zero imm divisor, check 5 @unpriv:OK > #361/11 verifier_sdiv/SDIV32, non-zero imm divisor, check 6:OK > #361/12 verifier_sdiv/SDIV32, non-zero imm divisor, check 6 @unpriv:OK > #361/13 verifier_sdiv/SDIV32, non-zero imm divisor, check 7:OK > #361/14 verifier_sdiv/SDIV32, non-zero imm divisor, check 7 @unpriv:OK > #361/15 verifier_sdiv/SDIV32, non-zero imm divisor, check 8:OK > #361/16 verifier_sdiv/SDIV32, non-zero imm divisor, check 8 @unpriv:OK > #361/17 verifier_sdiv/SDIV32, non-zero reg divisor, check 1:OK > #361/18 verifier_sdiv/SDIV32, non-zero reg divisor, check 1 @unpriv:OK > #361/19 verifier_sdiv/SDIV32, non-zero reg divisor, check 2:OK > #361/20 verifier_sdiv/SDIV32, non-zero reg divisor, check 2 @unpriv:OK > #361/21 verifier_sdiv/SDIV32, non-zero reg divisor, check 3:OK > #361/22 verifier_sdiv/SDIV32, non-zero reg divisor, check 3 @unpriv:OK > #361/23 verifier_sdiv/SDIV32, non-zero reg divisor, check 4:OK > #361/24 verifier_sdiv/SDIV32, non-zero reg divisor, check 4 @unpriv:OK > #361/25 verifier_sdiv/SDIV32, non-zero reg divisor, check 5:OK > #361/26 verifier_sdiv/SDIV32, non-zero reg divisor, check 5 @unpriv:OK > #361/27 verifier_sdiv/SDIV32, non-zero reg divisor, check 6:OK > #361/28 verifier_sdiv/SDIV32, non-zero reg divisor, check 6 @unpriv:OK > #361/29 verifier_sdiv/SDIV32, non-zero reg divisor, check 7:OK > #361/30 verifier_sdiv/SDIV32, non-zero reg divisor, check 7 @unpriv:OK > #361/31 verifier_sdiv/SDIV32, non-zero reg divisor, check 8:OK > #361/32 verifier_sdiv/SDIV32, non-zero reg divisor, check 8 @unpriv:OK > #361/33 verifier_sdiv/SDIV64, non-zero imm divisor, check 1:OK > #361/34 verifier_sdiv/SDIV64, non-zero imm divisor, check 1 @unpriv:OK > #361/35 verifier_sdiv/SDIV64, non-zero imm divisor, check 2:OK > #361/36 verifier_sdiv/SDIV64, non-zero imm divisor, check 2 @unpriv:OK > #361/37 verifier_sdiv/SDIV64, non-zero imm divisor, check 3:OK > #361/38 verifier_sdiv/SDIV64, non-zero imm divisor, check 3 @unpriv:OK > #361/39 verifier_sdiv/SDIV64, non-zero imm divisor, check 4:OK > #361/40 verifier_sdiv/SDIV64, non-zero imm divisor, check 4 @unpriv:OK > #361/41 verifier_sdiv/SDIV64, non-zero imm divisor, check 5:OK > #361/42 verifier_sdiv/SDIV64, non-zero imm divisor, check 5 @unpriv:OK > #361/43 verifier_sdiv/SDIV64, non-zero imm divisor, check 6:OK > #361/44 verifier_sdiv/SDIV64, non-zero imm divisor, check 6 @unpriv:OK > #361/45 verifier_sdiv/SDIV64, non-zero reg divisor, check 1:OK > #361/46 verifier_sdiv/SDIV64, non-zero reg divisor, check 1 @unpriv:OK > #361/47 verifier_sdiv/SDIV64, non-zero reg divisor, check 2:OK > #361/48 verifier_sdiv/SDIV64, non-zero reg divisor, check 2 @unpriv:OK > #361/49 verifier_sdiv/SDIV64, non-zero reg divisor, check 3:OK > #361/50 verifier_sdiv/SDIV64, non-zero reg divisor, check 3 @unpriv:OK > #361/51 verifier_sdiv/SDIV64, non-zero reg divisor, check 4:OK > #361/52 verifier_sdiv/SDIV64, non-zero reg divisor, check 4 @unpriv:OK > #361/53 verifier_sdiv/SDIV64, non-zero reg divisor, check 5:OK > #361/54 verifier_sdiv/SDIV64, non-zero reg divisor, check 5 @unpriv:OK > #361/55 verifier_sdiv/SDIV64, non-zero reg divisor, check 6:OK > #361/56 verifier_sdiv/SDIV64, non-zero reg divisor, check 6 @unpriv:OK > #361/57 verifier_sdiv/SMOD32, non-zero imm divisor, check 1:OK > #361/58 verifier_sdiv/SMOD32, non-zero imm divisor, check 1 @unpriv:OK > #361/59 verifier_sdiv/SMOD32, non-zero imm divisor, check 2:OK > #361/60 verifier_sdiv/SMOD32, non-zero imm divisor, check 2 @unpriv:OK > #361/61 verifier_sdiv/SMOD32, non-zero imm divisor, check 3:OK > #361/62 verifier_sdiv/SMOD32, non-zero imm divisor, check 3 @unpriv:OK > #361/63 verifier_sdiv/SMOD32, non-zero imm divisor, check 4:OK > #361/64 verifier_sdiv/SMOD32, non-zero imm divisor, check 4 @unpriv:OK > #361/65 verifier_sdiv/SMOD32, non-zero imm divisor, check 5:OK > #361/66 verifier_sdiv/SMOD32, non-zero imm divisor, check 5 @unpriv:OK > #361/67 verifier_sdiv/SMOD32, non-zero imm divisor, check 6:OK > #361/68 verifier_sdiv/SMOD32, non-zero imm divisor, check 6 @unpriv:OK > #361/69 verifier_sdiv/SMOD32, non-zero reg divisor, check 1:OK > #361/70 verifier_sdiv/SMOD32, non-zero reg divisor, check 1 @unpriv:OK > #361/71 verifier_sdiv/SMOD32, non-zero reg divisor, check 2:OK > #361/72 verifier_sdiv/SMOD32, non-zero reg divisor, check 2 @unpriv:OK > #361/73 verifier_sdiv/SMOD32, non-zero reg divisor, check 3:OK > #361/74 verifier_sdiv/SMOD32, non-zero reg divisor, check 3 @unpriv:OK > #361/75 verifier_sdiv/SMOD32, non-zero reg divisor, check 4:OK > #361/76 verifier_sdiv/SMOD32, non-zero reg divisor, check 4 @unpriv:OK > #361/77 verifier_sdiv/SMOD32, non-zero reg divisor, check 5:OK > #361/78 verifier_sdiv/SMOD32, non-zero reg divisor, check 5 @unpriv:OK > #361/79 verifier_sdiv/SMOD32, non-zero reg divisor, check 6:OK > #361/80 verifier_sdiv/SMOD32, non-zero reg divisor, check 6 @unpriv:OK > #361/81 verifier_sdiv/SMOD64, non-zero imm divisor, check 1:OK > #361/82 verifier_sdiv/SMOD64, non-zero imm divisor, check 1 @unpriv:OK > #361/83 verifier_sdiv/SMOD64, non-zero imm divisor, check 2:OK > #361/84 verifier_sdiv/SMOD64, non-zero imm divisor, check 2 @unpriv:OK > #361/85 verifier_sdiv/SMOD64, non-zero imm divisor, check 3:OK > #361/86 verifier_sdiv/SMOD64, non-zero imm divisor, check 3 @unpriv:OK > #361/87 verifier_sdiv/SMOD64, non-zero imm divisor, check 4:OK > #361/88 verifier_sdiv/SMOD64, non-zero imm divisor, check 4 @unpriv:OK > #361/89 verifier_sdiv/SMOD64, non-zero imm divisor, check 5:OK > #361/90 verifier_sdiv/SMOD64, non-zero imm divisor, check 5 @unpriv:OK > #361/91 verifier_sdiv/SMOD64, non-zero imm divisor, check 6:OK > #361/92 verifier_sdiv/SMOD64, non-zero imm divisor, check 6 @unpriv:OK > #361/93 verifier_sdiv/SMOD64, non-zero imm divisor, check 7:OK > #361/94 verifier_sdiv/SMOD64, non-zero imm divisor, check 7 @unpriv:OK > #361/95 verifier_sdiv/SMOD64, non-zero imm divisor, check 8:OK > #361/96 verifier_sdiv/SMOD64, non-zero imm divisor, check 8 @unpriv:OK > #361/97 verifier_sdiv/SMOD64, non-zero reg divisor, check 1:OK > #361/98 verifier_sdiv/SMOD64, non-zero reg divisor, check 1 @unpriv:OK > #361/99 verifier_sdiv/SMOD64, non-zero reg divisor, check 2:OK > #361/100 verifier_sdiv/SMOD64, non-zero reg divisor, check 2 @unpriv:OK > #361/101 verifier_sdiv/SMOD64, non-zero reg divisor, check 3:OK > #361/102 verifier_sdiv/SMOD64, non-zero reg divisor, check 3 @unpriv:OK > #361/103 verifier_sdiv/SMOD64, non-zero reg divisor, check 4:OK > #361/104 verifier_sdiv/SMOD64, non-zero reg divisor, check 4 @unpriv:OK > #361/105 verifier_sdiv/SMOD64, non-zero reg divisor, check 5:OK > #361/106 verifier_sdiv/SMOD64, non-zero reg divisor, check 5 @unpriv:OK > #361/107 verifier_sdiv/SMOD64, non-zero reg divisor, check 6:OK > #361/108 verifier_sdiv/SMOD64, non-zero reg divisor, check 6 @unpriv:OK > #361/109 verifier_sdiv/SMOD64, non-zero reg divisor, check 7:OK > #361/110 verifier_sdiv/SMOD64, non-zero reg divisor, check 7 @unpriv:OK > #361/111 verifier_sdiv/SMOD64, non-zero reg divisor, check 8:OK > #361/112 verifier_sdiv/SMOD64, non-zero reg divisor, check 8 @unpriv:OK > #361/113 verifier_sdiv/SDIV32, zero divisor:OK > #361/114 verifier_sdiv/SDIV32, zero divisor @unpriv:OK > #361/115 verifier_sdiv/SDIV64, zero divisor:OK > #361/116 verifier_sdiv/SDIV64, zero divisor @unpriv:OK > #361/117 verifier_sdiv/SMOD32, zero divisor:OK > #361/118 verifier_sdiv/SMOD32, zero divisor @unpriv:OK > #361/119 verifier_sdiv/SMOD64, zero divisor:OK > #361/120 verifier_sdiv/SMOD64, zero divisor @unpriv:OK > #361 verifier_sdiv:OK > Summary: 5/163 PASSED, 0 SKIPPED, 0 FAILED > > # ./test_progs -t ldsx_insn > test_map_val_and_probed_memory:PASS:test_ldsx_insn__open 0 nsec > test_map_val_and_probed_memory:PASS:test_ldsx_insn__load 0 nsec > libbpf: prog 'test_ptr_struct_arg': failed to attach: ERROR: strerror_r(-524)=22 > libbpf: prog 'test_ptr_struct_arg': failed to auto-attach: -524 > test_map_val_and_probed_memory:FAIL:test_ldsx_insn__attach unexpected error: -524 (errno 524) > #116/1 ldsx_insn/map_val and probed_memory:FAIL > #116/2 ldsx_insn/ctx_member_sign_ext:OK During my tests, 'ctx_member_sign_ext' fails. Do you know why (you can test with the code in my repo)? Thanks. Huacai > #116/3 ldsx_insn/ctx_member_narrow_sign_ext:OK > #116 ldsx_insn:FAIL > > All error logs: > test_map_val_and_probed_memory:PASS:test_ldsx_insn__open 0 nsec > test_map_val_and_probed_memory:PASS:test_ldsx_insn__load 0 nsec > libbpf: prog 'test_ptr_struct_arg': failed to attach: ERROR: strerror_r(-524)=22 > libbpf: prog 'test_ptr_struct_arg': failed to auto-attach: -524 > test_map_val_and_probed_memory:FAIL:test_ldsx_insn__attach unexpected error: -524 (errno 524) > #116/1 ldsx_insn/map_val and probed_memory:FAIL > #116 ldsx_insn:FAIL > Summary: 0/2 PASSED, 0 SKIPPED, 1 FAILED > > Signed-off-by: Hengqi Chen <hengqi.chen@gmail.com> > --- > tools/testing/selftests/bpf/progs/test_ldsx_insn.c | 3 ++- > tools/testing/selftests/bpf/progs/verifier_bswap.c | 3 ++- > tools/testing/selftests/bpf/progs/verifier_gotol.c | 3 ++- > tools/testing/selftests/bpf/progs/verifier_ldsx.c | 3 ++- > tools/testing/selftests/bpf/progs/verifier_movsx.c | 3 ++- > tools/testing/selftests/bpf/progs/verifier_sdiv.c | 3 ++- > 6 files changed, 12 insertions(+), 6 deletions(-) > > diff --git a/tools/testing/selftests/bpf/progs/test_ldsx_insn.c b/tools/testing/selftests/bpf/progs/test_ldsx_insn.c > index 3ddcb3777912..2a2a942737d7 100644 > --- a/tools/testing/selftests/bpf/progs/test_ldsx_insn.c > +++ b/tools/testing/selftests/bpf/progs/test_ldsx_insn.c > @@ -7,7 +7,8 @@ > > #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ > (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ > - defined(__TARGET_ARCH_s390)) && __clang_major__ >= 18 > + defined(__TARGET_ARCH_s390) || defined(__TARGET_ARCH_loongarch)) && \ > + __clang_major__ >= 18 > const volatile int skip = 0; > #else > const volatile int skip = 1; > diff --git a/tools/testing/selftests/bpf/progs/verifier_bswap.c b/tools/testing/selftests/bpf/progs/verifier_bswap.c > index 107525fb4a6a..e61755656e8d 100644 > --- a/tools/testing/selftests/bpf/progs/verifier_bswap.c > +++ b/tools/testing/selftests/bpf/progs/verifier_bswap.c > @@ -6,7 +6,8 @@ > > #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ > (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ > - defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390)) && \ > + defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390) || \ > + defined(__TARGET_ARCH_loongarch)) && \ > __clang_major__ >= 18 > > SEC("socket") > diff --git a/tools/testing/selftests/bpf/progs/verifier_gotol.c b/tools/testing/selftests/bpf/progs/verifier_gotol.c > index 9f202eda952f..d1edbcff9a18 100644 > --- a/tools/testing/selftests/bpf/progs/verifier_gotol.c > +++ b/tools/testing/selftests/bpf/progs/verifier_gotol.c > @@ -6,7 +6,8 @@ > > #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ > (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ > - defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390)) && \ > + defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390) || \ > + defined(__TARGET_ARCH_loongarch)) && \ > __clang_major__ >= 18 > > SEC("socket") > diff --git a/tools/testing/selftests/bpf/progs/verifier_ldsx.c b/tools/testing/selftests/bpf/progs/verifier_ldsx.c > index 375525329637..d4427d8e1217 100644 > --- a/tools/testing/selftests/bpf/progs/verifier_ldsx.c > +++ b/tools/testing/selftests/bpf/progs/verifier_ldsx.c > @@ -6,7 +6,8 @@ > > #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ > (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ > - defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390)) && \ > + defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390) || \ > + defined(__TARGET_ARCH_loongarch)) && \ > __clang_major__ >= 18 > > SEC("socket") > diff --git a/tools/testing/selftests/bpf/progs/verifier_movsx.c b/tools/testing/selftests/bpf/progs/verifier_movsx.c > index b2a04d1179d0..cbb9d6714f53 100644 > --- a/tools/testing/selftests/bpf/progs/verifier_movsx.c > +++ b/tools/testing/selftests/bpf/progs/verifier_movsx.c > @@ -6,7 +6,8 @@ > > #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ > (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ > - defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390)) && \ > + defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390) || \ > + defined(__TARGET_ARCH_loongarch)) && \ > __clang_major__ >= 18 > > SEC("socket") > diff --git a/tools/testing/selftests/bpf/progs/verifier_sdiv.c b/tools/testing/selftests/bpf/progs/verifier_sdiv.c > index 8fc5174808b2..2a2271cf0294 100644 > --- a/tools/testing/selftests/bpf/progs/verifier_sdiv.c > +++ b/tools/testing/selftests/bpf/progs/verifier_sdiv.c > @@ -6,7 +6,8 @@ > > #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ > (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ > - defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390)) && \ > + defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390) || \ > + defined(__TARGET_ARCH_loongarch)) && \ > __clang_major__ >= 18 > > SEC("socket") > -- > 2.34.1 >
Hi Huacai, On Thu, Nov 9, 2023 at 11:25 PM Huacai Chen <chenhuacai@kernel.org> wrote: > > Hi, Hengqi, > > I applied this series here: > https://github.com/chenhuacai/linux/commits/loongarch-next > > But I have some problems, see below. > > On Fri, Oct 27, 2023 at 2:01 PM Hengqi Chen <hengqi.chen@gmail.com> wrote: > > > > Enable cpu v4 tests for LoongArch. Currently, we don't > > have BPF trampoline in LoongArch JIT, so the fentry > > test `test_ptr_struct_arg` still failed, will followup. > > Test result attached below: > > > > # ./test_progs -t verifier_sdiv,verifier_movsx,verifier_ldsx,verifier_gotol,verifier_bswap > If I disable unprivileged bpf, these tests pass, but unprivileged > tests are skipped; if I enable unprivileged bpf, the 'verifier_movsx' > causes the system hang. > I can't reproduce this on my machine, see my .config at https://github.com/chenhengqi/public > > #316/1 verifier_bswap/BSWAP, 16:OK > > #316/2 verifier_bswap/BSWAP, 16 @unpriv:OK > > #316/3 verifier_bswap/BSWAP, 32:OK > > #316/4 verifier_bswap/BSWAP, 32 @unpriv:OK > > #316/5 verifier_bswap/BSWAP, 64:OK > > #316/6 verifier_bswap/BSWAP, 64 @unpriv:OK > > #316 verifier_bswap:OK > > #330/1 verifier_gotol/gotol, small_imm:OK > > #330/2 verifier_gotol/gotol, small_imm @unpriv:OK > > #330 verifier_gotol:OK > > #338/1 verifier_ldsx/LDSX, S8:OK > > #338/2 verifier_ldsx/LDSX, S8 @unpriv:OK > > #338/3 verifier_ldsx/LDSX, S16:OK > > #338/4 verifier_ldsx/LDSX, S16 @unpriv:OK > > #338/5 verifier_ldsx/LDSX, S32:OK > > #338/6 verifier_ldsx/LDSX, S32 @unpriv:OK > > #338/7 verifier_ldsx/LDSX, S8 range checking, privileged:OK > > #338/8 verifier_ldsx/LDSX, S16 range checking:OK > > #338/9 verifier_ldsx/LDSX, S16 range checking @unpriv:OK > > #338/10 verifier_ldsx/LDSX, S32 range checking:OK > > #338/11 verifier_ldsx/LDSX, S32 range checking @unpriv:OK > > #338 verifier_ldsx:OK > > #349/1 verifier_movsx/MOV32SX, S8:OK > > #349/2 verifier_movsx/MOV32SX, S8 @unpriv:OK > > #349/3 verifier_movsx/MOV32SX, S16:OK > > #349/4 verifier_movsx/MOV32SX, S16 @unpriv:OK > > #349/5 verifier_movsx/MOV64SX, S8:OK > > #349/6 verifier_movsx/MOV64SX, S8 @unpriv:OK > > #349/7 verifier_movsx/MOV64SX, S16:OK > > #349/8 verifier_movsx/MOV64SX, S16 @unpriv:OK > > #349/9 verifier_movsx/MOV64SX, S32:OK > > #349/10 verifier_movsx/MOV64SX, S32 @unpriv:OK > > #349/11 verifier_movsx/MOV32SX, S8, range_check:OK > > #349/12 verifier_movsx/MOV32SX, S8, range_check @unpriv:OK > > #349/13 verifier_movsx/MOV32SX, S16, range_check:OK > > #349/14 verifier_movsx/MOV32SX, S16, range_check @unpriv:OK > > #349/15 verifier_movsx/MOV32SX, S16, range_check 2:OK > > #349/16 verifier_movsx/MOV32SX, S16, range_check 2 @unpriv:OK > > #349/17 verifier_movsx/MOV64SX, S8, range_check:OK > > #349/18 verifier_movsx/MOV64SX, S8, range_check @unpriv:OK > > #349/19 verifier_movsx/MOV64SX, S16, range_check:OK > > #349/20 verifier_movsx/MOV64SX, S16, range_check @unpriv:OK > > #349/21 verifier_movsx/MOV64SX, S32, range_check:OK > > #349/22 verifier_movsx/MOV64SX, S32, range_check @unpriv:OK > > #349/23 verifier_movsx/MOV64SX, S16, R10 Sign Extension:OK > > #349/24 verifier_movsx/MOV64SX, S16, R10 Sign Extension @unpriv:OK > > #349 verifier_movsx:OK > > #361/1 verifier_sdiv/SDIV32, non-zero imm divisor, check 1:OK > > #361/2 verifier_sdiv/SDIV32, non-zero imm divisor, check 1 @unpriv:OK > > #361/3 verifier_sdiv/SDIV32, non-zero imm divisor, check 2:OK > > #361/4 verifier_sdiv/SDIV32, non-zero imm divisor, check 2 @unpriv:OK > > #361/5 verifier_sdiv/SDIV32, non-zero imm divisor, check 3:OK > > #361/6 verifier_sdiv/SDIV32, non-zero imm divisor, check 3 @unpriv:OK > > #361/7 verifier_sdiv/SDIV32, non-zero imm divisor, check 4:OK > > #361/8 verifier_sdiv/SDIV32, non-zero imm divisor, check 4 @unpriv:OK > > #361/9 verifier_sdiv/SDIV32, non-zero imm divisor, check 5:OK > > #361/10 verifier_sdiv/SDIV32, non-zero imm divisor, check 5 @unpriv:OK > > #361/11 verifier_sdiv/SDIV32, non-zero imm divisor, check 6:OK > > #361/12 verifier_sdiv/SDIV32, non-zero imm divisor, check 6 @unpriv:OK > > #361/13 verifier_sdiv/SDIV32, non-zero imm divisor, check 7:OK > > #361/14 verifier_sdiv/SDIV32, non-zero imm divisor, check 7 @unpriv:OK > > #361/15 verifier_sdiv/SDIV32, non-zero imm divisor, check 8:OK > > #361/16 verifier_sdiv/SDIV32, non-zero imm divisor, check 8 @unpriv:OK > > #361/17 verifier_sdiv/SDIV32, non-zero reg divisor, check 1:OK > > #361/18 verifier_sdiv/SDIV32, non-zero reg divisor, check 1 @unpriv:OK > > #361/19 verifier_sdiv/SDIV32, non-zero reg divisor, check 2:OK > > #361/20 verifier_sdiv/SDIV32, non-zero reg divisor, check 2 @unpriv:OK > > #361/21 verifier_sdiv/SDIV32, non-zero reg divisor, check 3:OK > > #361/22 verifier_sdiv/SDIV32, non-zero reg divisor, check 3 @unpriv:OK > > #361/23 verifier_sdiv/SDIV32, non-zero reg divisor, check 4:OK > > #361/24 verifier_sdiv/SDIV32, non-zero reg divisor, check 4 @unpriv:OK > > #361/25 verifier_sdiv/SDIV32, non-zero reg divisor, check 5:OK > > #361/26 verifier_sdiv/SDIV32, non-zero reg divisor, check 5 @unpriv:OK > > #361/27 verifier_sdiv/SDIV32, non-zero reg divisor, check 6:OK > > #361/28 verifier_sdiv/SDIV32, non-zero reg divisor, check 6 @unpriv:OK > > #361/29 verifier_sdiv/SDIV32, non-zero reg divisor, check 7:OK > > #361/30 verifier_sdiv/SDIV32, non-zero reg divisor, check 7 @unpriv:OK > > #361/31 verifier_sdiv/SDIV32, non-zero reg divisor, check 8:OK > > #361/32 verifier_sdiv/SDIV32, non-zero reg divisor, check 8 @unpriv:OK > > #361/33 verifier_sdiv/SDIV64, non-zero imm divisor, check 1:OK > > #361/34 verifier_sdiv/SDIV64, non-zero imm divisor, check 1 @unpriv:OK > > #361/35 verifier_sdiv/SDIV64, non-zero imm divisor, check 2:OK > > #361/36 verifier_sdiv/SDIV64, non-zero imm divisor, check 2 @unpriv:OK > > #361/37 verifier_sdiv/SDIV64, non-zero imm divisor, check 3:OK > > #361/38 verifier_sdiv/SDIV64, non-zero imm divisor, check 3 @unpriv:OK > > #361/39 verifier_sdiv/SDIV64, non-zero imm divisor, check 4:OK > > #361/40 verifier_sdiv/SDIV64, non-zero imm divisor, check 4 @unpriv:OK > > #361/41 verifier_sdiv/SDIV64, non-zero imm divisor, check 5:OK > > #361/42 verifier_sdiv/SDIV64, non-zero imm divisor, check 5 @unpriv:OK > > #361/43 verifier_sdiv/SDIV64, non-zero imm divisor, check 6:OK > > #361/44 verifier_sdiv/SDIV64, non-zero imm divisor, check 6 @unpriv:OK > > #361/45 verifier_sdiv/SDIV64, non-zero reg divisor, check 1:OK > > #361/46 verifier_sdiv/SDIV64, non-zero reg divisor, check 1 @unpriv:OK > > #361/47 verifier_sdiv/SDIV64, non-zero reg divisor, check 2:OK > > #361/48 verifier_sdiv/SDIV64, non-zero reg divisor, check 2 @unpriv:OK > > #361/49 verifier_sdiv/SDIV64, non-zero reg divisor, check 3:OK > > #361/50 verifier_sdiv/SDIV64, non-zero reg divisor, check 3 @unpriv:OK > > #361/51 verifier_sdiv/SDIV64, non-zero reg divisor, check 4:OK > > #361/52 verifier_sdiv/SDIV64, non-zero reg divisor, check 4 @unpriv:OK > > #361/53 verifier_sdiv/SDIV64, non-zero reg divisor, check 5:OK > > #361/54 verifier_sdiv/SDIV64, non-zero reg divisor, check 5 @unpriv:OK > > #361/55 verifier_sdiv/SDIV64, non-zero reg divisor, check 6:OK > > #361/56 verifier_sdiv/SDIV64, non-zero reg divisor, check 6 @unpriv:OK > > #361/57 verifier_sdiv/SMOD32, non-zero imm divisor, check 1:OK > > #361/58 verifier_sdiv/SMOD32, non-zero imm divisor, check 1 @unpriv:OK > > #361/59 verifier_sdiv/SMOD32, non-zero imm divisor, check 2:OK > > #361/60 verifier_sdiv/SMOD32, non-zero imm divisor, check 2 @unpriv:OK > > #361/61 verifier_sdiv/SMOD32, non-zero imm divisor, check 3:OK > > #361/62 verifier_sdiv/SMOD32, non-zero imm divisor, check 3 @unpriv:OK > > #361/63 verifier_sdiv/SMOD32, non-zero imm divisor, check 4:OK > > #361/64 verifier_sdiv/SMOD32, non-zero imm divisor, check 4 @unpriv:OK > > #361/65 verifier_sdiv/SMOD32, non-zero imm divisor, check 5:OK > > #361/66 verifier_sdiv/SMOD32, non-zero imm divisor, check 5 @unpriv:OK > > #361/67 verifier_sdiv/SMOD32, non-zero imm divisor, check 6:OK > > #361/68 verifier_sdiv/SMOD32, non-zero imm divisor, check 6 @unpriv:OK > > #361/69 verifier_sdiv/SMOD32, non-zero reg divisor, check 1:OK > > #361/70 verifier_sdiv/SMOD32, non-zero reg divisor, check 1 @unpriv:OK > > #361/71 verifier_sdiv/SMOD32, non-zero reg divisor, check 2:OK > > #361/72 verifier_sdiv/SMOD32, non-zero reg divisor, check 2 @unpriv:OK > > #361/73 verifier_sdiv/SMOD32, non-zero reg divisor, check 3:OK > > #361/74 verifier_sdiv/SMOD32, non-zero reg divisor, check 3 @unpriv:OK > > #361/75 verifier_sdiv/SMOD32, non-zero reg divisor, check 4:OK > > #361/76 verifier_sdiv/SMOD32, non-zero reg divisor, check 4 @unpriv:OK > > #361/77 verifier_sdiv/SMOD32, non-zero reg divisor, check 5:OK > > #361/78 verifier_sdiv/SMOD32, non-zero reg divisor, check 5 @unpriv:OK > > #361/79 verifier_sdiv/SMOD32, non-zero reg divisor, check 6:OK > > #361/80 verifier_sdiv/SMOD32, non-zero reg divisor, check 6 @unpriv:OK > > #361/81 verifier_sdiv/SMOD64, non-zero imm divisor, check 1:OK > > #361/82 verifier_sdiv/SMOD64, non-zero imm divisor, check 1 @unpriv:OK > > #361/83 verifier_sdiv/SMOD64, non-zero imm divisor, check 2:OK > > #361/84 verifier_sdiv/SMOD64, non-zero imm divisor, check 2 @unpriv:OK > > #361/85 verifier_sdiv/SMOD64, non-zero imm divisor, check 3:OK > > #361/86 verifier_sdiv/SMOD64, non-zero imm divisor, check 3 @unpriv:OK > > #361/87 verifier_sdiv/SMOD64, non-zero imm divisor, check 4:OK > > #361/88 verifier_sdiv/SMOD64, non-zero imm divisor, check 4 @unpriv:OK > > #361/89 verifier_sdiv/SMOD64, non-zero imm divisor, check 5:OK > > #361/90 verifier_sdiv/SMOD64, non-zero imm divisor, check 5 @unpriv:OK > > #361/91 verifier_sdiv/SMOD64, non-zero imm divisor, check 6:OK > > #361/92 verifier_sdiv/SMOD64, non-zero imm divisor, check 6 @unpriv:OK > > #361/93 verifier_sdiv/SMOD64, non-zero imm divisor, check 7:OK > > #361/94 verifier_sdiv/SMOD64, non-zero imm divisor, check 7 @unpriv:OK > > #361/95 verifier_sdiv/SMOD64, non-zero imm divisor, check 8:OK > > #361/96 verifier_sdiv/SMOD64, non-zero imm divisor, check 8 @unpriv:OK > > #361/97 verifier_sdiv/SMOD64, non-zero reg divisor, check 1:OK > > #361/98 verifier_sdiv/SMOD64, non-zero reg divisor, check 1 @unpriv:OK > > #361/99 verifier_sdiv/SMOD64, non-zero reg divisor, check 2:OK > > #361/100 verifier_sdiv/SMOD64, non-zero reg divisor, check 2 @unpriv:OK > > #361/101 verifier_sdiv/SMOD64, non-zero reg divisor, check 3:OK > > #361/102 verifier_sdiv/SMOD64, non-zero reg divisor, check 3 @unpriv:OK > > #361/103 verifier_sdiv/SMOD64, non-zero reg divisor, check 4:OK > > #361/104 verifier_sdiv/SMOD64, non-zero reg divisor, check 4 @unpriv:OK > > #361/105 verifier_sdiv/SMOD64, non-zero reg divisor, check 5:OK > > #361/106 verifier_sdiv/SMOD64, non-zero reg divisor, check 5 @unpriv:OK > > #361/107 verifier_sdiv/SMOD64, non-zero reg divisor, check 6:OK > > #361/108 verifier_sdiv/SMOD64, non-zero reg divisor, check 6 @unpriv:OK > > #361/109 verifier_sdiv/SMOD64, non-zero reg divisor, check 7:OK > > #361/110 verifier_sdiv/SMOD64, non-zero reg divisor, check 7 @unpriv:OK > > #361/111 verifier_sdiv/SMOD64, non-zero reg divisor, check 8:OK > > #361/112 verifier_sdiv/SMOD64, non-zero reg divisor, check 8 @unpriv:OK > > #361/113 verifier_sdiv/SDIV32, zero divisor:OK > > #361/114 verifier_sdiv/SDIV32, zero divisor @unpriv:OK > > #361/115 verifier_sdiv/SDIV64, zero divisor:OK > > #361/116 verifier_sdiv/SDIV64, zero divisor @unpriv:OK > > #361/117 verifier_sdiv/SMOD32, zero divisor:OK > > #361/118 verifier_sdiv/SMOD32, zero divisor @unpriv:OK > > #361/119 verifier_sdiv/SMOD64, zero divisor:OK > > #361/120 verifier_sdiv/SMOD64, zero divisor @unpriv:OK > > #361 verifier_sdiv:OK > > Summary: 5/163 PASSED, 0 SKIPPED, 0 FAILED > > > > # ./test_progs -t ldsx_insn > > test_map_val_and_probed_memory:PASS:test_ldsx_insn__open 0 nsec > > test_map_val_and_probed_memory:PASS:test_ldsx_insn__load 0 nsec > > libbpf: prog 'test_ptr_struct_arg': failed to attach: ERROR: strerror_r(-524)=22 > > libbpf: prog 'test_ptr_struct_arg': failed to auto-attach: -524 > > test_map_val_and_probed_memory:FAIL:test_ldsx_insn__attach unexpected error: -524 (errno 524) > > #116/1 ldsx_insn/map_val and probed_memory:FAIL > > #116/2 ldsx_insn/ctx_member_sign_ext:OK > During my tests, 'ctx_member_sign_ext' fails. > > Do you know why (you can test with the code in my repo)? Thanks. > > Huacai > > > #116/3 ldsx_insn/ctx_member_narrow_sign_ext:OK > > #116 ldsx_insn:FAIL > > > > All error logs: > > test_map_val_and_probed_memory:PASS:test_ldsx_insn__open 0 nsec > > test_map_val_and_probed_memory:PASS:test_ldsx_insn__load 0 nsec > > libbpf: prog 'test_ptr_struct_arg': failed to attach: ERROR: strerror_r(-524)=22 > > libbpf: prog 'test_ptr_struct_arg': failed to auto-attach: -524 > > test_map_val_and_probed_memory:FAIL:test_ldsx_insn__attach unexpected error: -524 (errno 524) > > #116/1 ldsx_insn/map_val and probed_memory:FAIL > > #116 ldsx_insn:FAIL > > Summary: 0/2 PASSED, 0 SKIPPED, 1 FAILED > > > > Signed-off-by: Hengqi Chen <hengqi.chen@gmail.com> > > --- > > tools/testing/selftests/bpf/progs/test_ldsx_insn.c | 3 ++- > > tools/testing/selftests/bpf/progs/verifier_bswap.c | 3 ++- > > tools/testing/selftests/bpf/progs/verifier_gotol.c | 3 ++- > > tools/testing/selftests/bpf/progs/verifier_ldsx.c | 3 ++- > > tools/testing/selftests/bpf/progs/verifier_movsx.c | 3 ++- > > tools/testing/selftests/bpf/progs/verifier_sdiv.c | 3 ++- > > 6 files changed, 12 insertions(+), 6 deletions(-) > > > > diff --git a/tools/testing/selftests/bpf/progs/test_ldsx_insn.c b/tools/testing/selftests/bpf/progs/test_ldsx_insn.c > > index 3ddcb3777912..2a2a942737d7 100644 > > --- a/tools/testing/selftests/bpf/progs/test_ldsx_insn.c > > +++ b/tools/testing/selftests/bpf/progs/test_ldsx_insn.c > > @@ -7,7 +7,8 @@ > > > > #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ > > (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ > > - defined(__TARGET_ARCH_s390)) && __clang_major__ >= 18 > > + defined(__TARGET_ARCH_s390) || defined(__TARGET_ARCH_loongarch)) && \ > > + __clang_major__ >= 18 > > const volatile int skip = 0; > > #else > > const volatile int skip = 1; > > diff --git a/tools/testing/selftests/bpf/progs/verifier_bswap.c b/tools/testing/selftests/bpf/progs/verifier_bswap.c > > index 107525fb4a6a..e61755656e8d 100644 > > --- a/tools/testing/selftests/bpf/progs/verifier_bswap.c > > +++ b/tools/testing/selftests/bpf/progs/verifier_bswap.c > > @@ -6,7 +6,8 @@ > > > > #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ > > (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ > > - defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390)) && \ > > + defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390) || \ > > + defined(__TARGET_ARCH_loongarch)) && \ > > __clang_major__ >= 18 > > > > SEC("socket") > > diff --git a/tools/testing/selftests/bpf/progs/verifier_gotol.c b/tools/testing/selftests/bpf/progs/verifier_gotol.c > > index 9f202eda952f..d1edbcff9a18 100644 > > --- a/tools/testing/selftests/bpf/progs/verifier_gotol.c > > +++ b/tools/testing/selftests/bpf/progs/verifier_gotol.c > > @@ -6,7 +6,8 @@ > > > > #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ > > (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ > > - defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390)) && \ > > + defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390) || \ > > + defined(__TARGET_ARCH_loongarch)) && \ > > __clang_major__ >= 18 > > > > SEC("socket") > > diff --git a/tools/testing/selftests/bpf/progs/verifier_ldsx.c b/tools/testing/selftests/bpf/progs/verifier_ldsx.c > > index 375525329637..d4427d8e1217 100644 > > --- a/tools/testing/selftests/bpf/progs/verifier_ldsx.c > > +++ b/tools/testing/selftests/bpf/progs/verifier_ldsx.c > > @@ -6,7 +6,8 @@ > > > > #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ > > (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ > > - defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390)) && \ > > + defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390) || \ > > + defined(__TARGET_ARCH_loongarch)) && \ > > __clang_major__ >= 18 > > > > SEC("socket") > > diff --git a/tools/testing/selftests/bpf/progs/verifier_movsx.c b/tools/testing/selftests/bpf/progs/verifier_movsx.c > > index b2a04d1179d0..cbb9d6714f53 100644 > > --- a/tools/testing/selftests/bpf/progs/verifier_movsx.c > > +++ b/tools/testing/selftests/bpf/progs/verifier_movsx.c > > @@ -6,7 +6,8 @@ > > > > #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ > > (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ > > - defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390)) && \ > > + defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390) || \ > > + defined(__TARGET_ARCH_loongarch)) && \ > > __clang_major__ >= 18 > > > > SEC("socket") > > diff --git a/tools/testing/selftests/bpf/progs/verifier_sdiv.c b/tools/testing/selftests/bpf/progs/verifier_sdiv.c > > index 8fc5174808b2..2a2271cf0294 100644 > > --- a/tools/testing/selftests/bpf/progs/verifier_sdiv.c > > +++ b/tools/testing/selftests/bpf/progs/verifier_sdiv.c > > @@ -6,7 +6,8 @@ > > > > #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ > > (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ > > - defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390)) && \ > > + defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390) || \ > > + defined(__TARGET_ARCH_loongarch)) && \ > > __clang_major__ >= 18 > > > > SEC("socket") > > -- > > 2.34.1 > >
Hi, Hengqi, On Sat, Nov 11, 2023 at 10:50 PM Hengqi Chen <hengqi.chen@gmail.com> wrote: > > Hi Huacai, > > On Thu, Nov 9, 2023 at 11:25 PM Huacai Chen <chenhuacai@kernel.org> wrote: > > > > Hi, Hengqi, > > > > I applied this series here: > > https://github.com/chenhuacai/linux/commits/loongarch-next > > > > But I have some problems, see below. > > > > On Fri, Oct 27, 2023 at 2:01 PM Hengqi Chen <hengqi.chen@gmail.com> wrote: > > > > > > Enable cpu v4 tests for LoongArch. Currently, we don't > > > have BPF trampoline in LoongArch JIT, so the fentry > > > test `test_ptr_struct_arg` still failed, will followup. > > > Test result attached below: > > > > > > # ./test_progs -t verifier_sdiv,verifier_movsx,verifier_ldsx,verifier_gotol,verifier_bswap > > If I disable unprivileged bpf, these tests pass, but unprivileged > > tests are skipped; if I enable unprivileged bpf, the 'verifier_movsx' > > causes the system hang. > > > > I can't reproduce this on my machine, see my .config at > https://github.com/chenhengqi/public OK, I will try you .config, and could you please try the code in my repo, too? I rebased on the mainline and there may be other problems. Huacai > > > > #316/1 verifier_bswap/BSWAP, 16:OK > > > #316/2 verifier_bswap/BSWAP, 16 @unpriv:OK > > > #316/3 verifier_bswap/BSWAP, 32:OK > > > #316/4 verifier_bswap/BSWAP, 32 @unpriv:OK > > > #316/5 verifier_bswap/BSWAP, 64:OK > > > #316/6 verifier_bswap/BSWAP, 64 @unpriv:OK > > > #316 verifier_bswap:OK > > > #330/1 verifier_gotol/gotol, small_imm:OK > > > #330/2 verifier_gotol/gotol, small_imm @unpriv:OK > > > #330 verifier_gotol:OK > > > #338/1 verifier_ldsx/LDSX, S8:OK > > > #338/2 verifier_ldsx/LDSX, S8 @unpriv:OK > > > #338/3 verifier_ldsx/LDSX, S16:OK > > > #338/4 verifier_ldsx/LDSX, S16 @unpriv:OK > > > #338/5 verifier_ldsx/LDSX, S32:OK > > > #338/6 verifier_ldsx/LDSX, S32 @unpriv:OK > > > #338/7 verifier_ldsx/LDSX, S8 range checking, privileged:OK > > > #338/8 verifier_ldsx/LDSX, S16 range checking:OK > > > #338/9 verifier_ldsx/LDSX, S16 range checking @unpriv:OK > > > #338/10 verifier_ldsx/LDSX, S32 range checking:OK > > > #338/11 verifier_ldsx/LDSX, S32 range checking @unpriv:OK > > > #338 verifier_ldsx:OK > > > #349/1 verifier_movsx/MOV32SX, S8:OK > > > #349/2 verifier_movsx/MOV32SX, S8 @unpriv:OK > > > #349/3 verifier_movsx/MOV32SX, S16:OK > > > #349/4 verifier_movsx/MOV32SX, S16 @unpriv:OK > > > #349/5 verifier_movsx/MOV64SX, S8:OK > > > #349/6 verifier_movsx/MOV64SX, S8 @unpriv:OK > > > #349/7 verifier_movsx/MOV64SX, S16:OK > > > #349/8 verifier_movsx/MOV64SX, S16 @unpriv:OK > > > #349/9 verifier_movsx/MOV64SX, S32:OK > > > #349/10 verifier_movsx/MOV64SX, S32 @unpriv:OK > > > #349/11 verifier_movsx/MOV32SX, S8, range_check:OK > > > #349/12 verifier_movsx/MOV32SX, S8, range_check @unpriv:OK > > > #349/13 verifier_movsx/MOV32SX, S16, range_check:OK > > > #349/14 verifier_movsx/MOV32SX, S16, range_check @unpriv:OK > > > #349/15 verifier_movsx/MOV32SX, S16, range_check 2:OK > > > #349/16 verifier_movsx/MOV32SX, S16, range_check 2 @unpriv:OK > > > #349/17 verifier_movsx/MOV64SX, S8, range_check:OK > > > #349/18 verifier_movsx/MOV64SX, S8, range_check @unpriv:OK > > > #349/19 verifier_movsx/MOV64SX, S16, range_check:OK > > > #349/20 verifier_movsx/MOV64SX, S16, range_check @unpriv:OK > > > #349/21 verifier_movsx/MOV64SX, S32, range_check:OK > > > #349/22 verifier_movsx/MOV64SX, S32, range_check @unpriv:OK > > > #349/23 verifier_movsx/MOV64SX, S16, R10 Sign Extension:OK > > > #349/24 verifier_movsx/MOV64SX, S16, R10 Sign Extension @unpriv:OK > > > #349 verifier_movsx:OK > > > #361/1 verifier_sdiv/SDIV32, non-zero imm divisor, check 1:OK > > > #361/2 verifier_sdiv/SDIV32, non-zero imm divisor, check 1 @unpriv:OK > > > #361/3 verifier_sdiv/SDIV32, non-zero imm divisor, check 2:OK > > > #361/4 verifier_sdiv/SDIV32, non-zero imm divisor, check 2 @unpriv:OK > > > #361/5 verifier_sdiv/SDIV32, non-zero imm divisor, check 3:OK > > > #361/6 verifier_sdiv/SDIV32, non-zero imm divisor, check 3 @unpriv:OK > > > #361/7 verifier_sdiv/SDIV32, non-zero imm divisor, check 4:OK > > > #361/8 verifier_sdiv/SDIV32, non-zero imm divisor, check 4 @unpriv:OK > > > #361/9 verifier_sdiv/SDIV32, non-zero imm divisor, check 5:OK > > > #361/10 verifier_sdiv/SDIV32, non-zero imm divisor, check 5 @unpriv:OK > > > #361/11 verifier_sdiv/SDIV32, non-zero imm divisor, check 6:OK > > > #361/12 verifier_sdiv/SDIV32, non-zero imm divisor, check 6 @unpriv:OK > > > #361/13 verifier_sdiv/SDIV32, non-zero imm divisor, check 7:OK > > > #361/14 verifier_sdiv/SDIV32, non-zero imm divisor, check 7 @unpriv:OK > > > #361/15 verifier_sdiv/SDIV32, non-zero imm divisor, check 8:OK > > > #361/16 verifier_sdiv/SDIV32, non-zero imm divisor, check 8 @unpriv:OK > > > #361/17 verifier_sdiv/SDIV32, non-zero reg divisor, check 1:OK > > > #361/18 verifier_sdiv/SDIV32, non-zero reg divisor, check 1 @unpriv:OK > > > #361/19 verifier_sdiv/SDIV32, non-zero reg divisor, check 2:OK > > > #361/20 verifier_sdiv/SDIV32, non-zero reg divisor, check 2 @unpriv:OK > > > #361/21 verifier_sdiv/SDIV32, non-zero reg divisor, check 3:OK > > > #361/22 verifier_sdiv/SDIV32, non-zero reg divisor, check 3 @unpriv:OK > > > #361/23 verifier_sdiv/SDIV32, non-zero reg divisor, check 4:OK > > > #361/24 verifier_sdiv/SDIV32, non-zero reg divisor, check 4 @unpriv:OK > > > #361/25 verifier_sdiv/SDIV32, non-zero reg divisor, check 5:OK > > > #361/26 verifier_sdiv/SDIV32, non-zero reg divisor, check 5 @unpriv:OK > > > #361/27 verifier_sdiv/SDIV32, non-zero reg divisor, check 6:OK > > > #361/28 verifier_sdiv/SDIV32, non-zero reg divisor, check 6 @unpriv:OK > > > #361/29 verifier_sdiv/SDIV32, non-zero reg divisor, check 7:OK > > > #361/30 verifier_sdiv/SDIV32, non-zero reg divisor, check 7 @unpriv:OK > > > #361/31 verifier_sdiv/SDIV32, non-zero reg divisor, check 8:OK > > > #361/32 verifier_sdiv/SDIV32, non-zero reg divisor, check 8 @unpriv:OK > > > #361/33 verifier_sdiv/SDIV64, non-zero imm divisor, check 1:OK > > > #361/34 verifier_sdiv/SDIV64, non-zero imm divisor, check 1 @unpriv:OK > > > #361/35 verifier_sdiv/SDIV64, non-zero imm divisor, check 2:OK > > > #361/36 verifier_sdiv/SDIV64, non-zero imm divisor, check 2 @unpriv:OK > > > #361/37 verifier_sdiv/SDIV64, non-zero imm divisor, check 3:OK > > > #361/38 verifier_sdiv/SDIV64, non-zero imm divisor, check 3 @unpriv:OK > > > #361/39 verifier_sdiv/SDIV64, non-zero imm divisor, check 4:OK > > > #361/40 verifier_sdiv/SDIV64, non-zero imm divisor, check 4 @unpriv:OK > > > #361/41 verifier_sdiv/SDIV64, non-zero imm divisor, check 5:OK > > > #361/42 verifier_sdiv/SDIV64, non-zero imm divisor, check 5 @unpriv:OK > > > #361/43 verifier_sdiv/SDIV64, non-zero imm divisor, check 6:OK > > > #361/44 verifier_sdiv/SDIV64, non-zero imm divisor, check 6 @unpriv:OK > > > #361/45 verifier_sdiv/SDIV64, non-zero reg divisor, check 1:OK > > > #361/46 verifier_sdiv/SDIV64, non-zero reg divisor, check 1 @unpriv:OK > > > #361/47 verifier_sdiv/SDIV64, non-zero reg divisor, check 2:OK > > > #361/48 verifier_sdiv/SDIV64, non-zero reg divisor, check 2 @unpriv:OK > > > #361/49 verifier_sdiv/SDIV64, non-zero reg divisor, check 3:OK > > > #361/50 verifier_sdiv/SDIV64, non-zero reg divisor, check 3 @unpriv:OK > > > #361/51 verifier_sdiv/SDIV64, non-zero reg divisor, check 4:OK > > > #361/52 verifier_sdiv/SDIV64, non-zero reg divisor, check 4 @unpriv:OK > > > #361/53 verifier_sdiv/SDIV64, non-zero reg divisor, check 5:OK > > > #361/54 verifier_sdiv/SDIV64, non-zero reg divisor, check 5 @unpriv:OK > > > #361/55 verifier_sdiv/SDIV64, non-zero reg divisor, check 6:OK > > > #361/56 verifier_sdiv/SDIV64, non-zero reg divisor, check 6 @unpriv:OK > > > #361/57 verifier_sdiv/SMOD32, non-zero imm divisor, check 1:OK > > > #361/58 verifier_sdiv/SMOD32, non-zero imm divisor, check 1 @unpriv:OK > > > #361/59 verifier_sdiv/SMOD32, non-zero imm divisor, check 2:OK > > > #361/60 verifier_sdiv/SMOD32, non-zero imm divisor, check 2 @unpriv:OK > > > #361/61 verifier_sdiv/SMOD32, non-zero imm divisor, check 3:OK > > > #361/62 verifier_sdiv/SMOD32, non-zero imm divisor, check 3 @unpriv:OK > > > #361/63 verifier_sdiv/SMOD32, non-zero imm divisor, check 4:OK > > > #361/64 verifier_sdiv/SMOD32, non-zero imm divisor, check 4 @unpriv:OK > > > #361/65 verifier_sdiv/SMOD32, non-zero imm divisor, check 5:OK > > > #361/66 verifier_sdiv/SMOD32, non-zero imm divisor, check 5 @unpriv:OK > > > #361/67 verifier_sdiv/SMOD32, non-zero imm divisor, check 6:OK > > > #361/68 verifier_sdiv/SMOD32, non-zero imm divisor, check 6 @unpriv:OK > > > #361/69 verifier_sdiv/SMOD32, non-zero reg divisor, check 1:OK > > > #361/70 verifier_sdiv/SMOD32, non-zero reg divisor, check 1 @unpriv:OK > > > #361/71 verifier_sdiv/SMOD32, non-zero reg divisor, check 2:OK > > > #361/72 verifier_sdiv/SMOD32, non-zero reg divisor, check 2 @unpriv:OK > > > #361/73 verifier_sdiv/SMOD32, non-zero reg divisor, check 3:OK > > > #361/74 verifier_sdiv/SMOD32, non-zero reg divisor, check 3 @unpriv:OK > > > #361/75 verifier_sdiv/SMOD32, non-zero reg divisor, check 4:OK > > > #361/76 verifier_sdiv/SMOD32, non-zero reg divisor, check 4 @unpriv:OK > > > #361/77 verifier_sdiv/SMOD32, non-zero reg divisor, check 5:OK > > > #361/78 verifier_sdiv/SMOD32, non-zero reg divisor, check 5 @unpriv:OK > > > #361/79 verifier_sdiv/SMOD32, non-zero reg divisor, check 6:OK > > > #361/80 verifier_sdiv/SMOD32, non-zero reg divisor, check 6 @unpriv:OK > > > #361/81 verifier_sdiv/SMOD64, non-zero imm divisor, check 1:OK > > > #361/82 verifier_sdiv/SMOD64, non-zero imm divisor, check 1 @unpriv:OK > > > #361/83 verifier_sdiv/SMOD64, non-zero imm divisor, check 2:OK > > > #361/84 verifier_sdiv/SMOD64, non-zero imm divisor, check 2 @unpriv:OK > > > #361/85 verifier_sdiv/SMOD64, non-zero imm divisor, check 3:OK > > > #361/86 verifier_sdiv/SMOD64, non-zero imm divisor, check 3 @unpriv:OK > > > #361/87 verifier_sdiv/SMOD64, non-zero imm divisor, check 4:OK > > > #361/88 verifier_sdiv/SMOD64, non-zero imm divisor, check 4 @unpriv:OK > > > #361/89 verifier_sdiv/SMOD64, non-zero imm divisor, check 5:OK > > > #361/90 verifier_sdiv/SMOD64, non-zero imm divisor, check 5 @unpriv:OK > > > #361/91 verifier_sdiv/SMOD64, non-zero imm divisor, check 6:OK > > > #361/92 verifier_sdiv/SMOD64, non-zero imm divisor, check 6 @unpriv:OK > > > #361/93 verifier_sdiv/SMOD64, non-zero imm divisor, check 7:OK > > > #361/94 verifier_sdiv/SMOD64, non-zero imm divisor, check 7 @unpriv:OK > > > #361/95 verifier_sdiv/SMOD64, non-zero imm divisor, check 8:OK > > > #361/96 verifier_sdiv/SMOD64, non-zero imm divisor, check 8 @unpriv:OK > > > #361/97 verifier_sdiv/SMOD64, non-zero reg divisor, check 1:OK > > > #361/98 verifier_sdiv/SMOD64, non-zero reg divisor, check 1 @unpriv:OK > > > #361/99 verifier_sdiv/SMOD64, non-zero reg divisor, check 2:OK > > > #361/100 verifier_sdiv/SMOD64, non-zero reg divisor, check 2 @unpriv:OK > > > #361/101 verifier_sdiv/SMOD64, non-zero reg divisor, check 3:OK > > > #361/102 verifier_sdiv/SMOD64, non-zero reg divisor, check 3 @unpriv:OK > > > #361/103 verifier_sdiv/SMOD64, non-zero reg divisor, check 4:OK > > > #361/104 verifier_sdiv/SMOD64, non-zero reg divisor, check 4 @unpriv:OK > > > #361/105 verifier_sdiv/SMOD64, non-zero reg divisor, check 5:OK > > > #361/106 verifier_sdiv/SMOD64, non-zero reg divisor, check 5 @unpriv:OK > > > #361/107 verifier_sdiv/SMOD64, non-zero reg divisor, check 6:OK > > > #361/108 verifier_sdiv/SMOD64, non-zero reg divisor, check 6 @unpriv:OK > > > #361/109 verifier_sdiv/SMOD64, non-zero reg divisor, check 7:OK > > > #361/110 verifier_sdiv/SMOD64, non-zero reg divisor, check 7 @unpriv:OK > > > #361/111 verifier_sdiv/SMOD64, non-zero reg divisor, check 8:OK > > > #361/112 verifier_sdiv/SMOD64, non-zero reg divisor, check 8 @unpriv:OK > > > #361/113 verifier_sdiv/SDIV32, zero divisor:OK > > > #361/114 verifier_sdiv/SDIV32, zero divisor @unpriv:OK > > > #361/115 verifier_sdiv/SDIV64, zero divisor:OK > > > #361/116 verifier_sdiv/SDIV64, zero divisor @unpriv:OK > > > #361/117 verifier_sdiv/SMOD32, zero divisor:OK > > > #361/118 verifier_sdiv/SMOD32, zero divisor @unpriv:OK > > > #361/119 verifier_sdiv/SMOD64, zero divisor:OK > > > #361/120 verifier_sdiv/SMOD64, zero divisor @unpriv:OK > > > #361 verifier_sdiv:OK > > > Summary: 5/163 PASSED, 0 SKIPPED, 0 FAILED > > > > > > # ./test_progs -t ldsx_insn > > > test_map_val_and_probed_memory:PASS:test_ldsx_insn__open 0 nsec > > > test_map_val_and_probed_memory:PASS:test_ldsx_insn__load 0 nsec > > > libbpf: prog 'test_ptr_struct_arg': failed to attach: ERROR: strerror_r(-524)=22 > > > libbpf: prog 'test_ptr_struct_arg': failed to auto-attach: -524 > > > test_map_val_and_probed_memory:FAIL:test_ldsx_insn__attach unexpected error: -524 (errno 524) > > > #116/1 ldsx_insn/map_val and probed_memory:FAIL > > > #116/2 ldsx_insn/ctx_member_sign_ext:OK > > During my tests, 'ctx_member_sign_ext' fails. > > > > Do you know why (you can test with the code in my repo)? Thanks. > > > > Huacai > > > > > #116/3 ldsx_insn/ctx_member_narrow_sign_ext:OK > > > #116 ldsx_insn:FAIL > > > > > > All error logs: > > > test_map_val_and_probed_memory:PASS:test_ldsx_insn__open 0 nsec > > > test_map_val_and_probed_memory:PASS:test_ldsx_insn__load 0 nsec > > > libbpf: prog 'test_ptr_struct_arg': failed to attach: ERROR: strerror_r(-524)=22 > > > libbpf: prog 'test_ptr_struct_arg': failed to auto-attach: -524 > > > test_map_val_and_probed_memory:FAIL:test_ldsx_insn__attach unexpected error: -524 (errno 524) > > > #116/1 ldsx_insn/map_val and probed_memory:FAIL > > > #116 ldsx_insn:FAIL > > > Summary: 0/2 PASSED, 0 SKIPPED, 1 FAILED > > > > > > Signed-off-by: Hengqi Chen <hengqi.chen@gmail.com> > > > --- > > > tools/testing/selftests/bpf/progs/test_ldsx_insn.c | 3 ++- > > > tools/testing/selftests/bpf/progs/verifier_bswap.c | 3 ++- > > > tools/testing/selftests/bpf/progs/verifier_gotol.c | 3 ++- > > > tools/testing/selftests/bpf/progs/verifier_ldsx.c | 3 ++- > > > tools/testing/selftests/bpf/progs/verifier_movsx.c | 3 ++- > > > tools/testing/selftests/bpf/progs/verifier_sdiv.c | 3 ++- > > > 6 files changed, 12 insertions(+), 6 deletions(-) > > > > > > diff --git a/tools/testing/selftests/bpf/progs/test_ldsx_insn.c b/tools/testing/selftests/bpf/progs/test_ldsx_insn.c > > > index 3ddcb3777912..2a2a942737d7 100644 > > > --- a/tools/testing/selftests/bpf/progs/test_ldsx_insn.c > > > +++ b/tools/testing/selftests/bpf/progs/test_ldsx_insn.c > > > @@ -7,7 +7,8 @@ > > > > > > #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ > > > (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ > > > - defined(__TARGET_ARCH_s390)) && __clang_major__ >= 18 > > > + defined(__TARGET_ARCH_s390) || defined(__TARGET_ARCH_loongarch)) && \ > > > + __clang_major__ >= 18 > > > const volatile int skip = 0; > > > #else > > > const volatile int skip = 1; > > > diff --git a/tools/testing/selftests/bpf/progs/verifier_bswap.c b/tools/testing/selftests/bpf/progs/verifier_bswap.c > > > index 107525fb4a6a..e61755656e8d 100644 > > > --- a/tools/testing/selftests/bpf/progs/verifier_bswap.c > > > +++ b/tools/testing/selftests/bpf/progs/verifier_bswap.c > > > @@ -6,7 +6,8 @@ > > > > > > #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ > > > (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ > > > - defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390)) && \ > > > + defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390) || \ > > > + defined(__TARGET_ARCH_loongarch)) && \ > > > __clang_major__ >= 18 > > > > > > SEC("socket") > > > diff --git a/tools/testing/selftests/bpf/progs/verifier_gotol.c b/tools/testing/selftests/bpf/progs/verifier_gotol.c > > > index 9f202eda952f..d1edbcff9a18 100644 > > > --- a/tools/testing/selftests/bpf/progs/verifier_gotol.c > > > +++ b/tools/testing/selftests/bpf/progs/verifier_gotol.c > > > @@ -6,7 +6,8 @@ > > > > > > #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ > > > (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ > > > - defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390)) && \ > > > + defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390) || \ > > > + defined(__TARGET_ARCH_loongarch)) && \ > > > __clang_major__ >= 18 > > > > > > SEC("socket") > > > diff --git a/tools/testing/selftests/bpf/progs/verifier_ldsx.c b/tools/testing/selftests/bpf/progs/verifier_ldsx.c > > > index 375525329637..d4427d8e1217 100644 > > > --- a/tools/testing/selftests/bpf/progs/verifier_ldsx.c > > > +++ b/tools/testing/selftests/bpf/progs/verifier_ldsx.c > > > @@ -6,7 +6,8 @@ > > > > > > #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ > > > (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ > > > - defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390)) && \ > > > + defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390) || \ > > > + defined(__TARGET_ARCH_loongarch)) && \ > > > __clang_major__ >= 18 > > > > > > SEC("socket") > > > diff --git a/tools/testing/selftests/bpf/progs/verifier_movsx.c b/tools/testing/selftests/bpf/progs/verifier_movsx.c > > > index b2a04d1179d0..cbb9d6714f53 100644 > > > --- a/tools/testing/selftests/bpf/progs/verifier_movsx.c > > > +++ b/tools/testing/selftests/bpf/progs/verifier_movsx.c > > > @@ -6,7 +6,8 @@ > > > > > > #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ > > > (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ > > > - defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390)) && \ > > > + defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390) || \ > > > + defined(__TARGET_ARCH_loongarch)) && \ > > > __clang_major__ >= 18 > > > > > > SEC("socket") > > > diff --git a/tools/testing/selftests/bpf/progs/verifier_sdiv.c b/tools/testing/selftests/bpf/progs/verifier_sdiv.c > > > index 8fc5174808b2..2a2271cf0294 100644 > > > --- a/tools/testing/selftests/bpf/progs/verifier_sdiv.c > > > +++ b/tools/testing/selftests/bpf/progs/verifier_sdiv.c > > > @@ -6,7 +6,8 @@ > > > > > > #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ > > > (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ > > > - defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390)) && \ > > > + defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390) || \ > > > + defined(__TARGET_ARCH_loongarch)) && \ > > > __clang_major__ >= 18 > > > > > > SEC("socket") > > > -- > > > 2.34.1 > > >
On Sun, Nov 12, 2023 at 12:19 AM Huacai Chen <chenhuacai@kernel.org> wrote: > > Hi, Hengqi, > > On Sat, Nov 11, 2023 at 10:50 PM Hengqi Chen <hengqi.chen@gmail.com> wrote: > > > > Hi Huacai, > > > > On Thu, Nov 9, 2023 at 11:25 PM Huacai Chen <chenhuacai@kernel.org> wrote: > > > > > > Hi, Hengqi, > > > > > > I applied this series here: > > > https://github.com/chenhuacai/linux/commits/loongarch-next > > > > > > But I have some problems, see below. > > > > > > On Fri, Oct 27, 2023 at 2:01 PM Hengqi Chen <hengqi.chen@gmail.com> wrote: > > > > > > > > Enable cpu v4 tests for LoongArch. Currently, we don't > > > > have BPF trampoline in LoongArch JIT, so the fentry > > > > test `test_ptr_struct_arg` still failed, will followup. > > > > Test result attached below: > > > > > > > > # ./test_progs -t verifier_sdiv,verifier_movsx,verifier_ldsx,verifier_gotol,verifier_bswap > > > If I disable unprivileged bpf, these tests pass, but unprivileged > > > tests are skipped; if I enable unprivileged bpf, the 'verifier_movsx' > > > causes the system hang. > > > > > > > I can't reproduce this on my machine, see my .config at > > https://github.com/chenhengqi/public > OK, I will try you .config, and could you please try the code in my > repo, too? I rebased on the mainline and there may be other problems. I have tried your .config and no system hangs. And I also find that if enabling CONFIG_BPF_JIT_ALWAYS_ON based on your .config there will be a system hang during tests. So, does that mean you only tested the interpreter but not JIT? And the other problem still exists even using your .config, 'ctx_member_sign_ext' still fails. Huacai > > Huacai > > > > > > > #316/1 verifier_bswap/BSWAP, 16:OK > > > > #316/2 verifier_bswap/BSWAP, 16 @unpriv:OK > > > > #316/3 verifier_bswap/BSWAP, 32:OK > > > > #316/4 verifier_bswap/BSWAP, 32 @unpriv:OK > > > > #316/5 verifier_bswap/BSWAP, 64:OK > > > > #316/6 verifier_bswap/BSWAP, 64 @unpriv:OK > > > > #316 verifier_bswap:OK > > > > #330/1 verifier_gotol/gotol, small_imm:OK > > > > #330/2 verifier_gotol/gotol, small_imm @unpriv:OK > > > > #330 verifier_gotol:OK > > > > #338/1 verifier_ldsx/LDSX, S8:OK > > > > #338/2 verifier_ldsx/LDSX, S8 @unpriv:OK > > > > #338/3 verifier_ldsx/LDSX, S16:OK > > > > #338/4 verifier_ldsx/LDSX, S16 @unpriv:OK > > > > #338/5 verifier_ldsx/LDSX, S32:OK > > > > #338/6 verifier_ldsx/LDSX, S32 @unpriv:OK > > > > #338/7 verifier_ldsx/LDSX, S8 range checking, privileged:OK > > > > #338/8 verifier_ldsx/LDSX, S16 range checking:OK > > > > #338/9 verifier_ldsx/LDSX, S16 range checking @unpriv:OK > > > > #338/10 verifier_ldsx/LDSX, S32 range checking:OK > > > > #338/11 verifier_ldsx/LDSX, S32 range checking @unpriv:OK > > > > #338 verifier_ldsx:OK > > > > #349/1 verifier_movsx/MOV32SX, S8:OK > > > > #349/2 verifier_movsx/MOV32SX, S8 @unpriv:OK > > > > #349/3 verifier_movsx/MOV32SX, S16:OK > > > > #349/4 verifier_movsx/MOV32SX, S16 @unpriv:OK > > > > #349/5 verifier_movsx/MOV64SX, S8:OK > > > > #349/6 verifier_movsx/MOV64SX, S8 @unpriv:OK > > > > #349/7 verifier_movsx/MOV64SX, S16:OK > > > > #349/8 verifier_movsx/MOV64SX, S16 @unpriv:OK > > > > #349/9 verifier_movsx/MOV64SX, S32:OK > > > > #349/10 verifier_movsx/MOV64SX, S32 @unpriv:OK > > > > #349/11 verifier_movsx/MOV32SX, S8, range_check:OK > > > > #349/12 verifier_movsx/MOV32SX, S8, range_check @unpriv:OK > > > > #349/13 verifier_movsx/MOV32SX, S16, range_check:OK > > > > #349/14 verifier_movsx/MOV32SX, S16, range_check @unpriv:OK > > > > #349/15 verifier_movsx/MOV32SX, S16, range_check 2:OK > > > > #349/16 verifier_movsx/MOV32SX, S16, range_check 2 @unpriv:OK > > > > #349/17 verifier_movsx/MOV64SX, S8, range_check:OK > > > > #349/18 verifier_movsx/MOV64SX, S8, range_check @unpriv:OK > > > > #349/19 verifier_movsx/MOV64SX, S16, range_check:OK > > > > #349/20 verifier_movsx/MOV64SX, S16, range_check @unpriv:OK > > > > #349/21 verifier_movsx/MOV64SX, S32, range_check:OK > > > > #349/22 verifier_movsx/MOV64SX, S32, range_check @unpriv:OK > > > > #349/23 verifier_movsx/MOV64SX, S16, R10 Sign Extension:OK > > > > #349/24 verifier_movsx/MOV64SX, S16, R10 Sign Extension @unpriv:OK > > > > #349 verifier_movsx:OK > > > > #361/1 verifier_sdiv/SDIV32, non-zero imm divisor, check 1:OK > > > > #361/2 verifier_sdiv/SDIV32, non-zero imm divisor, check 1 @unpriv:OK > > > > #361/3 verifier_sdiv/SDIV32, non-zero imm divisor, check 2:OK > > > > #361/4 verifier_sdiv/SDIV32, non-zero imm divisor, check 2 @unpriv:OK > > > > #361/5 verifier_sdiv/SDIV32, non-zero imm divisor, check 3:OK > > > > #361/6 verifier_sdiv/SDIV32, non-zero imm divisor, check 3 @unpriv:OK > > > > #361/7 verifier_sdiv/SDIV32, non-zero imm divisor, check 4:OK > > > > #361/8 verifier_sdiv/SDIV32, non-zero imm divisor, check 4 @unpriv:OK > > > > #361/9 verifier_sdiv/SDIV32, non-zero imm divisor, check 5:OK > > > > #361/10 verifier_sdiv/SDIV32, non-zero imm divisor, check 5 @unpriv:OK > > > > #361/11 verifier_sdiv/SDIV32, non-zero imm divisor, check 6:OK > > > > #361/12 verifier_sdiv/SDIV32, non-zero imm divisor, check 6 @unpriv:OK > > > > #361/13 verifier_sdiv/SDIV32, non-zero imm divisor, check 7:OK > > > > #361/14 verifier_sdiv/SDIV32, non-zero imm divisor, check 7 @unpriv:OK > > > > #361/15 verifier_sdiv/SDIV32, non-zero imm divisor, check 8:OK > > > > #361/16 verifier_sdiv/SDIV32, non-zero imm divisor, check 8 @unpriv:OK > > > > #361/17 verifier_sdiv/SDIV32, non-zero reg divisor, check 1:OK > > > > #361/18 verifier_sdiv/SDIV32, non-zero reg divisor, check 1 @unpriv:OK > > > > #361/19 verifier_sdiv/SDIV32, non-zero reg divisor, check 2:OK > > > > #361/20 verifier_sdiv/SDIV32, non-zero reg divisor, check 2 @unpriv:OK > > > > #361/21 verifier_sdiv/SDIV32, non-zero reg divisor, check 3:OK > > > > #361/22 verifier_sdiv/SDIV32, non-zero reg divisor, check 3 @unpriv:OK > > > > #361/23 verifier_sdiv/SDIV32, non-zero reg divisor, check 4:OK > > > > #361/24 verifier_sdiv/SDIV32, non-zero reg divisor, check 4 @unpriv:OK > > > > #361/25 verifier_sdiv/SDIV32, non-zero reg divisor, check 5:OK > > > > #361/26 verifier_sdiv/SDIV32, non-zero reg divisor, check 5 @unpriv:OK > > > > #361/27 verifier_sdiv/SDIV32, non-zero reg divisor, check 6:OK > > > > #361/28 verifier_sdiv/SDIV32, non-zero reg divisor, check 6 @unpriv:OK > > > > #361/29 verifier_sdiv/SDIV32, non-zero reg divisor, check 7:OK > > > > #361/30 verifier_sdiv/SDIV32, non-zero reg divisor, check 7 @unpriv:OK > > > > #361/31 verifier_sdiv/SDIV32, non-zero reg divisor, check 8:OK > > > > #361/32 verifier_sdiv/SDIV32, non-zero reg divisor, check 8 @unpriv:OK > > > > #361/33 verifier_sdiv/SDIV64, non-zero imm divisor, check 1:OK > > > > #361/34 verifier_sdiv/SDIV64, non-zero imm divisor, check 1 @unpriv:OK > > > > #361/35 verifier_sdiv/SDIV64, non-zero imm divisor, check 2:OK > > > > #361/36 verifier_sdiv/SDIV64, non-zero imm divisor, check 2 @unpriv:OK > > > > #361/37 verifier_sdiv/SDIV64, non-zero imm divisor, check 3:OK > > > > #361/38 verifier_sdiv/SDIV64, non-zero imm divisor, check 3 @unpriv:OK > > > > #361/39 verifier_sdiv/SDIV64, non-zero imm divisor, check 4:OK > > > > #361/40 verifier_sdiv/SDIV64, non-zero imm divisor, check 4 @unpriv:OK > > > > #361/41 verifier_sdiv/SDIV64, non-zero imm divisor, check 5:OK > > > > #361/42 verifier_sdiv/SDIV64, non-zero imm divisor, check 5 @unpriv:OK > > > > #361/43 verifier_sdiv/SDIV64, non-zero imm divisor, check 6:OK > > > > #361/44 verifier_sdiv/SDIV64, non-zero imm divisor, check 6 @unpriv:OK > > > > #361/45 verifier_sdiv/SDIV64, non-zero reg divisor, check 1:OK > > > > #361/46 verifier_sdiv/SDIV64, non-zero reg divisor, check 1 @unpriv:OK > > > > #361/47 verifier_sdiv/SDIV64, non-zero reg divisor, check 2:OK > > > > #361/48 verifier_sdiv/SDIV64, non-zero reg divisor, check 2 @unpriv:OK > > > > #361/49 verifier_sdiv/SDIV64, non-zero reg divisor, check 3:OK > > > > #361/50 verifier_sdiv/SDIV64, non-zero reg divisor, check 3 @unpriv:OK > > > > #361/51 verifier_sdiv/SDIV64, non-zero reg divisor, check 4:OK > > > > #361/52 verifier_sdiv/SDIV64, non-zero reg divisor, check 4 @unpriv:OK > > > > #361/53 verifier_sdiv/SDIV64, non-zero reg divisor, check 5:OK > > > > #361/54 verifier_sdiv/SDIV64, non-zero reg divisor, check 5 @unpriv:OK > > > > #361/55 verifier_sdiv/SDIV64, non-zero reg divisor, check 6:OK > > > > #361/56 verifier_sdiv/SDIV64, non-zero reg divisor, check 6 @unpriv:OK > > > > #361/57 verifier_sdiv/SMOD32, non-zero imm divisor, check 1:OK > > > > #361/58 verifier_sdiv/SMOD32, non-zero imm divisor, check 1 @unpriv:OK > > > > #361/59 verifier_sdiv/SMOD32, non-zero imm divisor, check 2:OK > > > > #361/60 verifier_sdiv/SMOD32, non-zero imm divisor, check 2 @unpriv:OK > > > > #361/61 verifier_sdiv/SMOD32, non-zero imm divisor, check 3:OK > > > > #361/62 verifier_sdiv/SMOD32, non-zero imm divisor, check 3 @unpriv:OK > > > > #361/63 verifier_sdiv/SMOD32, non-zero imm divisor, check 4:OK > > > > #361/64 verifier_sdiv/SMOD32, non-zero imm divisor, check 4 @unpriv:OK > > > > #361/65 verifier_sdiv/SMOD32, non-zero imm divisor, check 5:OK > > > > #361/66 verifier_sdiv/SMOD32, non-zero imm divisor, check 5 @unpriv:OK > > > > #361/67 verifier_sdiv/SMOD32, non-zero imm divisor, check 6:OK > > > > #361/68 verifier_sdiv/SMOD32, non-zero imm divisor, check 6 @unpriv:OK > > > > #361/69 verifier_sdiv/SMOD32, non-zero reg divisor, check 1:OK > > > > #361/70 verifier_sdiv/SMOD32, non-zero reg divisor, check 1 @unpriv:OK > > > > #361/71 verifier_sdiv/SMOD32, non-zero reg divisor, check 2:OK > > > > #361/72 verifier_sdiv/SMOD32, non-zero reg divisor, check 2 @unpriv:OK > > > > #361/73 verifier_sdiv/SMOD32, non-zero reg divisor, check 3:OK > > > > #361/74 verifier_sdiv/SMOD32, non-zero reg divisor, check 3 @unpriv:OK > > > > #361/75 verifier_sdiv/SMOD32, non-zero reg divisor, check 4:OK > > > > #361/76 verifier_sdiv/SMOD32, non-zero reg divisor, check 4 @unpriv:OK > > > > #361/77 verifier_sdiv/SMOD32, non-zero reg divisor, check 5:OK > > > > #361/78 verifier_sdiv/SMOD32, non-zero reg divisor, check 5 @unpriv:OK > > > > #361/79 verifier_sdiv/SMOD32, non-zero reg divisor, check 6:OK > > > > #361/80 verifier_sdiv/SMOD32, non-zero reg divisor, check 6 @unpriv:OK > > > > #361/81 verifier_sdiv/SMOD64, non-zero imm divisor, check 1:OK > > > > #361/82 verifier_sdiv/SMOD64, non-zero imm divisor, check 1 @unpriv:OK > > > > #361/83 verifier_sdiv/SMOD64, non-zero imm divisor, check 2:OK > > > > #361/84 verifier_sdiv/SMOD64, non-zero imm divisor, check 2 @unpriv:OK > > > > #361/85 verifier_sdiv/SMOD64, non-zero imm divisor, check 3:OK > > > > #361/86 verifier_sdiv/SMOD64, non-zero imm divisor, check 3 @unpriv:OK > > > > #361/87 verifier_sdiv/SMOD64, non-zero imm divisor, check 4:OK > > > > #361/88 verifier_sdiv/SMOD64, non-zero imm divisor, check 4 @unpriv:OK > > > > #361/89 verifier_sdiv/SMOD64, non-zero imm divisor, check 5:OK > > > > #361/90 verifier_sdiv/SMOD64, non-zero imm divisor, check 5 @unpriv:OK > > > > #361/91 verifier_sdiv/SMOD64, non-zero imm divisor, check 6:OK > > > > #361/92 verifier_sdiv/SMOD64, non-zero imm divisor, check 6 @unpriv:OK > > > > #361/93 verifier_sdiv/SMOD64, non-zero imm divisor, check 7:OK > > > > #361/94 verifier_sdiv/SMOD64, non-zero imm divisor, check 7 @unpriv:OK > > > > #361/95 verifier_sdiv/SMOD64, non-zero imm divisor, check 8:OK > > > > #361/96 verifier_sdiv/SMOD64, non-zero imm divisor, check 8 @unpriv:OK > > > > #361/97 verifier_sdiv/SMOD64, non-zero reg divisor, check 1:OK > > > > #361/98 verifier_sdiv/SMOD64, non-zero reg divisor, check 1 @unpriv:OK > > > > #361/99 verifier_sdiv/SMOD64, non-zero reg divisor, check 2:OK > > > > #361/100 verifier_sdiv/SMOD64, non-zero reg divisor, check 2 @unpriv:OK > > > > #361/101 verifier_sdiv/SMOD64, non-zero reg divisor, check 3:OK > > > > #361/102 verifier_sdiv/SMOD64, non-zero reg divisor, check 3 @unpriv:OK > > > > #361/103 verifier_sdiv/SMOD64, non-zero reg divisor, check 4:OK > > > > #361/104 verifier_sdiv/SMOD64, non-zero reg divisor, check 4 @unpriv:OK > > > > #361/105 verifier_sdiv/SMOD64, non-zero reg divisor, check 5:OK > > > > #361/106 verifier_sdiv/SMOD64, non-zero reg divisor, check 5 @unpriv:OK > > > > #361/107 verifier_sdiv/SMOD64, non-zero reg divisor, check 6:OK > > > > #361/108 verifier_sdiv/SMOD64, non-zero reg divisor, check 6 @unpriv:OK > > > > #361/109 verifier_sdiv/SMOD64, non-zero reg divisor, check 7:OK > > > > #361/110 verifier_sdiv/SMOD64, non-zero reg divisor, check 7 @unpriv:OK > > > > #361/111 verifier_sdiv/SMOD64, non-zero reg divisor, check 8:OK > > > > #361/112 verifier_sdiv/SMOD64, non-zero reg divisor, check 8 @unpriv:OK > > > > #361/113 verifier_sdiv/SDIV32, zero divisor:OK > > > > #361/114 verifier_sdiv/SDIV32, zero divisor @unpriv:OK > > > > #361/115 verifier_sdiv/SDIV64, zero divisor:OK > > > > #361/116 verifier_sdiv/SDIV64, zero divisor @unpriv:OK > > > > #361/117 verifier_sdiv/SMOD32, zero divisor:OK > > > > #361/118 verifier_sdiv/SMOD32, zero divisor @unpriv:OK > > > > #361/119 verifier_sdiv/SMOD64, zero divisor:OK > > > > #361/120 verifier_sdiv/SMOD64, zero divisor @unpriv:OK > > > > #361 verifier_sdiv:OK > > > > Summary: 5/163 PASSED, 0 SKIPPED, 0 FAILED > > > > > > > > # ./test_progs -t ldsx_insn > > > > test_map_val_and_probed_memory:PASS:test_ldsx_insn__open 0 nsec > > > > test_map_val_and_probed_memory:PASS:test_ldsx_insn__load 0 nsec > > > > libbpf: prog 'test_ptr_struct_arg': failed to attach: ERROR: strerror_r(-524)=22 > > > > libbpf: prog 'test_ptr_struct_arg': failed to auto-attach: -524 > > > > test_map_val_and_probed_memory:FAIL:test_ldsx_insn__attach unexpected error: -524 (errno 524) > > > > #116/1 ldsx_insn/map_val and probed_memory:FAIL > > > > #116/2 ldsx_insn/ctx_member_sign_ext:OK > > > During my tests, 'ctx_member_sign_ext' fails. > > > > > > Do you know why (you can test with the code in my repo)? Thanks. > > > > > > Huacai > > > > > > > #116/3 ldsx_insn/ctx_member_narrow_sign_ext:OK > > > > #116 ldsx_insn:FAIL > > > > > > > > All error logs: > > > > test_map_val_and_probed_memory:PASS:test_ldsx_insn__open 0 nsec > > > > test_map_val_and_probed_memory:PASS:test_ldsx_insn__load 0 nsec > > > > libbpf: prog 'test_ptr_struct_arg': failed to attach: ERROR: strerror_r(-524)=22 > > > > libbpf: prog 'test_ptr_struct_arg': failed to auto-attach: -524 > > > > test_map_val_and_probed_memory:FAIL:test_ldsx_insn__attach unexpected error: -524 (errno 524) > > > > #116/1 ldsx_insn/map_val and probed_memory:FAIL > > > > #116 ldsx_insn:FAIL > > > > Summary: 0/2 PASSED, 0 SKIPPED, 1 FAILED > > > > > > > > Signed-off-by: Hengqi Chen <hengqi.chen@gmail.com> > > > > --- > > > > tools/testing/selftests/bpf/progs/test_ldsx_insn.c | 3 ++- > > > > tools/testing/selftests/bpf/progs/verifier_bswap.c | 3 ++- > > > > tools/testing/selftests/bpf/progs/verifier_gotol.c | 3 ++- > > > > tools/testing/selftests/bpf/progs/verifier_ldsx.c | 3 ++- > > > > tools/testing/selftests/bpf/progs/verifier_movsx.c | 3 ++- > > > > tools/testing/selftests/bpf/progs/verifier_sdiv.c | 3 ++- > > > > 6 files changed, 12 insertions(+), 6 deletions(-) > > > > > > > > diff --git a/tools/testing/selftests/bpf/progs/test_ldsx_insn.c b/tools/testing/selftests/bpf/progs/test_ldsx_insn.c > > > > index 3ddcb3777912..2a2a942737d7 100644 > > > > --- a/tools/testing/selftests/bpf/progs/test_ldsx_insn.c > > > > +++ b/tools/testing/selftests/bpf/progs/test_ldsx_insn.c > > > > @@ -7,7 +7,8 @@ > > > > > > > > #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ > > > > (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ > > > > - defined(__TARGET_ARCH_s390)) && __clang_major__ >= 18 > > > > + defined(__TARGET_ARCH_s390) || defined(__TARGET_ARCH_loongarch)) && \ > > > > + __clang_major__ >= 18 > > > > const volatile int skip = 0; > > > > #else > > > > const volatile int skip = 1; > > > > diff --git a/tools/testing/selftests/bpf/progs/verifier_bswap.c b/tools/testing/selftests/bpf/progs/verifier_bswap.c > > > > index 107525fb4a6a..e61755656e8d 100644 > > > > --- a/tools/testing/selftests/bpf/progs/verifier_bswap.c > > > > +++ b/tools/testing/selftests/bpf/progs/verifier_bswap.c > > > > @@ -6,7 +6,8 @@ > > > > > > > > #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ > > > > (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ > > > > - defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390)) && \ > > > > + defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390) || \ > > > > + defined(__TARGET_ARCH_loongarch)) && \ > > > > __clang_major__ >= 18 > > > > > > > > SEC("socket") > > > > diff --git a/tools/testing/selftests/bpf/progs/verifier_gotol.c b/tools/testing/selftests/bpf/progs/verifier_gotol.c > > > > index 9f202eda952f..d1edbcff9a18 100644 > > > > --- a/tools/testing/selftests/bpf/progs/verifier_gotol.c > > > > +++ b/tools/testing/selftests/bpf/progs/verifier_gotol.c > > > > @@ -6,7 +6,8 @@ > > > > > > > > #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ > > > > (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ > > > > - defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390)) && \ > > > > + defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390) || \ > > > > + defined(__TARGET_ARCH_loongarch)) && \ > > > > __clang_major__ >= 18 > > > > > > > > SEC("socket") > > > > diff --git a/tools/testing/selftests/bpf/progs/verifier_ldsx.c b/tools/testing/selftests/bpf/progs/verifier_ldsx.c > > > > index 375525329637..d4427d8e1217 100644 > > > > --- a/tools/testing/selftests/bpf/progs/verifier_ldsx.c > > > > +++ b/tools/testing/selftests/bpf/progs/verifier_ldsx.c > > > > @@ -6,7 +6,8 @@ > > > > > > > > #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ > > > > (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ > > > > - defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390)) && \ > > > > + defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390) || \ > > > > + defined(__TARGET_ARCH_loongarch)) && \ > > > > __clang_major__ >= 18 > > > > > > > > SEC("socket") > > > > diff --git a/tools/testing/selftests/bpf/progs/verifier_movsx.c b/tools/testing/selftests/bpf/progs/verifier_movsx.c > > > > index b2a04d1179d0..cbb9d6714f53 100644 > > > > --- a/tools/testing/selftests/bpf/progs/verifier_movsx.c > > > > +++ b/tools/testing/selftests/bpf/progs/verifier_movsx.c > > > > @@ -6,7 +6,8 @@ > > > > > > > > #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ > > > > (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ > > > > - defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390)) && \ > > > > + defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390) || \ > > > > + defined(__TARGET_ARCH_loongarch)) && \ > > > > __clang_major__ >= 18 > > > > > > > > SEC("socket") > > > > diff --git a/tools/testing/selftests/bpf/progs/verifier_sdiv.c b/tools/testing/selftests/bpf/progs/verifier_sdiv.c > > > > index 8fc5174808b2..2a2271cf0294 100644 > > > > --- a/tools/testing/selftests/bpf/progs/verifier_sdiv.c > > > > +++ b/tools/testing/selftests/bpf/progs/verifier_sdiv.c > > > > @@ -6,7 +6,8 @@ > > > > > > > > #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ > > > > (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ > > > > - defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390)) && \ > > > > + defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390) || \ > > > > + defined(__TARGET_ARCH_loongarch)) && \ > > > > __clang_major__ >= 18 > > > > > > > > SEC("socket") > > > > -- > > > > 2.34.1 > > > >
diff --git a/tools/testing/selftests/bpf/progs/test_ldsx_insn.c b/tools/testing/selftests/bpf/progs/test_ldsx_insn.c index 3ddcb3777912..2a2a942737d7 100644 --- a/tools/testing/selftests/bpf/progs/test_ldsx_insn.c +++ b/tools/testing/selftests/bpf/progs/test_ldsx_insn.c @@ -7,7 +7,8 @@ #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ - defined(__TARGET_ARCH_s390)) && __clang_major__ >= 18 + defined(__TARGET_ARCH_s390) || defined(__TARGET_ARCH_loongarch)) && \ + __clang_major__ >= 18 const volatile int skip = 0; #else const volatile int skip = 1; diff --git a/tools/testing/selftests/bpf/progs/verifier_bswap.c b/tools/testing/selftests/bpf/progs/verifier_bswap.c index 107525fb4a6a..e61755656e8d 100644 --- a/tools/testing/selftests/bpf/progs/verifier_bswap.c +++ b/tools/testing/selftests/bpf/progs/verifier_bswap.c @@ -6,7 +6,8 @@ #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ - defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390)) && \ + defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390) || \ + defined(__TARGET_ARCH_loongarch)) && \ __clang_major__ >= 18 SEC("socket") diff --git a/tools/testing/selftests/bpf/progs/verifier_gotol.c b/tools/testing/selftests/bpf/progs/verifier_gotol.c index 9f202eda952f..d1edbcff9a18 100644 --- a/tools/testing/selftests/bpf/progs/verifier_gotol.c +++ b/tools/testing/selftests/bpf/progs/verifier_gotol.c @@ -6,7 +6,8 @@ #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ - defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390)) && \ + defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390) || \ + defined(__TARGET_ARCH_loongarch)) && \ __clang_major__ >= 18 SEC("socket") diff --git a/tools/testing/selftests/bpf/progs/verifier_ldsx.c b/tools/testing/selftests/bpf/progs/verifier_ldsx.c index 375525329637..d4427d8e1217 100644 --- a/tools/testing/selftests/bpf/progs/verifier_ldsx.c +++ b/tools/testing/selftests/bpf/progs/verifier_ldsx.c @@ -6,7 +6,8 @@ #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ - defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390)) && \ + defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390) || \ + defined(__TARGET_ARCH_loongarch)) && \ __clang_major__ >= 18 SEC("socket") diff --git a/tools/testing/selftests/bpf/progs/verifier_movsx.c b/tools/testing/selftests/bpf/progs/verifier_movsx.c index b2a04d1179d0..cbb9d6714f53 100644 --- a/tools/testing/selftests/bpf/progs/verifier_movsx.c +++ b/tools/testing/selftests/bpf/progs/verifier_movsx.c @@ -6,7 +6,8 @@ #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ - defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390)) && \ + defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390) || \ + defined(__TARGET_ARCH_loongarch)) && \ __clang_major__ >= 18 SEC("socket") diff --git a/tools/testing/selftests/bpf/progs/verifier_sdiv.c b/tools/testing/selftests/bpf/progs/verifier_sdiv.c index 8fc5174808b2..2a2271cf0294 100644 --- a/tools/testing/selftests/bpf/progs/verifier_sdiv.c +++ b/tools/testing/selftests/bpf/progs/verifier_sdiv.c @@ -6,7 +6,8 @@ #if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86) || \ (defined(__TARGET_ARCH_riscv) && __riscv_xlen == 64) || \ - defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390)) && \ + defined(__TARGET_ARCH_arm) || defined(__TARGET_ARCH_s390) || \ + defined(__TARGET_ARCH_loongarch)) && \ __clang_major__ >= 18 SEC("socket")
Enable cpu v4 tests for LoongArch. Currently, we don't have BPF trampoline in LoongArch JIT, so the fentry test `test_ptr_struct_arg` still failed, will followup. Test result attached below: # ./test_progs -t verifier_sdiv,verifier_movsx,verifier_ldsx,verifier_gotol,verifier_bswap #316/1 verifier_bswap/BSWAP, 16:OK #316/2 verifier_bswap/BSWAP, 16 @unpriv:OK #316/3 verifier_bswap/BSWAP, 32:OK #316/4 verifier_bswap/BSWAP, 32 @unpriv:OK #316/5 verifier_bswap/BSWAP, 64:OK #316/6 verifier_bswap/BSWAP, 64 @unpriv:OK #316 verifier_bswap:OK #330/1 verifier_gotol/gotol, small_imm:OK #330/2 verifier_gotol/gotol, small_imm @unpriv:OK #330 verifier_gotol:OK #338/1 verifier_ldsx/LDSX, S8:OK #338/2 verifier_ldsx/LDSX, S8 @unpriv:OK #338/3 verifier_ldsx/LDSX, S16:OK #338/4 verifier_ldsx/LDSX, S16 @unpriv:OK #338/5 verifier_ldsx/LDSX, S32:OK #338/6 verifier_ldsx/LDSX, S32 @unpriv:OK #338/7 verifier_ldsx/LDSX, S8 range checking, privileged:OK #338/8 verifier_ldsx/LDSX, S16 range checking:OK #338/9 verifier_ldsx/LDSX, S16 range checking @unpriv:OK #338/10 verifier_ldsx/LDSX, S32 range checking:OK #338/11 verifier_ldsx/LDSX, S32 range checking @unpriv:OK #338 verifier_ldsx:OK #349/1 verifier_movsx/MOV32SX, S8:OK #349/2 verifier_movsx/MOV32SX, S8 @unpriv:OK #349/3 verifier_movsx/MOV32SX, S16:OK #349/4 verifier_movsx/MOV32SX, S16 @unpriv:OK #349/5 verifier_movsx/MOV64SX, S8:OK #349/6 verifier_movsx/MOV64SX, S8 @unpriv:OK #349/7 verifier_movsx/MOV64SX, S16:OK #349/8 verifier_movsx/MOV64SX, S16 @unpriv:OK #349/9 verifier_movsx/MOV64SX, S32:OK #349/10 verifier_movsx/MOV64SX, S32 @unpriv:OK #349/11 verifier_movsx/MOV32SX, S8, range_check:OK #349/12 verifier_movsx/MOV32SX, S8, range_check @unpriv:OK #349/13 verifier_movsx/MOV32SX, S16, range_check:OK #349/14 verifier_movsx/MOV32SX, S16, range_check @unpriv:OK #349/15 verifier_movsx/MOV32SX, S16, range_check 2:OK #349/16 verifier_movsx/MOV32SX, S16, range_check 2 @unpriv:OK #349/17 verifier_movsx/MOV64SX, S8, range_check:OK #349/18 verifier_movsx/MOV64SX, S8, range_check @unpriv:OK #349/19 verifier_movsx/MOV64SX, S16, range_check:OK #349/20 verifier_movsx/MOV64SX, S16, range_check @unpriv:OK #349/21 verifier_movsx/MOV64SX, S32, range_check:OK #349/22 verifier_movsx/MOV64SX, S32, range_check @unpriv:OK #349/23 verifier_movsx/MOV64SX, S16, R10 Sign Extension:OK #349/24 verifier_movsx/MOV64SX, S16, R10 Sign Extension @unpriv:OK #349 verifier_movsx:OK #361/1 verifier_sdiv/SDIV32, non-zero imm divisor, check 1:OK #361/2 verifier_sdiv/SDIV32, non-zero imm divisor, check 1 @unpriv:OK #361/3 verifier_sdiv/SDIV32, non-zero imm divisor, check 2:OK #361/4 verifier_sdiv/SDIV32, non-zero imm divisor, check 2 @unpriv:OK #361/5 verifier_sdiv/SDIV32, non-zero imm divisor, check 3:OK #361/6 verifier_sdiv/SDIV32, non-zero imm divisor, check 3 @unpriv:OK #361/7 verifier_sdiv/SDIV32, non-zero imm divisor, check 4:OK #361/8 verifier_sdiv/SDIV32, non-zero imm divisor, check 4 @unpriv:OK #361/9 verifier_sdiv/SDIV32, non-zero imm divisor, check 5:OK #361/10 verifier_sdiv/SDIV32, non-zero imm divisor, check 5 @unpriv:OK #361/11 verifier_sdiv/SDIV32, non-zero imm divisor, check 6:OK #361/12 verifier_sdiv/SDIV32, non-zero imm divisor, check 6 @unpriv:OK #361/13 verifier_sdiv/SDIV32, non-zero imm divisor, check 7:OK #361/14 verifier_sdiv/SDIV32, non-zero imm divisor, check 7 @unpriv:OK #361/15 verifier_sdiv/SDIV32, non-zero imm divisor, check 8:OK #361/16 verifier_sdiv/SDIV32, non-zero imm divisor, check 8 @unpriv:OK #361/17 verifier_sdiv/SDIV32, non-zero reg divisor, check 1:OK #361/18 verifier_sdiv/SDIV32, non-zero reg divisor, check 1 @unpriv:OK #361/19 verifier_sdiv/SDIV32, non-zero reg divisor, check 2:OK #361/20 verifier_sdiv/SDIV32, non-zero reg divisor, check 2 @unpriv:OK #361/21 verifier_sdiv/SDIV32, non-zero reg divisor, check 3:OK #361/22 verifier_sdiv/SDIV32, non-zero reg divisor, check 3 @unpriv:OK #361/23 verifier_sdiv/SDIV32, non-zero reg divisor, check 4:OK #361/24 verifier_sdiv/SDIV32, non-zero reg divisor, check 4 @unpriv:OK #361/25 verifier_sdiv/SDIV32, non-zero reg divisor, check 5:OK #361/26 verifier_sdiv/SDIV32, non-zero reg divisor, check 5 @unpriv:OK #361/27 verifier_sdiv/SDIV32, non-zero reg divisor, check 6:OK #361/28 verifier_sdiv/SDIV32, non-zero reg divisor, check 6 @unpriv:OK #361/29 verifier_sdiv/SDIV32, non-zero reg divisor, check 7:OK #361/30 verifier_sdiv/SDIV32, non-zero reg divisor, check 7 @unpriv:OK #361/31 verifier_sdiv/SDIV32, non-zero reg divisor, check 8:OK #361/32 verifier_sdiv/SDIV32, non-zero reg divisor, check 8 @unpriv:OK #361/33 verifier_sdiv/SDIV64, non-zero imm divisor, check 1:OK #361/34 verifier_sdiv/SDIV64, non-zero imm divisor, check 1 @unpriv:OK #361/35 verifier_sdiv/SDIV64, non-zero imm divisor, check 2:OK #361/36 verifier_sdiv/SDIV64, non-zero imm divisor, check 2 @unpriv:OK #361/37 verifier_sdiv/SDIV64, non-zero imm divisor, check 3:OK #361/38 verifier_sdiv/SDIV64, non-zero imm divisor, check 3 @unpriv:OK #361/39 verifier_sdiv/SDIV64, non-zero imm divisor, check 4:OK #361/40 verifier_sdiv/SDIV64, non-zero imm divisor, check 4 @unpriv:OK #361/41 verifier_sdiv/SDIV64, non-zero imm divisor, check 5:OK #361/42 verifier_sdiv/SDIV64, non-zero imm divisor, check 5 @unpriv:OK #361/43 verifier_sdiv/SDIV64, non-zero imm divisor, check 6:OK #361/44 verifier_sdiv/SDIV64, non-zero imm divisor, check 6 @unpriv:OK #361/45 verifier_sdiv/SDIV64, non-zero reg divisor, check 1:OK #361/46 verifier_sdiv/SDIV64, non-zero reg divisor, check 1 @unpriv:OK #361/47 verifier_sdiv/SDIV64, non-zero reg divisor, check 2:OK #361/48 verifier_sdiv/SDIV64, non-zero reg divisor, check 2 @unpriv:OK #361/49 verifier_sdiv/SDIV64, non-zero reg divisor, check 3:OK #361/50 verifier_sdiv/SDIV64, non-zero reg divisor, check 3 @unpriv:OK #361/51 verifier_sdiv/SDIV64, non-zero reg divisor, check 4:OK #361/52 verifier_sdiv/SDIV64, non-zero reg divisor, check 4 @unpriv:OK #361/53 verifier_sdiv/SDIV64, non-zero reg divisor, check 5:OK #361/54 verifier_sdiv/SDIV64, non-zero reg divisor, check 5 @unpriv:OK #361/55 verifier_sdiv/SDIV64, non-zero reg divisor, check 6:OK #361/56 verifier_sdiv/SDIV64, non-zero reg divisor, check 6 @unpriv:OK #361/57 verifier_sdiv/SMOD32, non-zero imm divisor, check 1:OK #361/58 verifier_sdiv/SMOD32, non-zero imm divisor, check 1 @unpriv:OK #361/59 verifier_sdiv/SMOD32, non-zero imm divisor, check 2:OK #361/60 verifier_sdiv/SMOD32, non-zero imm divisor, check 2 @unpriv:OK #361/61 verifier_sdiv/SMOD32, non-zero imm divisor, check 3:OK #361/62 verifier_sdiv/SMOD32, non-zero imm divisor, check 3 @unpriv:OK #361/63 verifier_sdiv/SMOD32, non-zero imm divisor, check 4:OK #361/64 verifier_sdiv/SMOD32, non-zero imm divisor, check 4 @unpriv:OK #361/65 verifier_sdiv/SMOD32, non-zero imm divisor, check 5:OK #361/66 verifier_sdiv/SMOD32, non-zero imm divisor, check 5 @unpriv:OK #361/67 verifier_sdiv/SMOD32, non-zero imm divisor, check 6:OK #361/68 verifier_sdiv/SMOD32, non-zero imm divisor, check 6 @unpriv:OK #361/69 verifier_sdiv/SMOD32, non-zero reg divisor, check 1:OK #361/70 verifier_sdiv/SMOD32, non-zero reg divisor, check 1 @unpriv:OK #361/71 verifier_sdiv/SMOD32, non-zero reg divisor, check 2:OK #361/72 verifier_sdiv/SMOD32, non-zero reg divisor, check 2 @unpriv:OK #361/73 verifier_sdiv/SMOD32, non-zero reg divisor, check 3:OK #361/74 verifier_sdiv/SMOD32, non-zero reg divisor, check 3 @unpriv:OK #361/75 verifier_sdiv/SMOD32, non-zero reg divisor, check 4:OK #361/76 verifier_sdiv/SMOD32, non-zero reg divisor, check 4 @unpriv:OK #361/77 verifier_sdiv/SMOD32, non-zero reg divisor, check 5:OK #361/78 verifier_sdiv/SMOD32, non-zero reg divisor, check 5 @unpriv:OK #361/79 verifier_sdiv/SMOD32, non-zero reg divisor, check 6:OK #361/80 verifier_sdiv/SMOD32, non-zero reg divisor, check 6 @unpriv:OK #361/81 verifier_sdiv/SMOD64, non-zero imm divisor, check 1:OK #361/82 verifier_sdiv/SMOD64, non-zero imm divisor, check 1 @unpriv:OK #361/83 verifier_sdiv/SMOD64, non-zero imm divisor, check 2:OK #361/84 verifier_sdiv/SMOD64, non-zero imm divisor, check 2 @unpriv:OK #361/85 verifier_sdiv/SMOD64, non-zero imm divisor, check 3:OK #361/86 verifier_sdiv/SMOD64, non-zero imm divisor, check 3 @unpriv:OK #361/87 verifier_sdiv/SMOD64, non-zero imm divisor, check 4:OK #361/88 verifier_sdiv/SMOD64, non-zero imm divisor, check 4 @unpriv:OK #361/89 verifier_sdiv/SMOD64, non-zero imm divisor, check 5:OK #361/90 verifier_sdiv/SMOD64, non-zero imm divisor, check 5 @unpriv:OK #361/91 verifier_sdiv/SMOD64, non-zero imm divisor, check 6:OK #361/92 verifier_sdiv/SMOD64, non-zero imm divisor, check 6 @unpriv:OK #361/93 verifier_sdiv/SMOD64, non-zero imm divisor, check 7:OK #361/94 verifier_sdiv/SMOD64, non-zero imm divisor, check 7 @unpriv:OK #361/95 verifier_sdiv/SMOD64, non-zero imm divisor, check 8:OK #361/96 verifier_sdiv/SMOD64, non-zero imm divisor, check 8 @unpriv:OK #361/97 verifier_sdiv/SMOD64, non-zero reg divisor, check 1:OK #361/98 verifier_sdiv/SMOD64, non-zero reg divisor, check 1 @unpriv:OK #361/99 verifier_sdiv/SMOD64, non-zero reg divisor, check 2:OK #361/100 verifier_sdiv/SMOD64, non-zero reg divisor, check 2 @unpriv:OK #361/101 verifier_sdiv/SMOD64, non-zero reg divisor, check 3:OK #361/102 verifier_sdiv/SMOD64, non-zero reg divisor, check 3 @unpriv:OK #361/103 verifier_sdiv/SMOD64, non-zero reg divisor, check 4:OK #361/104 verifier_sdiv/SMOD64, non-zero reg divisor, check 4 @unpriv:OK #361/105 verifier_sdiv/SMOD64, non-zero reg divisor, check 5:OK #361/106 verifier_sdiv/SMOD64, non-zero reg divisor, check 5 @unpriv:OK #361/107 verifier_sdiv/SMOD64, non-zero reg divisor, check 6:OK #361/108 verifier_sdiv/SMOD64, non-zero reg divisor, check 6 @unpriv:OK #361/109 verifier_sdiv/SMOD64, non-zero reg divisor, check 7:OK #361/110 verifier_sdiv/SMOD64, non-zero reg divisor, check 7 @unpriv:OK #361/111 verifier_sdiv/SMOD64, non-zero reg divisor, check 8:OK #361/112 verifier_sdiv/SMOD64, non-zero reg divisor, check 8 @unpriv:OK #361/113 verifier_sdiv/SDIV32, zero divisor:OK #361/114 verifier_sdiv/SDIV32, zero divisor @unpriv:OK #361/115 verifier_sdiv/SDIV64, zero divisor:OK #361/116 verifier_sdiv/SDIV64, zero divisor @unpriv:OK #361/117 verifier_sdiv/SMOD32, zero divisor:OK #361/118 verifier_sdiv/SMOD32, zero divisor @unpriv:OK #361/119 verifier_sdiv/SMOD64, zero divisor:OK #361/120 verifier_sdiv/SMOD64, zero divisor @unpriv:OK #361 verifier_sdiv:OK Summary: 5/163 PASSED, 0 SKIPPED, 0 FAILED # ./test_progs -t ldsx_insn test_map_val_and_probed_memory:PASS:test_ldsx_insn__open 0 nsec test_map_val_and_probed_memory:PASS:test_ldsx_insn__load 0 nsec libbpf: prog 'test_ptr_struct_arg': failed to attach: ERROR: strerror_r(-524)=22 libbpf: prog 'test_ptr_struct_arg': failed to auto-attach: -524 test_map_val_and_probed_memory:FAIL:test_ldsx_insn__attach unexpected error: -524 (errno 524) #116/1 ldsx_insn/map_val and probed_memory:FAIL #116/2 ldsx_insn/ctx_member_sign_ext:OK #116/3 ldsx_insn/ctx_member_narrow_sign_ext:OK #116 ldsx_insn:FAIL All error logs: test_map_val_and_probed_memory:PASS:test_ldsx_insn__open 0 nsec test_map_val_and_probed_memory:PASS:test_ldsx_insn__load 0 nsec libbpf: prog 'test_ptr_struct_arg': failed to attach: ERROR: strerror_r(-524)=22 libbpf: prog 'test_ptr_struct_arg': failed to auto-attach: -524 test_map_val_and_probed_memory:FAIL:test_ldsx_insn__attach unexpected error: -524 (errno 524) #116/1 ldsx_insn/map_val and probed_memory:FAIL #116 ldsx_insn:FAIL Summary: 0/2 PASSED, 0 SKIPPED, 1 FAILED Signed-off-by: Hengqi Chen <hengqi.chen@gmail.com> --- tools/testing/selftests/bpf/progs/test_ldsx_insn.c | 3 ++- tools/testing/selftests/bpf/progs/verifier_bswap.c | 3 ++- tools/testing/selftests/bpf/progs/verifier_gotol.c | 3 ++- tools/testing/selftests/bpf/progs/verifier_ldsx.c | 3 ++- tools/testing/selftests/bpf/progs/verifier_movsx.c | 3 ++- tools/testing/selftests/bpf/progs/verifier_sdiv.c | 3 ++- 6 files changed, 12 insertions(+), 6 deletions(-)