* [PATCH bpf-next v3 00/10] Local vmtest enhancement and RV64 enabled
@ 2024-09-05 8:13 Pu Lehui
2024-09-05 8:13 ` [PATCH bpf-next v3 01/10] selftests/bpf: Adapt OUTPUT appending logic to lower versions of Make Pu Lehui
` (11 more replies)
0 siblings, 12 replies; 16+ messages in thread
From: Pu Lehui @ 2024-09-05 8:13 UTC (permalink / raw)
To: bpf, linux-riscv, netdev
Cc: Andrii Nakryiko, Eduard Zingerman, Mykola Lysenko,
Björn Töpel, Puranjay Mohan, Alexei Starovoitov,
Daniel Borkmann, Martin KaFai Lau, Song Liu, Yonghong Song,
John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
Palmer Dabbelt, Pu Lehui
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
--
2.34.1
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH bpf-next v3 01/10] selftests/bpf: Adapt OUTPUT appending logic to lower versions of Make
2024-09-05 8:13 [PATCH bpf-next v3 00/10] Local vmtest enhancement and RV64 enabled Pu Lehui
@ 2024-09-05 8:13 ` Pu Lehui
2024-09-05 8:13 ` [PATCH bpf-next v3 02/10] selftests/bpf: Rename fallback in bpf_dctcp to avoid naming conflict Pu Lehui
` (10 subsequent siblings)
11 siblings, 0 replies; 16+ messages in thread
From: Pu Lehui @ 2024-09-05 8:13 UTC (permalink / raw)
To: bpf, linux-riscv, netdev
Cc: Andrii Nakryiko, Eduard Zingerman, Mykola Lysenko,
Björn Töpel, Puranjay Mohan, Alexei Starovoitov,
Daniel Borkmann, Martin KaFai Lau, Song Liu, Yonghong Song,
John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
Palmer Dabbelt, Pu Lehui
From: Pu Lehui <pulehui@huawei.com>
The $(let ...) function is only supported by GNU Make version 4.4 [0]
and above, otherwise the following exception file or directory will be
generated:
tools/testing/selftests/bpfFEATURE-DUMP.selftests
tools/testing/selftests/bpffeature/
Considering that the GNU Make version of most Linux distributions is
lower than 4.4, let us adapt the corresponding logic to it.
Link: https://lists.gnu.org/archive/html/info-gnu/2022-10/msg00008.html [0]
Acked-by: Eduard Zingerman <eddyz87@gmail.com>
Signed-off-by: Pu Lehui <pulehui@huawei.com>
---
tools/testing/selftests/bpf/Makefile | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index 7660d19b66c2..9905e3739dd0 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -187,8 +187,14 @@ FEATURE_TESTS := llvm
FEATURE_DISPLAY := $(FEATURE_TESTS)
# Makefile.feature expects OUTPUT to end with a slash
+ifeq ($(shell expr $(MAKE_VERSION) \>= 4.4), 1)
$(let OUTPUT,$(OUTPUT)/,\
$(eval include ../../../build/Makefile.feature))
+else
+OUTPUT := $(OUTPUT)/
+$(eval include ../../../build/Makefile.feature)
+OUTPUT := $(patsubst %/,%,$(OUTPUT))
+endif
endif
ifeq ($(feature-llvm),1)
--
2.34.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH bpf-next v3 02/10] selftests/bpf: Rename fallback in bpf_dctcp to avoid naming conflict
2024-09-05 8:13 [PATCH bpf-next v3 00/10] Local vmtest enhancement and RV64 enabled Pu Lehui
2024-09-05 8:13 ` [PATCH bpf-next v3 01/10] selftests/bpf: Adapt OUTPUT appending logic to lower versions of Make Pu Lehui
@ 2024-09-05 8:13 ` Pu Lehui
2024-09-05 8:13 ` [PATCH bpf-next v3 03/10] selftests/bpf: Prefer static linking for LLVM libraries Pu Lehui
` (9 subsequent siblings)
11 siblings, 0 replies; 16+ messages in thread
From: Pu Lehui @ 2024-09-05 8:13 UTC (permalink / raw)
To: bpf, linux-riscv, netdev
Cc: Andrii Nakryiko, Eduard Zingerman, Mykola Lysenko,
Björn Töpel, Puranjay Mohan, Alexei Starovoitov,
Daniel Borkmann, Martin KaFai Lau, Song Liu, Yonghong Song,
John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
Palmer Dabbelt, Pu Lehui
From: Pu Lehui <pulehui@huawei.com>
Recently, when compiling bpf selftests on RV64, the following
compilation failure occurred:
progs/bpf_dctcp.c:29:21: error: redefinition of 'fallback' as different kind of symbol
29 | volatile const char fallback[TCP_CA_NAME_MAX];
| ^
/workspace/tools/testing/selftests/bpf/tools/include/vmlinux.h:86812:15: note: previous definition is here
86812 | typedef u32 (*fallback)(u32, const unsigned char *, size_t);
The reason is that the `fallback` symbol has been defined in
arch/riscv/lib/crc32.c, which will cause symbol conflicts when vmlinux.h
is included in bpf_dctcp. Let we rename `fallback` string to
`fallback_cc` in bpf_dctcp to fix this compilation failure.
Signed-off-by: Pu Lehui <pulehui@huawei.com>
---
tools/testing/selftests/bpf/prog_tests/bpf_tcp_ca.c | 2 +-
tools/testing/selftests/bpf/progs/bpf_dctcp.c | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/tools/testing/selftests/bpf/prog_tests/bpf_tcp_ca.c b/tools/testing/selftests/bpf/prog_tests/bpf_tcp_ca.c
index 1d494b4453f4..409a06975823 100644
--- a/tools/testing/selftests/bpf/prog_tests/bpf_tcp_ca.c
+++ b/tools/testing/selftests/bpf/prog_tests/bpf_tcp_ca.c
@@ -285,7 +285,7 @@ static void test_dctcp_fallback(void)
dctcp_skel = bpf_dctcp__open();
if (!ASSERT_OK_PTR(dctcp_skel, "dctcp_skel"))
return;
- strcpy(dctcp_skel->rodata->fallback, "cubic");
+ strcpy(dctcp_skel->rodata->fallback_cc, "cubic");
if (!ASSERT_OK(bpf_dctcp__load(dctcp_skel), "bpf_dctcp__load"))
goto done;
diff --git a/tools/testing/selftests/bpf/progs/bpf_dctcp.c b/tools/testing/selftests/bpf/progs/bpf_dctcp.c
index 02f552e7fd4d..7cd73e75f52a 100644
--- a/tools/testing/selftests/bpf/progs/bpf_dctcp.c
+++ b/tools/testing/selftests/bpf/progs/bpf_dctcp.c
@@ -26,7 +26,7 @@ static bool before(__u32 seq1, __u32 seq2)
char _license[] SEC("license") = "GPL";
-volatile const char fallback[TCP_CA_NAME_MAX];
+volatile const char fallback_cc[TCP_CA_NAME_MAX];
const char bpf_dctcp[] = "bpf_dctcp";
const char tcp_cdg[] = "cdg";
char cc_res[TCP_CA_NAME_MAX];
@@ -71,10 +71,10 @@ void BPF_PROG(bpf_dctcp_init, struct sock *sk)
struct bpf_dctcp *ca = inet_csk_ca(sk);
int *stg;
- if (!(tp->ecn_flags & TCP_ECN_OK) && fallback[0]) {
+ if (!(tp->ecn_flags & TCP_ECN_OK) && fallback_cc[0]) {
/* Switch to fallback */
if (bpf_setsockopt(sk, SOL_TCP, TCP_CONGESTION,
- (void *)fallback, sizeof(fallback)) == -EBUSY)
+ (void *)fallback_cc, sizeof(fallback_cc)) == -EBUSY)
ebusy_cnt++;
/* Switch back to myself and the recurred bpf_dctcp_init()
@@ -87,7 +87,7 @@ void BPF_PROG(bpf_dctcp_init, struct sock *sk)
/* Switch back to fallback */
if (bpf_setsockopt(sk, SOL_TCP, TCP_CONGESTION,
- (void *)fallback, sizeof(fallback)) == -EBUSY)
+ (void *)fallback_cc, sizeof(fallback_cc)) == -EBUSY)
ebusy_cnt++;
/* Expecting -ENOTSUPP for tcp_cdg_res */
--
2.34.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH bpf-next v3 03/10] selftests/bpf: Prefer static linking for LLVM libraries
2024-09-05 8:13 [PATCH bpf-next v3 00/10] Local vmtest enhancement and RV64 enabled Pu Lehui
2024-09-05 8:13 ` [PATCH bpf-next v3 01/10] selftests/bpf: Adapt OUTPUT appending logic to lower versions of Make Pu Lehui
2024-09-05 8:13 ` [PATCH bpf-next v3 02/10] selftests/bpf: Rename fallback in bpf_dctcp to avoid naming conflict Pu Lehui
@ 2024-09-05 8:13 ` Pu Lehui
2024-09-05 15:29 ` Daniel Borkmann
2024-09-05 8:13 ` [PATCH bpf-next v3 04/10] selftests/bpf: Limit URLS parsing logic to actual scope in vmtest Pu Lehui
` (8 subsequent siblings)
11 siblings, 1 reply; 16+ messages in thread
From: Pu Lehui @ 2024-09-05 8:13 UTC (permalink / raw)
To: bpf, linux-riscv, netdev
Cc: Andrii Nakryiko, Eduard Zingerman, Mykola Lysenko,
Björn Töpel, Puranjay Mohan, Alexei Starovoitov,
Daniel Borkmann, Martin KaFai Lau, Song Liu, Yonghong Song,
John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
Palmer Dabbelt, Pu Lehui
From: Eduard Zingerman <eddyz87@gmail.com>
It is not always convenient to have LLVM libraries installed inside CI
rootfs images, thus request static libraries from llvm-config.
Suggested-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Eduard Zingerman <eddyz87@gmail.com>
---
tools/testing/selftests/bpf/Makefile | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index 9905e3739dd0..04716a5e43f1 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -202,11 +202,9 @@ ifeq ($(feature-llvm),1)
LLVM_CONFIG_LIB_COMPONENTS := mcdisassembler all-targets
# both llvm-config and lib.mk add -D_GNU_SOURCE, which ends up as conflict
LLVM_CFLAGS += $(filter-out -D_GNU_SOURCE,$(shell $(LLVM_CONFIG) --cflags))
- LLVM_LDLIBS += $(shell $(LLVM_CONFIG) --libs $(LLVM_CONFIG_LIB_COMPONENTS))
- ifeq ($(shell $(LLVM_CONFIG) --shared-mode),static)
- LLVM_LDLIBS += $(shell $(LLVM_CONFIG) --system-libs $(LLVM_CONFIG_LIB_COMPONENTS))
- LLVM_LDLIBS += -lstdc++
- endif
+ LLVM_LDLIBS += $(shell $(LLVM_CONFIG) --link-static --libs $(LLVM_CONFIG_LIB_COMPONENTS))
+ LLVM_LDLIBS += $(shell $(LLVM_CONFIG) --link-static --system-libs $(LLVM_CONFIG_LIB_COMPONENTS))
+ LLVM_LDLIBS += -lstdc++
LLVM_LDFLAGS += $(shell $(LLVM_CONFIG) --ldflags)
endif
--
2.34.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH bpf-next v3 04/10] selftests/bpf: Limit URLS parsing logic to actual scope in vmtest
2024-09-05 8:13 [PATCH bpf-next v3 00/10] Local vmtest enhancement and RV64 enabled Pu Lehui
` (2 preceding siblings ...)
2024-09-05 8:13 ` [PATCH bpf-next v3 03/10] selftests/bpf: Prefer static linking for LLVM libraries Pu Lehui
@ 2024-09-05 8:13 ` Pu Lehui
2024-09-05 8:13 ` [PATCH bpf-next v3 05/10] selftests/bpf: Support local rootfs image for vmtest Pu Lehui
` (7 subsequent siblings)
11 siblings, 0 replies; 16+ messages in thread
From: Pu Lehui @ 2024-09-05 8:13 UTC (permalink / raw)
To: bpf, linux-riscv, netdev
Cc: Andrii Nakryiko, Eduard Zingerman, Mykola Lysenko,
Björn Töpel, Puranjay Mohan, Alexei Starovoitov,
Daniel Borkmann, Martin KaFai Lau, Song Liu, Yonghong Song,
John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
Palmer Dabbelt, Pu Lehui
From: Pu Lehui <pulehui@huawei.com>
The URLS array is only valid in the download_rootfs function and does
not need to be parsed globally in advance. At the same time, the logic
of loading rootfs is refactored to prepare vmtest for supporting local
rootfs.
Signed-off-by: Pu Lehui <pulehui@huawei.com>
---
tools/testing/selftests/bpf/vmtest.sh | 39 +++++++++++++--------------
1 file changed, 19 insertions(+), 20 deletions(-)
diff --git a/tools/testing/selftests/bpf/vmtest.sh b/tools/testing/selftests/bpf/vmtest.sh
index 65d14f3bbe30..87d93f29c565 100755
--- a/tools/testing/selftests/bpf/vmtest.sh
+++ b/tools/testing/selftests/bpf/vmtest.sh
@@ -92,19 +92,6 @@ populate_url_map()
fi
}
-download()
-{
- local file="$1"
-
- if [[ ! -v URLS[$file] ]]; then
- echo "$file not found" >&2
- return 1
- fi
-
- echo "Downloading $file..." >&2
- curl -Lsf "${URLS[$file]}" "${@:2}"
-}
-
newest_rootfs_version()
{
{
@@ -118,16 +105,30 @@ newest_rootfs_version()
download_rootfs()
{
- local rootfsversion="$1"
- local dir="$2"
+ populate_url_map
+
+ local rootfsversion="$(newest_rootfs_version)"
+ local file="${ARCH}/libbpf-vmtest-rootfs-$rootfsversion.tar.zst"
+
+ if [[ ! -v URLS[$file] ]]; then
+ echo "$file not found" >&2
+ return 1
+ fi
+
+ echo "Downloading $file..." >&2
+ curl -Lsf "${URLS[$file]}" "${@:2}"
+}
+
+load_rootfs()
+{
+ local dir="$1"
if ! which zstd &> /dev/null; then
echo 'Could not find "zstd" on the system, please install zstd'
exit 1
fi
- download "${ARCH}/libbpf-vmtest-rootfs-$rootfsversion.tar.zst" |
- zstd -d | sudo tar -C "$dir" -x
+ download_rootfs | zstd -d | sudo tar -C "$dir" -x
}
recompile_kernel()
@@ -227,7 +228,7 @@ create_vm_image()
mkfs.ext4 -q "${rootfs_img}"
mount_image
- download_rootfs "$(newest_rootfs_version)" "${mount_dir}"
+ load_rootfs "${mount_dir}"
unmount_image
}
@@ -402,8 +403,6 @@ main()
make_command="${make_command} KBUILD_OUTPUT=${KBUILD_OUTPUT}"
fi
- populate_url_map
-
local rootfs_img="${OUTPUT_DIR}/${ROOTFS_IMAGE}"
local mount_dir="${OUTPUT_DIR}/${MOUNT_DIR}"
--
2.34.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH bpf-next v3 05/10] selftests/bpf: Support local rootfs image for vmtest
2024-09-05 8:13 [PATCH bpf-next v3 00/10] Local vmtest enhancement and RV64 enabled Pu Lehui
` (3 preceding siblings ...)
2024-09-05 8:13 ` [PATCH bpf-next v3 04/10] selftests/bpf: Limit URLS parsing logic to actual scope in vmtest Pu Lehui
@ 2024-09-05 8:13 ` Pu Lehui
2024-09-05 8:13 ` [PATCH bpf-next v3 06/10] selftests/bpf: Enable cross platform testing " Pu Lehui
` (6 subsequent siblings)
11 siblings, 0 replies; 16+ messages in thread
From: Pu Lehui @ 2024-09-05 8:13 UTC (permalink / raw)
To: bpf, linux-riscv, netdev
Cc: Andrii Nakryiko, Eduard Zingerman, Mykola Lysenko,
Björn Töpel, Puranjay Mohan, Alexei Starovoitov,
Daniel Borkmann, Martin KaFai Lau, Song Liu, Yonghong Song,
John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
Palmer Dabbelt, Pu Lehui
From: Pu Lehui <pulehui@huawei.com>
Support vmtest to use local rootfs image generated by [0] that is
consistent with BPF CI. Now we can specify the local rootfs image
through the `-l` parameter like as follows:
vmtest.sh -l ./libbpf-vmtest-rootfs-2024.08.22-noble-amd64.tar.zst -- ./test_progs
Meanwhile, some descriptions have been flushed.
Link: https://github.com/libbpf/ci/blob/main/rootfs/mkrootfs_debian.sh [0]
Acked-by: Eduard Zingerman <eddyz87@gmail.com>
Signed-off-by: Pu Lehui <pulehui@huawei.com>
---
tools/testing/selftests/bpf/README.rst | 2 --
tools/testing/selftests/bpf/vmtest.sh | 21 ++++++++++++++++-----
2 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/tools/testing/selftests/bpf/README.rst b/tools/testing/selftests/bpf/README.rst
index 9b974e425af3..4a1e74b17109 100644
--- a/tools/testing/selftests/bpf/README.rst
+++ b/tools/testing/selftests/bpf/README.rst
@@ -85,8 +85,6 @@ In case of linker errors when running selftests, try using static linking:
If you want to change pahole and llvm, you can change `PATH` environment
variable in the beginning of script.
-.. note:: The script currently only supports x86_64 and s390x architectures.
-
Additional information about selftest failures are
documented here.
diff --git a/tools/testing/selftests/bpf/vmtest.sh b/tools/testing/selftests/bpf/vmtest.sh
index 87d93f29c565..7bd2b44deb08 100755
--- a/tools/testing/selftests/bpf/vmtest.sh
+++ b/tools/testing/selftests/bpf/vmtest.sh
@@ -4,9 +4,11 @@
set -u
set -e
-# This script currently only works for x86_64 and s390x, as
-# it is based on the VM image used by the BPF CI, which is
-# available only for these architectures.
+# This script currently only works for the following platforms,
+# as it is based on the VM image used by the BPF CI, which is
+# available only for these architectures. We can also specify
+# the local rootfs image generated by the following script:
+# https://github.com/libbpf/ci/blob/main/rootfs/mkrootfs_debian.sh
ARCH="$(uname -m)"
case "${ARCH}" in
s390x)
@@ -34,6 +36,7 @@ aarch64)
esac
DEFAULT_COMMAND="./test_progs"
MOUNT_DIR="mnt"
+LOCAL_ROOTFS_IMAGE=""
ROOTFS_IMAGE="root.img"
OUTPUT_DIR="$HOME/.bpf_selftests"
KCONFIG_REL_PATHS=("tools/testing/selftests/bpf/config"
@@ -69,6 +72,7 @@ or
Options:
+ -l) Specify the path to the local rootfs image.
-i) Update the rootfs image with a newer version.
-d) Update the output directory (default: ${OUTPUT_DIR})
-j) Number of jobs for compilation, similar to -j in make
@@ -128,7 +132,11 @@ load_rootfs()
exit 1
fi
- download_rootfs | zstd -d | sudo tar -C "$dir" -x
+ if [[ -n "${LOCAL_ROOTFS_IMAGE}" ]]; then
+ cat "${LOCAL_ROOTFS_IMAGE}" | zstd -d | sudo tar -C "$dir" -x
+ else
+ download_rootfs | zstd -d | sudo tar -C "$dir" -x
+ fi
}
recompile_kernel()
@@ -342,8 +350,11 @@ main()
local exit_command="poweroff -f"
local debug_shell="no"
- while getopts ':hskid:j:' opt; do
+ while getopts ':hskl:id:j:' opt; do
case ${opt} in
+ l)
+ LOCAL_ROOTFS_IMAGE="$OPTARG"
+ ;;
i)
update_image="yes"
;;
--
2.34.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH bpf-next v3 06/10] selftests/bpf: Enable cross platform testing for vmtest
2024-09-05 8:13 [PATCH bpf-next v3 00/10] Local vmtest enhancement and RV64 enabled Pu Lehui
` (4 preceding siblings ...)
2024-09-05 8:13 ` [PATCH bpf-next v3 05/10] selftests/bpf: Support local rootfs image for vmtest Pu Lehui
@ 2024-09-05 8:13 ` Pu Lehui
2024-09-05 8:13 ` [PATCH bpf-next v3 07/10] selftests/bpf: Add config.riscv64 Pu Lehui
` (5 subsequent siblings)
11 siblings, 0 replies; 16+ messages in thread
From: Pu Lehui @ 2024-09-05 8:13 UTC (permalink / raw)
To: bpf, linux-riscv, netdev
Cc: Andrii Nakryiko, Eduard Zingerman, Mykola Lysenko,
Björn Töpel, Puranjay Mohan, Alexei Starovoitov,
Daniel Borkmann, Martin KaFai Lau, Song Liu, Yonghong Song,
John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
Palmer Dabbelt, Pu Lehui
From: Pu Lehui <pulehui@huawei.com>
Add support cross platform testing for vmtest. The variable $ARCH in the
current script is platform semantics, not kernel semantics. Rename it to
$PLATFORM so that we can easily use $ARCH in cross-compilation. And drop
`set -u` unbound variable check as we will use CROSS_COMPILE env
variable. For now, Using PLATFORM= and CROSS_COMPILE= options will
enable cross platform testing:
PLATFORM=<platform> CROSS_COMPILE=<toolchain> vmtest.sh -- ./test_progs
Tested-by: Eduard Zingerman <eddyz87@gmail.com>
Signed-off-by: Pu Lehui <pulehui@huawei.com>
---
tools/testing/selftests/bpf/vmtest.sh | 42 ++++++++++++++++++++-------
1 file changed, 31 insertions(+), 11 deletions(-)
diff --git a/tools/testing/selftests/bpf/vmtest.sh b/tools/testing/selftests/bpf/vmtest.sh
index 7bd2b44deb08..91f940e8ce45 100755
--- a/tools/testing/selftests/bpf/vmtest.sh
+++ b/tools/testing/selftests/bpf/vmtest.sh
@@ -1,7 +1,6 @@
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
-set -u
set -e
# This script currently only works for the following platforms,
@@ -9,25 +8,31 @@ set -e
# available only for these architectures. We can also specify
# the local rootfs image generated by the following script:
# https://github.com/libbpf/ci/blob/main/rootfs/mkrootfs_debian.sh
-ARCH="$(uname -m)"
-case "${ARCH}" in
+PLATFORM="${PLATFORM:-$(uname -m)}"
+case "${PLATFORM}" in
s390x)
QEMU_BINARY=qemu-system-s390x
QEMU_CONSOLE="ttyS1"
- QEMU_FLAGS=(-smp 2)
+ HOST_FLAGS=(-smp 2 -enable-kvm)
+ CROSS_FLAGS=(-smp 2)
BZIMAGE="arch/s390/boot/vmlinux"
+ ARCH="s390"
;;
x86_64)
QEMU_BINARY=qemu-system-x86_64
QEMU_CONSOLE="ttyS0,115200"
- QEMU_FLAGS=(-cpu host -smp 8)
+ HOST_FLAGS=(-cpu host -enable-kvm -smp 8)
+ CROSS_FLAGS=(-smp 8)
BZIMAGE="arch/x86/boot/bzImage"
+ ARCH="x86"
;;
aarch64)
QEMU_BINARY=qemu-system-aarch64
QEMU_CONSOLE="ttyAMA0,115200"
- QEMU_FLAGS=(-M virt,gic-version=3 -cpu host -smp 8)
+ HOST_FLAGS=(-M virt,gic-version=3 -cpu host -enable-kvm -smp 8)
+ CROSS_FLAGS=(-M virt,gic-version=3 -cpu cortex-a76 -smp 8)
BZIMAGE="arch/arm64/boot/Image"
+ ARCH="arm64"
;;
*)
echo "Unsupported architecture"
@@ -41,7 +46,7 @@ ROOTFS_IMAGE="root.img"
OUTPUT_DIR="$HOME/.bpf_selftests"
KCONFIG_REL_PATHS=("tools/testing/selftests/bpf/config"
"tools/testing/selftests/bpf/config.vm"
- "tools/testing/selftests/bpf/config.${ARCH}")
+ "tools/testing/selftests/bpf/config.${PLATFORM}")
INDEX_URL="https://raw.githubusercontent.com/libbpf/ci/master/INDEX"
NUM_COMPILE_JOBS="$(nproc)"
LOG_FILE_BASE="$(date +"bpf_selftests.%Y-%m-%d_%H-%M-%S")"
@@ -61,6 +66,10 @@ tools/testing/selftests/bpf. e.g:
If no command is specified and a debug shell (-s) is not requested,
"${DEFAULT_COMMAND}" will be run by default.
+Using PLATFORM= and CROSS_COMPILE= options will enable cross platform testing:
+
+ PLATFORM=<platform> CROSS_COMPILE=<toolchain> $0 -- ./test_progs -t test_lsm
+
If you build your kernel using KBUILD_OUTPUT= or O= options, these
can be passed as environment variables to the script:
@@ -100,7 +109,7 @@ newest_rootfs_version()
{
{
for file in "${!URLS[@]}"; do
- if [[ $file =~ ^"${ARCH}"/libbpf-vmtest-rootfs-(.*)\.tar\.zst$ ]]; then
+ if [[ $file =~ ^"${PLATFORM}"/libbpf-vmtest-rootfs-(.*)\.tar\.zst$ ]]; then
echo "${BASH_REMATCH[1]}"
fi
done
@@ -112,7 +121,7 @@ download_rootfs()
populate_url_map
local rootfsversion="$(newest_rootfs_version)"
- local file="${ARCH}/libbpf-vmtest-rootfs-$rootfsversion.tar.zst"
+ local file="${PLATFORM}/libbpf-vmtest-rootfs-$rootfsversion.tar.zst"
if [[ ! -v URLS[$file] ]]; then
echo "$file not found" >&2
@@ -253,12 +262,17 @@ EOF
exit 1
fi
+ if [[ "${PLATFORM}" != "$(uname -m)" ]]; then
+ QEMU_FLAGS=("${CROSS_FLAGS[@]}")
+ else
+ QEMU_FLAGS=("${HOST_FLAGS[@]}")
+ fi
+
${QEMU_BINARY} \
-nodefaults \
-display none \
-serial mon:stdio \
"${QEMU_FLAGS[@]}" \
- -enable-kvm \
-m 4G \
-drive file="${rootfs_img}",format=raw,index=1,media=disk,if=virtio,cache=none \
-kernel "${kernel_bzimage}" \
@@ -389,6 +403,11 @@ main()
trap 'catch "$?"' EXIT
+ if [[ "${PLATFORM}" != "$(uname -m)" ]] && [[ -z "${CROSS_COMPILE}" ]]; then
+ echo "Cross-platform testing needs to specify CROSS_COMPILE"
+ exit 1
+ fi
+
if [[ $# -eq 0 && "${debug_shell}" == "no" ]]; then
echo "No command specified, will run ${DEFAULT_COMMAND} in the vm"
else
@@ -396,7 +415,8 @@ main()
fi
local kconfig_file="${OUTPUT_DIR}/latest.config"
- local make_command="make -j ${NUM_COMPILE_JOBS} KCONFIG_CONFIG=${kconfig_file}"
+ local make_command="make ARCH=${ARCH} CROSS_COMPILE=${CROSS_COMPILE} \
+ -j ${NUM_COMPILE_JOBS} KCONFIG_CONFIG=${kconfig_file}"
# Figure out where the kernel is being built.
# O takes precedence over KBUILD_OUTPUT.
--
2.34.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH bpf-next v3 07/10] selftests/bpf: Add config.riscv64
2024-09-05 8:13 [PATCH bpf-next v3 00/10] Local vmtest enhancement and RV64 enabled Pu Lehui
` (5 preceding siblings ...)
2024-09-05 8:13 ` [PATCH bpf-next v3 06/10] selftests/bpf: Enable cross platform testing " Pu Lehui
@ 2024-09-05 8:13 ` Pu Lehui
2024-09-05 8:13 ` [PATCH bpf-next v3 08/10] selftests/bpf: Add DENYLIST.riscv64 Pu Lehui
` (4 subsequent siblings)
11 siblings, 0 replies; 16+ messages in thread
From: Pu Lehui @ 2024-09-05 8:13 UTC (permalink / raw)
To: bpf, linux-riscv, netdev
Cc: Andrii Nakryiko, Eduard Zingerman, Mykola Lysenko,
Björn Töpel, Puranjay Mohan, Alexei Starovoitov,
Daniel Borkmann, Martin KaFai Lau, Song Liu, Yonghong Song,
John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
Palmer Dabbelt, Pu Lehui
From: Pu Lehui <pulehui@huawei.com>
Add config.riscv64 for both BPF CI and local vmtest.
Tested-by: Eduard Zingerman <eddyz87@gmail.com>
Signed-off-by: Pu Lehui <pulehui@huawei.com>
---
tools/testing/selftests/bpf/config.riscv64 | 84 ++++++++++++++++++++++
1 file changed, 84 insertions(+)
create mode 100644 tools/testing/selftests/bpf/config.riscv64
diff --git a/tools/testing/selftests/bpf/config.riscv64 b/tools/testing/selftests/bpf/config.riscv64
new file mode 100644
index 000000000000..bb7043a80e1a
--- /dev/null
+++ b/tools/testing/selftests/bpf/config.riscv64
@@ -0,0 +1,84 @@
+CONFIG_AUDIT=y
+CONFIG_BLK_CGROUP=y
+CONFIG_BLK_DEV_INITRD=y
+CONFIG_BLK_DEV_RAM=y
+CONFIG_BONDING=y
+CONFIG_BPF_JIT_ALWAYS_ON=y
+CONFIG_BPF_PRELOAD=y
+CONFIG_BPF_PRELOAD_UMD=y
+CONFIG_CGROUPS=y
+CONFIG_CGROUP_CPUACCT=y
+CONFIG_CGROUP_DEVICE=y
+CONFIG_CGROUP_FREEZER=y
+CONFIG_CGROUP_HUGETLB=y
+CONFIG_CGROUP_NET_CLASSID=y
+CONFIG_CGROUP_PERF=y
+CONFIG_CGROUP_PIDS=y
+CONFIG_CGROUP_SCHED=y
+CONFIG_CPUSETS=y
+CONFIG_DEBUG_ATOMIC_SLEEP=y
+CONFIG_DEBUG_FS=y
+CONFIG_DETECT_HUNG_TASK=y
+CONFIG_DEVTMPFS=y
+CONFIG_DEVTMPFS_MOUNT=y
+CONFIG_EXPERT=y
+CONFIG_EXT4_FS=y
+CONFIG_EXT4_FS_POSIX_ACL=y
+CONFIG_EXT4_FS_SECURITY=y
+CONFIG_FRAME_POINTER=y
+CONFIG_HARDLOCKUP_DETECTOR=y
+CONFIG_HIGH_RES_TIMERS=y
+CONFIG_HUGETLBFS=y
+CONFIG_INET=y
+CONFIG_IPV6_SEG6_LWTUNNEL=y
+CONFIG_IP_ADVANCED_ROUTER=y
+CONFIG_IP_MULTICAST=y
+CONFIG_IP_MULTIPLE_TABLES=y
+CONFIG_JUMP_LABEL=y
+CONFIG_KALLSYMS_ALL=y
+CONFIG_KPROBES=y
+CONFIG_MEMCG=y
+CONFIG_NAMESPACES=y
+CONFIG_NET=y
+CONFIG_NETDEVICES=y
+CONFIG_NETFILTER_XT_MATCH_BPF=y
+CONFIG_NET_ACT_BPF=y
+CONFIG_NET_L3_MASTER_DEV=y
+CONFIG_NET_VRF=y
+CONFIG_NONPORTABLE=y
+CONFIG_NO_HZ_IDLE=y
+CONFIG_NR_CPUS=256
+CONFIG_PACKET=y
+CONFIG_PANIC_ON_OOPS=y
+CONFIG_PARTITION_ADVANCED=y
+CONFIG_PCI=y
+CONFIG_PCI_HOST_GENERIC=y
+CONFIG_POSIX_MQUEUE=y
+CONFIG_PRINTK_TIME=y
+CONFIG_PROC_KCORE=y
+CONFIG_PROFILING=y
+CONFIG_RCU_CPU_STALL_TIMEOUT=60
+CONFIG_RISCV_EFFICIENT_UNALIGNED_ACCESS=y
+CONFIG_RISCV_ISA_C=y
+CONFIG_RISCV_PMU=y
+CONFIG_RISCV_PMU_SBI=y
+CONFIG_RT_GROUP_SCHED=y
+CONFIG_SECURITY_NETWORK=y
+CONFIG_SERIAL_8250=y
+CONFIG_SERIAL_8250_CONSOLE=y
+CONFIG_SERIAL_OF_PLATFORM=y
+CONFIG_SMP=y
+CONFIG_SOC_VIRT=y
+CONFIG_SYSVIPC=y
+CONFIG_TCP_CONG_ADVANCED=y
+CONFIG_TLS=y
+CONFIG_TMPFS=y
+CONFIG_TMPFS_POSIX_ACL=y
+CONFIG_TUN=y
+CONFIG_UNIX=y
+CONFIG_UPROBES=y
+CONFIG_USER_NS=y
+CONFIG_VETH=y
+CONFIG_VLAN_8021Q=y
+CONFIG_VSOCKETS_LOOPBACK=y
+CONFIG_XFRM_USER=y
--
2.34.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH bpf-next v3 08/10] selftests/bpf: Add DENYLIST.riscv64
2024-09-05 8:13 [PATCH bpf-next v3 00/10] Local vmtest enhancement and RV64 enabled Pu Lehui
` (6 preceding siblings ...)
2024-09-05 8:13 ` [PATCH bpf-next v3 07/10] selftests/bpf: Add config.riscv64 Pu Lehui
@ 2024-09-05 8:13 ` Pu Lehui
2024-09-05 8:14 ` [PATCH bpf-next v3 09/10] selftests/bpf: Add riscv64 configurations to local vmtest Pu Lehui
` (3 subsequent siblings)
11 siblings, 0 replies; 16+ messages in thread
From: Pu Lehui @ 2024-09-05 8:13 UTC (permalink / raw)
To: bpf, linux-riscv, netdev
Cc: Andrii Nakryiko, Eduard Zingerman, Mykola Lysenko,
Björn Töpel, Puranjay Mohan, Alexei Starovoitov,
Daniel Borkmann, Martin KaFai Lau, Song Liu, Yonghong Song,
John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
Palmer Dabbelt, Pu Lehui
From: Pu Lehui <pulehui@huawei.com>
This patch adds DENYLIST.riscv64 file for riscv64. It will help BPF CI
and local vmtest to mask failing and unsupported test cases.
We can use the following command to use deny list in local vmtest as
previously mentioned by Manu.
PLATFORM=riscv64 CROSS_COMPILE=riscv64-linux-gnu- vmtest.sh \
-l ./libbpf-vmtest-rootfs-2024.08.30-noble-riscv64.tar.zst -- \
./test_progs -d \
\"$(cat tools/testing/selftests/bpf/DENYLIST.riscv64 \
| cut -d'#' -f1 \
| sed -e 's/^[[:space:]]*//' \
-e 's/[[:space:]]*$//' \
| tr -s '\n' ','\
)\"
Tested-by: Eduard Zingerman <eddyz87@gmail.com>
Signed-off-by: Pu Lehui <pulehui@huawei.com>
---
tools/testing/selftests/bpf/DENYLIST.riscv64 | 3 +++
1 file changed, 3 insertions(+)
create mode 100644 tools/testing/selftests/bpf/DENYLIST.riscv64
diff --git a/tools/testing/selftests/bpf/DENYLIST.riscv64 b/tools/testing/selftests/bpf/DENYLIST.riscv64
new file mode 100644
index 000000000000..4fc4dfdde293
--- /dev/null
+++ b/tools/testing/selftests/bpf/DENYLIST.riscv64
@@ -0,0 +1,3 @@
+# riscv64 deny list for BPF CI and local vmtest
+exceptions # JIT does not support exceptions
+tailcalls/tailcall_bpf2bpf* # JIT does not support mixing bpf2bpf and tailcalls
--
2.34.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH bpf-next v3 09/10] selftests/bpf: Add riscv64 configurations to local vmtest
2024-09-05 8:13 [PATCH bpf-next v3 00/10] Local vmtest enhancement and RV64 enabled Pu Lehui
` (7 preceding siblings ...)
2024-09-05 8:13 ` [PATCH bpf-next v3 08/10] selftests/bpf: Add DENYLIST.riscv64 Pu Lehui
@ 2024-09-05 8:14 ` Pu Lehui
2024-09-05 8:14 ` [PATCH bpf-next v3 10/10] selftests/bpf: Add description for running vmtest on RV64 Pu Lehui
` (2 subsequent siblings)
11 siblings, 0 replies; 16+ messages in thread
From: Pu Lehui @ 2024-09-05 8:14 UTC (permalink / raw)
To: bpf, linux-riscv, netdev
Cc: Andrii Nakryiko, Eduard Zingerman, Mykola Lysenko,
Björn Töpel, Puranjay Mohan, Alexei Starovoitov,
Daniel Borkmann, Martin KaFai Lau, Song Liu, Yonghong Song,
John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
Palmer Dabbelt, Pu Lehui
From: Pu Lehui <pulehui@huawei.com>
Add riscv64 configurations to local vmtest.
We can now perform cross platform testing for riscv64 bpf using the
following command:
PLATFORM=riscv64 CROSS_COMPILE=riscv64-linux-gnu- vmtest.sh \
-l ./libbpf-vmtest-rootfs-2024.08.30-noble-riscv64.tar.zst -- \
./test_progs -d \
\"$(cat tools/testing/selftests/bpf/DENYLIST.riscv64 \
| cut -d'#' -f1 \
| sed -e 's/^[[:space:]]*//' \
-e 's/[[:space:]]*$//' \
| tr -s '\n' ','\
)\"
Tested-by: Eduard Zingerman <eddyz87@gmail.com>
Signed-off-by: Pu Lehui <pulehui@huawei.com>
---
tools/testing/selftests/bpf/vmtest.sh | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/tools/testing/selftests/bpf/vmtest.sh b/tools/testing/selftests/bpf/vmtest.sh
index 91f940e8ce45..79505d294c44 100755
--- a/tools/testing/selftests/bpf/vmtest.sh
+++ b/tools/testing/selftests/bpf/vmtest.sh
@@ -34,6 +34,15 @@ aarch64)
BZIMAGE="arch/arm64/boot/Image"
ARCH="arm64"
;;
+riscv64)
+ # required qemu version v7.2.0+
+ QEMU_BINARY=qemu-system-riscv64
+ QEMU_CONSOLE="ttyS0,115200"
+ HOST_FLAGS=(-M virt -cpu host -enable-kvm -smp 8)
+ CROSS_FLAGS=(-M virt -cpu rv64,sscofpmf=true -smp 8)
+ BZIMAGE="arch/riscv/boot/Image"
+ ARCH="riscv"
+ ;;
*)
echo "Unsupported architecture"
exit 1
--
2.34.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH bpf-next v3 10/10] selftests/bpf: Add description for running vmtest on RV64
2024-09-05 8:13 [PATCH bpf-next v3 00/10] Local vmtest enhancement and RV64 enabled Pu Lehui
` (8 preceding siblings ...)
2024-09-05 8:14 ` [PATCH bpf-next v3 09/10] selftests/bpf: Add riscv64 configurations to local vmtest Pu Lehui
@ 2024-09-05 8:14 ` Pu Lehui
2024-09-05 18:52 ` [PATCH bpf-next v3 00/10] Local vmtest enhancement and RV64 enabled Daniel Borkmann
2024-09-05 20:20 ` [PATCH bpf-next v3 00/10] Local vmtest enhancement and RV64 enabled patchwork-bot+netdevbpf
11 siblings, 0 replies; 16+ messages in thread
From: Pu Lehui @ 2024-09-05 8:14 UTC (permalink / raw)
To: bpf, linux-riscv, netdev
Cc: Andrii Nakryiko, Eduard Zingerman, Mykola Lysenko,
Björn Töpel, Puranjay Mohan, Alexei Starovoitov,
Daniel Borkmann, Martin KaFai Lau, Song Liu, Yonghong Song,
John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
Palmer Dabbelt, Pu Lehui
From: Pu Lehui <pulehui@huawei.com>
Add description in tools/testing/selftests/bpf/README.rst
for running vmtest on RV64.
Signed-off-by: Pu Lehui <pulehui@huawei.com>
---
tools/testing/selftests/bpf/README.rst | 32 ++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/tools/testing/selftests/bpf/README.rst b/tools/testing/selftests/bpf/README.rst
index 4a1e74b17109..776fbe3cb8f9 100644
--- a/tools/testing/selftests/bpf/README.rst
+++ b/tools/testing/selftests/bpf/README.rst
@@ -85,6 +85,38 @@ In case of linker errors when running selftests, try using static linking:
If you want to change pahole and llvm, you can change `PATH` environment
variable in the beginning of script.
+Running vmtest on RV64
+======================
+To speed up testing and avoid various dependency issues, it is recommended to
+run vmtest in a Docker container. Before running vmtest, we need to prepare
+Docker container and local rootfs image. The overall steps are as follows:
+
+1. Create Docker container as shown in link [0].
+
+2. Use mkrootfs_debian.sh script [1] to build local rootfs image:
+
+.. code-block:: console
+
+ $ sudo ./mkrootfs_debian.sh --arch riscv64 --distro noble
+
+3. Start Docker container [0] and run vmtest in the container:
+
+.. code-block:: console
+
+ $ 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' ',' \
+ )\"
+
+Link: https://github.com/pulehui/riscv-bpf-vmtest.git [0]
+Link: https://github.com/libbpf/ci/blob/main/rootfs/mkrootfs_debian.sh [1]
+
Additional information about selftest failures are
documented here.
--
2.34.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH bpf-next v3 03/10] selftests/bpf: Prefer static linking for LLVM libraries
2024-09-05 8:13 ` [PATCH bpf-next v3 03/10] selftests/bpf: Prefer static linking for LLVM libraries Pu Lehui
@ 2024-09-05 15:29 ` Daniel Borkmann
0 siblings, 0 replies; 16+ messages in thread
From: Daniel Borkmann @ 2024-09-05 15:29 UTC (permalink / raw)
To: Pu Lehui, bpf, linux-riscv, netdev
Cc: Andrii Nakryiko, Eduard Zingerman, Mykola Lysenko,
Björn Töpel, Puranjay Mohan, Alexei Starovoitov,
Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa, Palmer Dabbelt,
Pu Lehui
On 9/5/24 10:13 AM, Pu Lehui wrote:
> From: Eduard Zingerman <eddyz87@gmail.com>
>
> It is not always convenient to have LLVM libraries installed inside CI
> rootfs images, thus request static libraries from llvm-config.
>
> Suggested-by: Andrii Nakryiko <andrii@kernel.org>
> Signed-off-by: Eduard Zingerman <eddyz87@gmail.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Tested-by: Daniel Borkmann <daniel@iogearbox.net>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH bpf-next v3 00/10] Local vmtest enhancement and RV64 enabled
2024-09-05 8:13 [PATCH bpf-next v3 00/10] Local vmtest enhancement and RV64 enabled Pu Lehui
` (9 preceding siblings ...)
2024-09-05 8:14 ` [PATCH bpf-next v3 10/10] selftests/bpf: Add description for running vmtest on RV64 Pu Lehui
@ 2024-09-05 18:52 ` Daniel Borkmann
2024-09-06 3:56 ` [PATCH bpf-next v3 00/10] Local vmtest enhancement and RV64 enabled😁 Pu Lehui
2024-09-05 20:20 ` [PATCH bpf-next v3 00/10] Local vmtest enhancement and RV64 enabled patchwork-bot+netdevbpf
11 siblings, 1 reply; 16+ messages in thread
From: Daniel Borkmann @ 2024-09-05 18:52 UTC (permalink / raw)
To: Pu Lehui, bpf, linux-riscv, netdev
Cc: Andrii Nakryiko, Eduard Zingerman, Mykola Lysenko,
Björn Töpel, Puranjay Mohan, Alexei Starovoitov,
Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa, Palmer Dabbelt,
Pu Lehui
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
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH bpf-next v3 00/10] Local vmtest enhancement and RV64 enabled
2024-09-05 8:13 [PATCH bpf-next v3 00/10] Local vmtest enhancement and RV64 enabled Pu Lehui
` (10 preceding siblings ...)
2024-09-05 18:52 ` [PATCH bpf-next v3 00/10] Local vmtest enhancement and RV64 enabled Daniel Borkmann
@ 2024-09-05 20:20 ` patchwork-bot+netdevbpf
11 siblings, 0 replies; 16+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-09-05 20:20 UTC (permalink / raw)
To: Pu Lehui
Cc: bpf, linux-riscv, netdev, andrii, eddyz87, mykolal, bjorn,
puranjay, ast, daniel, martin.lau, song, yonghong.song,
john.fastabend, kpsingh, sdf, haoluo, jolsa, palmer, pulehui
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!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH bpf-next v3 00/10] Local vmtest enhancement and RV64 enabled😁
2024-09-05 18:52 ` [PATCH bpf-next v3 00/10] Local vmtest enhancement and RV64 enabled Daniel Borkmann
@ 2024-09-06 3:56 ` Pu Lehui
2024-09-06 14:08 ` Björn Töpel
0 siblings, 1 reply; 16+ messages in thread
From: Pu Lehui @ 2024-09-06 3:56 UTC (permalink / raw)
To: Daniel Borkmann, Björn Töpel, bpf, linux-riscv, netdev
Cc: Andrii Nakryiko, Eduard Zingerman, Mykola Lysenko, Puranjay Mohan,
Alexei Starovoitov, Martin KaFai Lau, Song Liu, Yonghong Song,
John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
Palmer Dabbelt, Pu Lehui
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😁
Yeah, that's what we're most looking forward to and we've been trying to
move forward with that. There are currently several options, but they
are not very suitable yet.
1. Cross-platform testing with subset of tests (test_verifier +
test_progs), it will cost a bit more time.
x86_64 host:
Summary: 536/3594 PASSED, 68 SKIPPED, 0 FAILED
real 30m 18.88s
user 6m 52.97s
sys 21m 3.03s
2. Cross-platform testing will parallel mode, it will meet flaky
problems while the time consume looks good.
x86_64 host:
real 7m 45.42s
user 6m 13.59s
sys 15m 41.12s
3. Real board testing, which relies on Hypervisor Extension to enable
kvm on qemu. We are still trying to find a suitable board.
I believe we will be able to see the RV64 on the BPF CI soon.😄
>
> 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
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH bpf-next v3 00/10] Local vmtest enhancement and RV64 enabled😁
2024-09-06 3:56 ` [PATCH bpf-next v3 00/10] Local vmtest enhancement and RV64 enabled😁 Pu Lehui
@ 2024-09-06 14:08 ` Björn Töpel
0 siblings, 0 replies; 16+ messages in thread
From: Björn Töpel @ 2024-09-06 14:08 UTC (permalink / raw)
To: Pu Lehui, Daniel Borkmann, bpf, linux-riscv, netdev
Cc: Andrii Nakryiko, Eduard Zingerman, Mykola Lysenko, Puranjay Mohan,
Alexei Starovoitov, Martin KaFai Lau, Song Liu, Yonghong Song,
John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
Palmer Dabbelt, Pu Lehui
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😁
Indeed, very nice work! Every year is "The year of RISC-V BPF CI
integration". :-P
> Yeah, that's what we're most looking forward to and we've been trying to
> move forward with that. There are currently several options, but they
> are not very suitable yet.
>
> 1. Cross-platform testing with subset of tests (test_verifier +
> test_progs), it will cost a bit more time.
>
> x86_64 host:
> Summary: 536/3594 PASSED, 68 SKIPPED, 0 FAILED
> real 30m 18.88s
> user 6m 52.97s
> sys 21m 3.03s
>
> 2. Cross-platform testing will parallel mode, it will meet flaky
> problems while the time consume looks good.
>
> x86_64 host:
> real 7m 45.42s
> user 6m 13.59s
> sys 15m 41.12s
>
> 3. Real board testing, which relies on Hypervisor Extension to enable
> kvm on qemu. We are still trying to find a suitable board.
There's a board coming out soonish with H -- let's hope it doesn't suck!
;-)
I have a CI running, that's runs all the BPF tests (and the rest of
kselftest) on various trees/branches, and it takes *hours* on QEMU TCG
[1] (the GH CI doesn't report fail/ok in the UI, so you need to download
the logs [2] -- filename *kselftest-bpf*).
Obviously this is a no-go for pre-commit/patchwork CI, but for, say,
a longer release test (post-commit), spending a couple of hours on a
test would probably be OK.
If there's a post-commit CI running somewhere, maybe we could plug in
RISC-V BPF QEMU TCG tests there? ...and then when we get proper H
machines, we can add RISC-V to Meta's PW CI as well.
Daniel, is there a "release test CI" running, or is that mostly manual
work?
Björn
[1] https://github.com/linux-riscv/linux-riscv/actions/runs/10725237865/job/29742632222#step:5:30
[2] https://github.com/linux-riscv/linux-riscv/actions/runs/10725237865/artifacts/1899421897
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2024-09-06 14:08 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-05 8:13 [PATCH bpf-next v3 00/10] Local vmtest enhancement and RV64 enabled Pu Lehui
2024-09-05 8:13 ` [PATCH bpf-next v3 01/10] selftests/bpf: Adapt OUTPUT appending logic to lower versions of Make Pu Lehui
2024-09-05 8:13 ` [PATCH bpf-next v3 02/10] selftests/bpf: Rename fallback in bpf_dctcp to avoid naming conflict Pu Lehui
2024-09-05 8:13 ` [PATCH bpf-next v3 03/10] selftests/bpf: Prefer static linking for LLVM libraries Pu Lehui
2024-09-05 15:29 ` Daniel Borkmann
2024-09-05 8:13 ` [PATCH bpf-next v3 04/10] selftests/bpf: Limit URLS parsing logic to actual scope in vmtest Pu Lehui
2024-09-05 8:13 ` [PATCH bpf-next v3 05/10] selftests/bpf: Support local rootfs image for vmtest Pu Lehui
2024-09-05 8:13 ` [PATCH bpf-next v3 06/10] selftests/bpf: Enable cross platform testing " Pu Lehui
2024-09-05 8:13 ` [PATCH bpf-next v3 07/10] selftests/bpf: Add config.riscv64 Pu Lehui
2024-09-05 8:13 ` [PATCH bpf-next v3 08/10] selftests/bpf: Add DENYLIST.riscv64 Pu Lehui
2024-09-05 8:14 ` [PATCH bpf-next v3 09/10] selftests/bpf: Add riscv64 configurations to local vmtest Pu Lehui
2024-09-05 8:14 ` [PATCH bpf-next v3 10/10] selftests/bpf: Add description for running vmtest on RV64 Pu Lehui
2024-09-05 18:52 ` [PATCH bpf-next v3 00/10] Local vmtest enhancement and RV64 enabled Daniel Borkmann
2024-09-06 3:56 ` [PATCH bpf-next v3 00/10] Local vmtest enhancement and RV64 enabled😁 Pu Lehui
2024-09-06 14:08 ` Björn Töpel
2024-09-05 20:20 ` [PATCH bpf-next v3 00/10] Local vmtest enhancement and RV64 enabled patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).