Re: [PATCH bpf-next 7/7] selftests/bpf: Enable cpu v4 tests for arm64

Xu Kuohai
2023-08-16T02:31:19Z

On 8/16/2023 9:57 AM, Yonghong Song wrote:
>
>
> On 8/15/23 6:28 PM, Xu Kuohai wrote:
>> On 8/16/2023 12:57 AM, Yonghong Song wrote:
>>>
>>>
>>> On 8/15/23 8:41 AM, Xu Kuohai wrote:
>>>> From: Xu Kuohai <xukuohai@huawei.com>
>>>>
>>>> Enable cpu v4 instruction tests for arm64.
>>>>
>>>> Signed-off-by: Xu Kuohai <xukuohai@huawei.com>
>>>
>>> Thanks for adding cpu v4 support for arm64. The CI looks green as well for arm64.
>>>
>>> https://github.com/kernel-patches/bpf/actions/runs/5868919914/job/15912774884?pr=5525
>>>
>>
>> Well, it looks like the CI's clang doesn't support cpu v4 yet:
>>
>>    #306/1   verifier_bswap/cpuv4 is not supported by compiler or jit, use a dummy test:OK
>>    #306     verifier_bswap:OK
>>
>>> Ack this patch which enabled cpu v4 tests for arm64.
>
> Ah. Sorry. Could you paste your local cpu v4 run results for
> these related tests in the commit message then?
>

Sure. The results are as follows. I'll post these in the commit message.

# ./test_progs -t ldsx_insn,verifier_sdiv,verifier_movsx,verifier_ldsx,verifier_gotol,verifier_bswap
#115/1 ldsx_insn/map_val and probed_memory:OK
#115/2 ldsx_insn/ctx_member_sign_ext:OK
#115/3 ldsx_insn/ctx_member_narrow_sign_ext:OK
#115 ldsx_insn:OK
#302/1 verifier_bswap/BSWAP, 16:OK
#302/2 verifier_bswap/BSWAP, 16 @unpriv:OK
#302/3 verifier_bswap/BSWAP, 32:OK
#302/4 verifier_bswap/BSWAP, 32 @unpriv:OK
#302/5 verifier_bswap/BSWAP, 64:OK
#302/6 verifier_bswap/BSWAP, 64 @unpriv:OK
#302 verifier_bswap:OK
#316/1 verifier_gotol/gotol, small_imm:OK
#316/2 verifier_gotol/gotol, small_imm @unpriv:OK
#316 verifier_gotol:OK
#324/1 verifier_ldsx/LDSX, S8:OK
#324/2 verifier_ldsx/LDSX, S8 @unpriv:OK
#324/3 verifier_ldsx/LDSX, S16:OK
#324/4 verifier_ldsx/LDSX, S16 @unpriv:OK
#324/5 verifier_ldsx/LDSX, S32:OK
#324/6 verifier_ldsx/LDSX, S32 @unpriv:OK
#324/7 verifier_ldsx/LDSX, S8 range checking, privileged:OK
#324/8 verifier_ldsx/LDSX, S16 range checking:OK
#324/9 verifier_ldsx/LDSX, S16 range checking @unpriv:OK
#324/10 verifier_ldsx/LDSX, S32 range checking:OK
#324/11 verifier_ldsx/LDSX, S32 range checking @unpriv:OK
#324 verifier_ldsx:OK
#335/1 verifier_movsx/MOV32SX, S8:OK
#335/2 verifier_movsx/MOV32SX, S8 @unpriv:OK
#335/3 verifier_movsx/MOV32SX, S16:OK
#335/4 verifier_movsx/MOV32SX, S16 @unpriv:OK
#335/5 verifier_movsx/MOV64SX, S8:OK
#335/6 verifier_movsx/MOV64SX, S8 @unpriv:OK
#335/7 verifier_movsx/MOV64SX, S16:OK
#335/8 verifier_movsx/MOV64SX, S16 @unpriv:OK
#335/9 verifier_movsx/MOV64SX, S32:OK
#335/10 verifier_movsx/MOV64SX, S32 @unpriv:OK
#335/11 verifier_movsx/MOV32SX, S8, range_check:OK
#335/12 verifier_movsx/MOV32SX, S8, range_check @unpriv:OK
#335/13 verifier_movsx/MOV32SX, S16, range_check:OK
#335/14 verifier_movsx/MOV32SX, S16, range_check @unpriv:OK
#335/15 verifier_movsx/MOV32SX, S16, range_check 2:OK
#335/16 verifier_movsx/MOV32SX, S16, range_check 2 @unpriv:OK
#335/17 verifier_movsx/MOV64SX, S8, range_check:OK
#335/18 verifier_movsx/MOV64SX, S8, range_check @unpriv:OK
#335/19 verifier_movsx/MOV64SX, S16, range_check:OK
#335/20 verifier_movsx/MOV64SX, S16, range_check @unpriv:OK
#335/21 verifier_movsx/MOV64SX, S32, range_check:OK
#335/22 verifier_movsx/MOV64SX, S32, range_check @unpriv:OK
#335/23 verifier_movsx/MOV64SX, S16, R10 Sign Extension:OK
#335/24 verifier_movsx/MOV64SX, S16, R10 Sign Extension @unpriv:OK
#335 verifier_movsx:OK
#347/1 verifier_sdiv/SDIV32, non-zero imm divisor, check 1:OK
#347/2 verifier_sdiv/SDIV32, non-zero imm divisor, check 1 @unpriv:OK
#347/3 verifier_sdiv/SDIV32, non-zero imm divisor, check 2:OK
#347/4 verifier_sdiv/SDIV32, non-zero imm divisor, check 2 @unpriv:OK
#347/5 verifier_sdiv/SDIV32, non-zero imm divisor, check 3:OK
#347/6 verifier_sdiv/SDIV32, non-zero imm divisor, check 3 @unpriv:OK
#347/7 verifier_sdiv/SDIV32, non-zero imm divisor, check 4:OK
#347/8 verifier_sdiv/SDIV32, non-zero imm divisor, check 4 @unpriv:OK
#347/9 verifier_sdiv/SDIV32, non-zero imm divisor, check 5:OK
#347/10 verifier_sdiv/SDIV32, non-zero imm divisor, check 5 @unpriv:OK
#347/11 verifier_sdiv/SDIV32, non-zero imm divisor, check 6:OK
#347/12 verifier_sdiv/SDIV32, non-zero imm divisor, check 6 @unpriv:OK
#347/13 verifier_sdiv/SDIV32, non-zero imm divisor, check 7:OK
#347/14 verifier_sdiv/SDIV32, non-zero imm divisor, check 7 @unpriv:OK
#347/15 verifier_sdiv/SDIV32, non-zero imm divisor, check 8:OK
#347/16 verifier_sdiv/SDIV32, non-zero imm divisor, check 8 @unpriv:OK
#347/17 verifier_sdiv/SDIV32, non-zero reg divisor, check 1:OK
#347/18 verifier_sdiv/SDIV32, non-zero reg divisor, check 1 @unpriv:OK
#347/19 verifier_sdiv/SDIV32, non-zero reg divisor, check 2:OK
#347/20 verifier_sdiv/SDIV32, non-zero reg divisor, check 2 @unpriv:OK
#347/21 verifier_sdiv/SDIV32, non-zero reg divisor, check 3:OK
#347/22 verifier_sdiv/SDIV32, non-zero reg divisor, check 3 @unpriv:OK
#347/23 verifier_sdiv/SDIV32, non-zero reg divisor, check 4:OK
#347/24 verifier_sdiv/SDIV32, non-zero reg divisor, check 4 @unpriv:OK
#347/25 verifier_sdiv/SDIV32, non-zero reg divisor, check 5:OK
#347/26 verifier_sdiv/SDIV32, non-zero reg divisor, check 5 @unpriv:OK
#347/27 verifier_sdiv/SDIV32, non-zero reg divisor, check 6:OK
#347/28 verifier_sdiv/SDIV32, non-zero reg divisor, check 6 @unpriv:OK
#347/29 verifier_sdiv/SDIV32, non-zero reg divisor, check 7:OK
#347/30 verifier_sdiv/SDIV32, non-zero reg divisor, check 7 @unpriv:OK
#347/31 verifier_sdiv/SDIV32, non-zero reg divisor, check 8:OK
#347/32 verifier_sdiv/SDIV32, non-zero reg divisor, check 8 @unpriv:OK
#347/33 verifier_sdiv/SDIV64, non-zero imm divisor, check 1:OK
#347/34 verifier_sdiv/SDIV64, non-zero imm divisor, check 1 @unpriv:OK
#347/35 verifier_sdiv/SDIV64, non-zero imm divisor, check 2:OK
#347/36 verifier_sdiv/SDIV64, non-zero imm divisor, check 2 @unpriv:OK
#347/37 verifier_sdiv/SDIV64, non-zero imm divisor, check 3:OK
#347/38 verifier_sdiv/SDIV64, non-zero imm divisor, check 3 @unpriv:OK
#347/39 verifier_sdiv/SDIV64, non-zero imm divisor, check 4:OK
#347/40 verifier_sdiv/SDIV64, non-zero imm divisor, check 4 @unpriv:OK
#347/41 verifier_sdiv/SDIV64, non-zero imm divisor, check 5:OK
#347/42 verifier_sdiv/SDIV64, non-zero imm divisor, check 5 @unpriv:OK
#347/43 verifier_sdiv/SDIV64, non-zero imm divisor, check 6:OK
#347/44 verifier_sdiv/SDIV64, non-zero imm divisor, check 6 @unpriv:OK
#347/45 verifier_sdiv/SDIV64, non-zero reg divisor, check 1:OK
#347/46 verifier_sdiv/SDIV64, non-zero reg divisor, check 1 @unpriv:OK
#347/47 verifier_sdiv/SDIV64, non-zero reg divisor, check 2:OK
#347/48 verifier_sdiv/SDIV64, non-zero reg divisor, check 2 @unpriv:OK
#347/49 verifier_sdiv/SDIV64, non-zero reg divisor, check 3:OK
#347/50 verifier_sdiv/SDIV64, non-zero reg divisor, check 3 @unpriv:OK
#347/51 verifier_sdiv/SDIV64, non-zero reg divisor, check 4:OK
#347/52 verifier_sdiv/SDIV64, non-zero reg divisor, check 4 @unpriv:OK
#347/53 verifier_sdiv/SDIV64, non-zero reg divisor, check 5:OK
#347/54 verifier_sdiv/SDIV64, non-zero reg divisor, check 5 @unpriv:OK
#347/55 verifier_sdiv/SDIV64, non-zero reg divisor, check 6:OK
#347/56 verifier_sdiv/SDIV64, non-zero reg divisor, check 6 @unpriv:OK
#347/57 verifier_sdiv/SMOD32, non-zero imm divisor, check 1:OK
#347/58 verifier_sdiv/SMOD32, non-zero imm divisor, check 1 @unpriv:OK
#347/59 verifier_sdiv/SMOD32, non-zero imm divisor, check 2:OK
#347/60 verifier_sdiv/SMOD32, non-zero imm divisor, check 2 @unpriv:OK
#347/61 verifier_sdiv/SMOD32, non-zero imm divisor, check 3:OK
#347/62 verifier_sdiv/SMOD32, non-zero imm divisor, check 3 @unpriv:OK
#347/63 verifier_sdiv/SMOD32, non-zero imm divisor, check 4:OK
#347/64 verifier_sdiv/SMOD32, non-zero imm divisor, check 4 @unpriv:OK
#347/65 verifier_sdiv/SMOD32, non-zero imm divisor, check 5:OK
#347/66 verifier_sdiv/SMOD32, non-zero imm divisor, check 5 @unpriv:OK
#347/67 verifier_sdiv/SMOD32, non-zero imm divisor, check 6:OK
#347/68 verifier_sdiv/SMOD32, non-zero imm divisor, check 6 @unpriv:OK
#347/69 verifier_sdiv/SMOD32, non-zero reg divisor, check 1:OK
#347/70 verifier_sdiv/SMOD32, non-zero reg divisor, check 1 @unpriv:OK
#347/71 verifier_sdiv/SMOD32, non-zero reg divisor, check 2:OK
#347/72 verifier_sdiv/SMOD32, non-zero reg divisor, check 2 @unpriv:OK
#347/73 verifier_sdiv/SMOD32, non-zero reg divisor, check 3:OK
#347/74 verifier_sdiv/SMOD32, non-zero reg divisor, check 3 @unpriv:OK
#347/75 verifier_sdiv/SMOD32, non-zero reg divisor, check 4:OK
#347/76 verifier_sdiv/SMOD32, non-zero reg divisor, check 4 @unpriv:OK
#347/77 verifier_sdiv/SMOD32, non-zero reg divisor, check 5:OK
#347/78 verifier_sdiv/SMOD32, non-zero reg divisor, check 5 @unpriv:OK
#347/79 verifier_sdiv/SMOD32, non-zero reg divisor, check 6:OK
#347/80 verifier_sdiv/SMOD32, non-zero reg divisor, check 6 @unpriv:OK
#347/81 verifier_sdiv/SMOD64, non-zero imm divisor, check 1:OK
#347/82 verifier_sdiv/SMOD64, non-zero imm divisor, check 1 @unpriv:OK
#347/83 verifier_sdiv/SMOD64, non-zero imm divisor, check 2:OK
#347/84 verifier_sdiv/SMOD64, non-zero imm divisor, check 2 @unpriv:OK
#347/85 verifier_sdiv/SMOD64, non-zero imm divisor, check 3:OK
#347/86 verifier_sdiv/SMOD64, non-zero imm divisor, check 3 @unpriv:OK
#347/87 verifier_sdiv/SMOD64, non-zero imm divisor, check 4:OK
#347/88 verifier_sdiv/SMOD64, non-zero imm divisor, check 4 @unpriv:OK
#347/89 verifier_sdiv/SMOD64, non-zero imm divisor, check 5:OK
#347/90 verifier_sdiv/SMOD64, non-zero imm divisor, check 5 @unpriv:OK
#347/91 verifier_sdiv/SMOD64, non-zero imm divisor, check 6:OK
#347/92 verifier_sdiv/SMOD64, non-zero imm divisor, check 6 @unpriv:OK
#347/93 verifier_sdiv/SMOD64, non-zero imm divisor, check 7:OK
#347/94 verifier_sdiv/SMOD64, non-zero imm divisor, check 7 @unpriv:OK
#347/95 verifier_sdiv/SMOD64, non-zero imm divisor, check 8:OK
#347/96 verifier_sdiv/SMOD64, non-zero imm divisor, check 8 @unpriv:OK
#347/97 verifier_sdiv/SMOD64, non-zero reg divisor, check 1:OK
#347/98 verifier_sdiv/SMOD64, non-zero reg divisor, check 1 @unpriv:OK
#347/99 verifier_sdiv/SMOD64, non-zero reg divisor, check 2:OK
#347/100 verifier_sdiv/SMOD64, non-zero reg divisor, check 2 @unpriv:OK
#347/101 verifier_sdiv/SMOD64, non-zero reg divisor, check 3:OK
#347/102 verifier_sdiv/SMOD64, non-zero reg divisor, check 3 @unpriv:OK
#347/103 verifier_sdiv/SMOD64, non-zero reg divisor, check 4:OK
#347/104 verifier_sdiv/SMOD64, non-zero reg divisor, check 4 @unpriv:OK
#347/105 verifier_sdiv/SMOD64, non-zero reg divisor, check 5:OK
#347/106 verifier_sdiv/SMOD64, non-zero reg divisor, check 5 @unpriv:OK
#347/107 verifier_sdiv/SMOD64, non-zero reg divisor, check 6:OK
#347/108 verifier_sdiv/SMOD64, non-zero reg divisor, check 6 @unpriv:OK
#347/109 verifier_sdiv/SMOD64, non-zero reg divisor, check 7:OK
#347/110 verifier_sdiv/SMOD64, non-zero reg divisor, check 7 @unpriv:OK
#347/111 verifier_sdiv/SMOD64, non-zero reg divisor, check 8:OK
#347/112 verifier_sdiv/SMOD64, non-zero reg divisor, check 8 @unpriv:OK
#347/113 verifier_sdiv/SDIV32, zero divisor:OK
#347/114 verifier_sdiv/SDIV32, zero divisor @unpriv:OK
#347/115 verifier_sdiv/SDIV64, zero divisor:OK
#347/116 verifier_sdiv/SDIV64, zero divisor @unpriv:OK
#347/117 verifier_sdiv/SMOD32, zero divisor:OK
#347/118 verifier_sdiv/SMOD32, zero divisor @unpriv:OK
#347/119 verifier_sdiv/SMOD64, zero divisor:OK
#347/120 verifier_sdiv/SMOD64, zero divisor @unpriv:OK
#347 verifier_sdiv:OK
Summary: 6/166 PASSED, 0 SKIPPED, 0 FAILED

>>>
>>> Acked-by: Yonghong Song <yonghong.song@linux.dev>
>>>
>>>> ---
>>>>   tools/testing/selftests/bpf/progs/test_ldsx_insn.c | 2 +-
>>>>   tools/testing/selftests/bpf/progs/verifier_bswap.c | 2 +-
>>>>   tools/testing/selftests/bpf/progs/verifier_gotol.c | 2 +-
>>>>   tools/testing/selftests/bpf/progs/verifier_ldsx.c  | 2 +-
>>>>   tools/testing/selftests/bpf/progs/verifier_movsx.c | 2 +-
>>>>   tools/testing/selftests/bpf/progs/verifier_sdiv.c  | 2 +-
>>>>   6 files changed, 6 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 321abf862801..916d9435f12c 100644
>>>> --- a/tools/testing/selftests/bpf/progs/test_ldsx_insn.c
>>>> +++ b/tools/testing/selftests/bpf/progs/test_ldsx_insn.c
>>>> @@ -5,7 +5,7 @@
>>>>   #include <bpf/bpf_helpers.h>
>>>>   #include <bpf/bpf_tracing.h>
>>>> -#if defined(__TARGET_ARCH_x86) && __clang_major__ >= 18
>>>> +#if (defined(__TARGET_ARCH_arm64) || defined(__TARGET_ARCH_x86)) && __clang_major__ >= 18
>>>>   const volatile int skip = 0;
>>>>   #else
>>>>   const volatile int skip = 1;
>>> [...]
>>>
>>> .
>>
>
> .