mbox series

[bpf-next,v3,00/10] Local vmtest enhancement and RV64 enabled

Message ID 20240905081401.1894789-1-pulehui@huaweicloud.com (mailing list archive)
Headers show
Series Local vmtest enhancement and RV64 enabled | expand

Message

Pu Lehui Sept. 5, 2024, 8:13 a.m. UTC
Patch 1-3 fix some problem about bpf selftests. Patch 4 add local rootfs
image support for vmtest. Patch 5 enable cross-platform testing for
vmtest. Patch 6-10 enable vmtest on RV64.

We can now perform cross platform testing for riscv64 bpf using the
following command:

PLATFORM=riscv64 CROSS_COMPILE=riscv64-linux-gnu- \
  tools/testing/selftests/bpf/vmtest.sh \
  -l <path of local rootfs image> -- \
  ./test_progs -d \
      \"$(cat tools/testing/selftests/bpf/DENYLIST.riscv64 \
          | cut -d'#' -f1 \
          | sed -e 's/^[[:space:]]*//' \
                -e 's/[[:space:]]*$//' \
          | tr -s '\n' ',' \
      )\"

For better regression, we rely on commit [0]. And since the work of riscv
ftrace to remove stop_machine atomic replacement is in progress, we also
need to revert commit [1] [2].

The test platform is x86_64 architecture, and the versions of relevant
components are as follows:
    QEMU: 8.2.0
    CLANG: 17.0.6 (align to BPF CI)
    ROOTFS: ubuntu noble (generated by [3])

Link: https://lore.kernel.org/all/20240831071520.1630360-1-pulehui@huaweicloud.com/ [0]
Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=3308172276db [1]
Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=7caa9765465f [2]
Link: https://github.com/libbpf/ci/blob/main/rootfs/mkrootfs_debian.sh [3]

v3:
- Use llvm static linking when detecting that feature-llvm is enabled
- Add Acked-by by Eduard

v2: https://lore.kernel.org/all/20240904141951.1139090-1-pulehui@huaweicloud.com/
- Drop patch about relaxing Zbb insns restrictions.
- Add local rootfs image support
- Add description about running vmtest on RV64 
- Fix some problem about bpf selftests

v1: https://lore.kernel.org/all/20240328124916.293173-1-pulehui@huaweicloud.com/

Eduard Zingerman (1):
  selftests/bpf: Prefer static linking for LLVM libraries

Pu Lehui (9):
  selftests/bpf: Adapt OUTPUT appending logic to lower versions of Make
  selftests/bpf: Rename fallback in bpf_dctcp to avoid naming conflict
  selftests/bpf: Limit URLS parsing logic to actual scope in vmtest
  selftests/bpf: Support local rootfs image for vmtest
  selftests/bpf: Enable cross platform testing for vmtest
  selftests/bpf: Add config.riscv64
  selftests/bpf: Add DENYLIST.riscv64
  selftests/bpf: Add riscv64 configurations to local vmtest
  selftests/bpf: Add description for running vmtest on RV64

 tools/testing/selftests/bpf/DENYLIST.riscv64  |   3 +
 tools/testing/selftests/bpf/Makefile          |  14 ++-
 tools/testing/selftests/bpf/README.rst        |  32 +++++-
 tools/testing/selftests/bpf/config.riscv64    |  84 ++++++++++++++
 .../selftests/bpf/prog_tests/bpf_tcp_ca.c     |   2 +-
 tools/testing/selftests/bpf/progs/bpf_dctcp.c |   8 +-
 tools/testing/selftests/bpf/vmtest.sh         | 107 ++++++++++++------
 7 files changed, 205 insertions(+), 45 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/DENYLIST.riscv64
 create mode 100644 tools/testing/selftests/bpf/config.riscv64

Comments

Daniel Borkmann Sept. 5, 2024, 6:52 p.m. UTC | #1
On 9/5/24 10:13 AM, Pu Lehui wrote:
> Patch 1-3 fix some problem about bpf selftests. Patch 4 add local rootfs
> image support for vmtest. Patch 5 enable cross-platform testing for
> vmtest. Patch 6-10 enable vmtest on RV64.
> 
> We can now perform cross platform testing for riscv64 bpf using the
> following command:
> 
> PLATFORM=riscv64 CROSS_COMPILE=riscv64-linux-gnu- \
>    tools/testing/selftests/bpf/vmtest.sh \
>    -l <path of local rootfs image> -- \
>    ./test_progs -d \
>        \"$(cat tools/testing/selftests/bpf/DENYLIST.riscv64 \
>            | cut -d'#' -f1 \
>            | sed -e 's/^[[:space:]]*//' \
>                  -e 's/[[:space:]]*$//' \
>            | tr -s '\n' ',' \
>        )\"
> 
> For better regression, we rely on commit [0]. And since the work of riscv
> ftrace to remove stop_machine atomic replacement is in progress, we also
> need to revert commit [1] [2].
> 
> The test platform is x86_64 architecture, and the versions of relevant
> components are as follows:
>      QEMU: 8.2.0
>      CLANG: 17.0.6 (align to BPF CI)
>      ROOTFS: ubuntu noble (generated by [3])
> 
> Link: https://lore.kernel.org/all/20240831071520.1630360-1-pulehui@huaweicloud.com/ [0]
> Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=3308172276db [1]
> Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=7caa9765465f [2]
> Link: https://github.com/libbpf/ci/blob/main/rootfs/mkrootfs_debian.sh [3]

Nice work! Next step is upstream BPF CI integration? :)

Fwiw, all still works for me on x86-64 (*), so:

Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Tested-by: Daniel Borkmann <daniel@iogearbox.net>

(*) fresh Equinix Ubuntu instance still requires this one for vmtest.sh, but
     that is independent of this series (and for others it seems not required)

diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index 04716a5e43f1..02dd161e5185 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -693,7 +693,7 @@ $(OUTPUT)/$(TRUNNER_BINARY): $(TRUNNER_TEST_OBJS)                   \
                              $(TRUNNER_BPFTOOL)                         \
                              | $(TRUNNER_BINARY)-extras
         $$(call msg,BINARY,,$$@)
-       $(Q)$$(CC) $$(CFLAGS) $$(filter %.a %.o,$$^) $$(LDLIBS) $$(LDFLAGS) -o $$@
+       $(Q)$$(CC) $$(CFLAGS) $(TRUNNER_LDFLAGS) $$(filter %.a %.o,$$^) $$(LDLIBS) $$(LDFLAGS) -o $$@
         $(Q)$(RESOLVE_BTFIDS) --btf $(TRUNNER_OUTPUT)/btf_data.bpf.o $$@
         $(Q)ln -sf $(if $2,..,.)/tools/build/bpftool/$(USE_BOOTSTRAP)bpftool \
                    $(OUTPUT)/$(if $2,$2/)bpftool
diff --git a/tools/testing/selftests/bpf/vmtest.sh b/tools/testing/selftests/bpf/vmtest.sh
index 79505d294c44..afbd6b785064 100755
--- a/tools/testing/selftests/bpf/vmtest.sh
+++ b/tools/testing/selftests/bpf/vmtest.sh
@@ -189,7 +189,7 @@ update_selftests()
         local selftests_dir="${kernel_checkout}/tools/testing/selftests/bpf"

         cd "${selftests_dir}"
-       ${make_command}
+       TRUNNER_LDFLAGS=-static ${make_command}

         # Mount the image and copy the selftests to the image.
         mount_image
patchwork-bot+netdevbpf@kernel.org Sept. 5, 2024, 8:20 p.m. UTC | #2
Hello:

This series was applied to bpf/bpf-next.git (master)
by Alexei Starovoitov <ast@kernel.org>:

On Thu,  5 Sep 2024 08:13:51 +0000 you wrote:
> Patch 1-3 fix some problem about bpf selftests. Patch 4 add local rootfs
> image support for vmtest. Patch 5 enable cross-platform testing for
> vmtest. Patch 6-10 enable vmtest on RV64.
> 
> We can now perform cross platform testing for riscv64 bpf using the
> following command:
> 
> [...]

Here is the summary with links:
  - [bpf-next,v3,01/10] selftests/bpf: Adapt OUTPUT appending logic to lower versions of Make
    https://git.kernel.org/bpf/bpf-next/c/dc3a8804d790
  - [bpf-next,v3,02/10] selftests/bpf: Rename fallback in bpf_dctcp to avoid naming conflict
    https://git.kernel.org/bpf/bpf-next/c/a48a43884cdd
  - [bpf-next,v3,03/10] selftests/bpf: Prefer static linking for LLVM libraries
    https://git.kernel.org/bpf/bpf-next/c/67ab80a01886
  - [bpf-next,v3,04/10] selftests/bpf: Limit URLS parsing logic to actual scope in vmtest
    https://git.kernel.org/bpf/bpf-next/c/0c3fc330be6d
  - [bpf-next,v3,05/10] selftests/bpf: Support local rootfs image for vmtest
    https://git.kernel.org/bpf/bpf-next/c/2294073dce32
  - [bpf-next,v3,06/10] selftests/bpf: Enable cross platform testing for vmtest
    https://git.kernel.org/bpf/bpf-next/c/d95d56519026
  - [bpf-next,v3,07/10] selftests/bpf: Add config.riscv64
    https://git.kernel.org/bpf/bpf-next/c/897b3680484b
  - [bpf-next,v3,08/10] selftests/bpf: Add DENYLIST.riscv64
    https://git.kernel.org/bpf/bpf-next/c/c402cb85802f
  - [bpf-next,v3,09/10] selftests/bpf: Add riscv64 configurations to local vmtest
    https://git.kernel.org/bpf/bpf-next/c/b2bc9d505499
  - [bpf-next,v3,10/10] selftests/bpf: Add description for running vmtest on RV64
    https://git.kernel.org/bpf/bpf-next/c/95b1c5d17832

You are awesome, thank you!
Pu Lehui Sept. 6, 2024, 3:56 a.m. UTC | #3
On 2024/9/6 2:52, Daniel Borkmann wrote:
> On 9/5/24 10:13 AM, Pu Lehui wrote:
>> Patch 1-3 fix some problem about bpf selftests. Patch 4 add local rootfs
>> image support for vmtest. Patch 5 enable cross-platform testing for
>> vmtest. Patch 6-10 enable vmtest on RV64.
>>
>> We can now perform cross platform testing for riscv64 bpf using the
>> following command:
>>
>> PLATFORM=riscv64 CROSS_COMPILE=riscv64-linux-gnu- \
>>    tools/testing/selftests/bpf/vmtest.sh \
>>    -l <path of local rootfs image> -- \
>>    ./test_progs -d \
>>        \"$(cat tools/testing/selftests/bpf/DENYLIST.riscv64 \
>>            | cut -d'#' -f1 \
>>            | sed -e 's/^[[:space:]]*//' \
>>                  -e 's/[[:space:]]*$//' \
>>            | tr -s '\n' ',' \
>>        )\"
>>
>> For better regression, we rely on commit [0]. And since the work of riscv
>> ftrace to remove stop_machine atomic replacement is in progress, we also
>> need to revert commit [1] [2].
>>
>> The test platform is x86_64 architecture, and the versions of relevant
>> components are as follows:
>>      QEMU: 8.2.0
>>      CLANG: 17.0.6 (align to BPF CI)
>>      ROOTFS: ubuntu noble (generated by [3])
>>
>> Link: 
>> https://lore.kernel.org/all/20240831071520.1630360-1-pulehui@huaweicloud.com/ [0]
>> Link: 
>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=3308172276db [1]
>> Link: 
>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=7caa9765465f [2]
>> Link: https://github.com/libbpf/ci/blob/main/rootfs/mkrootfs_debian.sh 
>> [3]
> 
> Nice work! Next step is upstream BPF CI integration? :)

CC Björn
Björn Töpel Sept. 6, 2024, 2:08 p.m. UTC | #4
Lehui, Daniel!

Pu Lehui <pulehui@huaweicloud.com> writes:

> On 2024/9/6 2:52, Daniel Borkmann wrote:
>> On 9/5/24 10:13 AM, Pu Lehui wrote:
>>> Patch 1-3 fix some problem about bpf selftests. Patch 4 add local rootfs
>>> image support for vmtest. Patch 5 enable cross-platform testing for
>>> vmtest. Patch 6-10 enable vmtest on RV64.
>>>
>>> We can now perform cross platform testing for riscv64 bpf using the
>>> following command:
>>>
>>> PLATFORM=riscv64 CROSS_COMPILE=riscv64-linux-gnu- \
>>>    tools/testing/selftests/bpf/vmtest.sh \
>>>    -l <path of local rootfs image> -- \
>>>    ./test_progs -d \
>>>        \"$(cat tools/testing/selftests/bpf/DENYLIST.riscv64 \
>>>            | cut -d'#' -f1 \
>>>            | sed -e 's/^[[:space:]]*//' \
>>>                  -e 's/[[:space:]]*$//' \
>>>            | tr -s '\n' ',' \
>>>        )\"
>>>
>>> For better regression, we rely on commit [0]. And since the work of riscv
>>> ftrace to remove stop_machine atomic replacement is in progress, we also
>>> need to revert commit [1] [2].
>>>
>>> The test platform is x86_64 architecture, and the versions of relevant
>>> components are as follows:
>>>      QEMU: 8.2.0
>>>      CLANG: 17.0.6 (align to BPF CI)
>>>      ROOTFS: ubuntu noble (generated by [3])
>>>
>>> Link: 
>>> https://lore.kernel.org/all/20240831071520.1630360-1-pulehui@huaweicloud.com/ [0]
>>> Link: 
>>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=3308172276db [1]
>>> Link: 
>>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=7caa9765465f [2]
>>> Link: https://github.com/libbpf/ci/blob/main/rootfs/mkrootfs_debian.sh 
>>> [3]
>> 
>> Nice work! Next step is upstream BPF CI integration? :)
>
> CC Björn