* [PATCH bpf-next v2 00/10] Local vmtest enhancement and RV64 enabled
@ 2024-09-04 14:19 Pu Lehui
2024-09-04 14:19 ` [PATCH bpf-next v2 01/10] selftests/bpf: Adapt OUTPUT appending logic to lower versions of Make Pu Lehui
` (9 more replies)
0 siblings, 10 replies; 17+ messages in thread
From: Pu Lehui @ 2024-09-04 14:19 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] [1]. And since the work of riscv
ftrace to remove stop_machine atomic replacement is in progress, we also
need to revert commit [2] [3].
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 [4])
Link: https://lore.kernel.org/all/20240831071520.1630360-1-pulehui@huaweicloud.com/ [0]
Link: https://lore.kernel.org/all/20240831041934.1629216-1-pulehui@huaweicloud.com/ [1]
Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=3308172276db [2]
Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=7caa9765465f [3]
Link: https://github.com/libbpf/ci/blob/main/rootfs/mkrootfs_debian.sh [4]
v2:
- 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/
Pu Lehui (10):
selftests/bpf: Adapt OUTPUT appending logic to lower versions of Make
selftests/bpf: Rename fallback in bpf_dctcp to avoid naming conflict
selftests/bpf: Disable feature-llvm for vmtest
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 | 8 ++
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 | 109 ++++++++++++------
7 files changed, 205 insertions(+), 41 deletions(-)
create mode 100644 tools/testing/selftests/bpf/DENYLIST.riscv64
create mode 100644 tools/testing/selftests/bpf/config.riscv64
--
2.34.1
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH bpf-next v2 01/10] selftests/bpf: Adapt OUTPUT appending logic to lower versions of Make
2024-09-04 14:19 [PATCH bpf-next v2 00/10] Local vmtest enhancement and RV64 enabled Pu Lehui
@ 2024-09-04 14:19 ` Pu Lehui
2024-09-04 18:49 ` Andrii Nakryiko
2024-09-04 14:19 ` [PATCH bpf-next v2 02/10] selftests/bpf: Rename fallback in bpf_dctcp to avoid naming conflict Pu Lehui
` (8 subsequent siblings)
9 siblings, 1 reply; 17+ messages in thread
From: Pu Lehui @ 2024-09-04 14:19 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]
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
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH bpf-next v2 02/10] selftests/bpf: Rename fallback in bpf_dctcp to avoid naming conflict
2024-09-04 14:19 [PATCH bpf-next v2 00/10] Local vmtest enhancement and RV64 enabled Pu Lehui
2024-09-04 14:19 ` [PATCH bpf-next v2 01/10] selftests/bpf: Adapt OUTPUT appending logic to lower versions of Make Pu Lehui
@ 2024-09-04 14:19 ` Pu Lehui
2024-09-04 14:19 ` [PATCH bpf-next v2 03/10] selftests/bpf: Disable feature-llvm for vmtest Pu Lehui
` (7 subsequent siblings)
9 siblings, 0 replies; 17+ messages in thread
From: Pu Lehui @ 2024-09-04 14:19 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
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH bpf-next v2 03/10] selftests/bpf: Disable feature-llvm for vmtest
2024-09-04 14:19 [PATCH bpf-next v2 00/10] Local vmtest enhancement and RV64 enabled Pu Lehui
2024-09-04 14:19 ` [PATCH bpf-next v2 01/10] selftests/bpf: Adapt OUTPUT appending logic to lower versions of Make Pu Lehui
2024-09-04 14:19 ` [PATCH bpf-next v2 02/10] selftests/bpf: Rename fallback in bpf_dctcp to avoid naming conflict Pu Lehui
@ 2024-09-04 14:19 ` Pu Lehui
2024-09-04 19:37 ` Eduard Zingerman
2024-09-04 14:19 ` [PATCH bpf-next v2 04/10] selftests/bpf: Limit URLS parsing logic to actual scope in vmtest Pu Lehui
` (6 subsequent siblings)
9 siblings, 1 reply; 17+ messages in thread
From: Pu Lehui @ 2024-09-04 14:19 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>
After commit b991fc520700 ("selftests/bpf: utility function to get
program disassembly after jit"), Makefile will link libLLVM* related
libraries to the user binary execution file when detecting that
feature-llvm is enabled, which will cause the local vmtest to appear as
follows mistake:
./test_progs: error while loading shared libraries: libLLVM-17.so.1:
cannot open shared object file: No such file or directory
Considering that the get_jited_program_text() function is a useful tool
for user debugging and will not be relied upon by the entire bpf
selftests, let's turn it off in local vmtest.
Signed-off-by: Pu Lehui <pulehui@huawei.com>
---
tools/testing/selftests/bpf/Makefile | 2 ++
tools/testing/selftests/bpf/vmtest.sh | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index 9905e3739dd0..47aa4f113fed 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -197,6 +197,7 @@ OUTPUT := $(patsubst %/,%,$(OUTPUT))
endif
endif
+ifneq ($(FORCE_FEAT_LLVM_OFF),1)
ifeq ($(feature-llvm),1)
LLVM_CFLAGS += -DHAVE_LLVM_SUPPORT
LLVM_CONFIG_LIB_COMPONENTS := mcdisassembler all-targets
@@ -209,6 +210,7 @@ ifeq ($(feature-llvm),1)
endif
LLVM_LDFLAGS += $(shell $(LLVM_CONFIG) --ldflags)
endif
+endif
SCRATCH_DIR := $(OUTPUT)/tools
BUILD_DIR := $(SCRATCH_DIR)/build
diff --git a/tools/testing/selftests/bpf/vmtest.sh b/tools/testing/selftests/bpf/vmtest.sh
index 65d14f3bbe30..ae2e5a5ca279 100755
--- a/tools/testing/selftests/bpf/vmtest.sh
+++ b/tools/testing/selftests/bpf/vmtest.sh
@@ -162,7 +162,7 @@ update_selftests()
local selftests_dir="${kernel_checkout}/tools/testing/selftests/bpf"
cd "${selftests_dir}"
- ${make_command}
+ FORCE_FEAT_LLVM_OFF=1 ${make_command}
# Mount the image and copy the selftests to the image.
mount_image
--
2.34.1
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH bpf-next v2 04/10] selftests/bpf: Limit URLS parsing logic to actual scope in vmtest
2024-09-04 14:19 [PATCH bpf-next v2 00/10] Local vmtest enhancement and RV64 enabled Pu Lehui
` (2 preceding siblings ...)
2024-09-04 14:19 ` [PATCH bpf-next v2 03/10] selftests/bpf: Disable feature-llvm for vmtest Pu Lehui
@ 2024-09-04 14:19 ` Pu Lehui
2024-09-04 14:19 ` [PATCH bpf-next v2 05/10] selftests/bpf: Support local rootfs image for vmtest Pu Lehui
` (5 subsequent siblings)
9 siblings, 0 replies; 17+ messages in thread
From: Pu Lehui @ 2024-09-04 14:19 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 ae2e5a5ca279..7d99d502691c 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
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH bpf-next v2 05/10] selftests/bpf: Support local rootfs image for vmtest
2024-09-04 14:19 [PATCH bpf-next v2 00/10] Local vmtest enhancement and RV64 enabled Pu Lehui
` (3 preceding siblings ...)
2024-09-04 14:19 ` [PATCH bpf-next v2 04/10] selftests/bpf: Limit URLS parsing logic to actual scope in vmtest Pu Lehui
@ 2024-09-04 14:19 ` Pu Lehui
2024-09-04 21:40 ` Eduard Zingerman
2024-09-04 14:19 ` [PATCH bpf-next v2 06/10] selftests/bpf: Enable cross platform testing " Pu Lehui
` (4 subsequent siblings)
9 siblings, 1 reply; 17+ messages in thread
From: Pu Lehui @ 2024-09-04 14:19 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]
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 7d99d502691c..370131c7c309 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
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH bpf-next v2 06/10] selftests/bpf: Enable cross platform testing for vmtest
2024-09-04 14:19 [PATCH bpf-next v2 00/10] Local vmtest enhancement and RV64 enabled Pu Lehui
` (4 preceding siblings ...)
2024-09-04 14:19 ` [PATCH bpf-next v2 05/10] selftests/bpf: Support local rootfs image for vmtest Pu Lehui
@ 2024-09-04 14:19 ` Pu Lehui
2024-09-04 14:19 ` [PATCH bpf-next v2 07/10] selftests/bpf: Add config.riscv64 Pu Lehui
` (3 subsequent siblings)
9 siblings, 0 replies; 17+ messages in thread
From: Pu Lehui @ 2024-09-04 14:19 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 370131c7c309..3f8cd7ff891c 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
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH bpf-next v2 07/10] selftests/bpf: Add config.riscv64
2024-09-04 14:19 [PATCH bpf-next v2 00/10] Local vmtest enhancement and RV64 enabled Pu Lehui
` (5 preceding siblings ...)
2024-09-04 14:19 ` [PATCH bpf-next v2 06/10] selftests/bpf: Enable cross platform testing " Pu Lehui
@ 2024-09-04 14:19 ` Pu Lehui
2024-09-04 14:19 ` [PATCH bpf-next v2 08/10] selftests/bpf: Add DENYLIST.riscv64 Pu Lehui
` (2 subsequent siblings)
9 siblings, 0 replies; 17+ messages in thread
From: Pu Lehui @ 2024-09-04 14:19 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
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH bpf-next v2 08/10] selftests/bpf: Add DENYLIST.riscv64
2024-09-04 14:19 [PATCH bpf-next v2 00/10] Local vmtest enhancement and RV64 enabled Pu Lehui
` (6 preceding siblings ...)
2024-09-04 14:19 ` [PATCH bpf-next v2 07/10] selftests/bpf: Add config.riscv64 Pu Lehui
@ 2024-09-04 14:19 ` Pu Lehui
2024-09-04 14:19 ` [PATCH bpf-next v2 09/10] selftests/bpf: Add riscv64 configurations to local vmtest Pu Lehui
2024-09-04 14:19 ` [PATCH bpf-next v2 10/10] selftests/bpf: Add description for running vmtest on RV64 Pu Lehui
9 siblings, 0 replies; 17+ messages in thread
From: Pu Lehui @ 2024-09-04 14:19 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
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH bpf-next v2 09/10] selftests/bpf: Add riscv64 configurations to local vmtest
2024-09-04 14:19 [PATCH bpf-next v2 00/10] Local vmtest enhancement and RV64 enabled Pu Lehui
` (7 preceding siblings ...)
2024-09-04 14:19 ` [PATCH bpf-next v2 08/10] selftests/bpf: Add DENYLIST.riscv64 Pu Lehui
@ 2024-09-04 14:19 ` Pu Lehui
2024-09-04 14:19 ` [PATCH bpf-next v2 10/10] selftests/bpf: Add description for running vmtest on RV64 Pu Lehui
9 siblings, 0 replies; 17+ messages in thread
From: Pu Lehui @ 2024-09-04 14:19 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 3f8cd7ff891c..8aa9a3030f30 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
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH bpf-next v2 10/10] selftests/bpf: Add description for running vmtest on RV64
2024-09-04 14:19 [PATCH bpf-next v2 00/10] Local vmtest enhancement and RV64 enabled Pu Lehui
` (8 preceding siblings ...)
2024-09-04 14:19 ` [PATCH bpf-next v2 09/10] selftests/bpf: Add riscv64 configurations to local vmtest Pu Lehui
@ 2024-09-04 14:19 ` Pu Lehui
9 siblings, 0 replies; 17+ messages in thread
From: Pu Lehui @ 2024-09-04 14:19 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
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH bpf-next v2 01/10] selftests/bpf: Adapt OUTPUT appending logic to lower versions of Make
2024-09-04 14:19 ` [PATCH bpf-next v2 01/10] selftests/bpf: Adapt OUTPUT appending logic to lower versions of Make Pu Lehui
@ 2024-09-04 18:49 ` Andrii Nakryiko
2024-09-04 19:29 ` Eduard Zingerman
0 siblings, 1 reply; 17+ messages in thread
From: Andrii Nakryiko @ 2024-09-04 18:49 UTC (permalink / raw)
To: Pu Lehui, Eduard Zingerman
Cc: bpf, linux-riscv, netdev, Andrii Nakryiko, 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
On Wed, Sep 4, 2024 at 7:17 AM Pu Lehui <pulehui@huaweicloud.com> wrote:
>
> From: Pu Lehui <pulehui@huawei.com>
>
> The $(let ...) function is only supported by GNU Make version 4.4 [0]
Eduard, seems like the mystery is finally solved.
We were actually considering removing the FEATURE-DUMP functionality
from BPF selftests, but it's good to have a fix nevertheless, thanks!
> 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]
> 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
>
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH bpf-next v2 01/10] selftests/bpf: Adapt OUTPUT appending logic to lower versions of Make
2024-09-04 18:49 ` Andrii Nakryiko
@ 2024-09-04 19:29 ` Eduard Zingerman
0 siblings, 0 replies; 17+ messages in thread
From: Eduard Zingerman @ 2024-09-04 19:29 UTC (permalink / raw)
To: Andrii Nakryiko, Pu Lehui
Cc: bpf, linux-riscv, netdev, Andrii Nakryiko, 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
On Wed, 2024-09-04 at 11:49 -0700, Andrii Nakryiko wrote:
> On Wed, Sep 4, 2024 at 7:17 AM Pu Lehui <pulehui@huaweicloud.com> wrote:
> >
> > From: Pu Lehui <pulehui@huawei.com>
> >
> > The $(let ...) function is only supported by GNU Make version 4.4 [0]
>
> Eduard, seems like the mystery is finally solved.
That this thing was silently ignored is most perplexing.
> We were actually considering removing the FEATURE-DUMP functionality
> from BPF selftests, but it's good to have a fix nevertheless, thanks!
Pu, thank you for figuring this out...
Acked-by: Eduard Zingerman <eddyz87@gmail.com>
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH bpf-next v2 03/10] selftests/bpf: Disable feature-llvm for vmtest
2024-09-04 14:19 ` [PATCH bpf-next v2 03/10] selftests/bpf: Disable feature-llvm for vmtest Pu Lehui
@ 2024-09-04 19:37 ` Eduard Zingerman
2024-09-04 23:08 ` Eduard Zingerman
0 siblings, 1 reply; 17+ messages in thread
From: Eduard Zingerman @ 2024-09-04 19:37 UTC (permalink / raw)
To: Pu Lehui, bpf, linux-riscv, netdev
Cc: Andrii Nakryiko, 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
On Wed, 2024-09-04 at 14:19 +0000, Pu Lehui wrote:
> From: Pu Lehui <pulehui@huawei.com>
>
> After commit b991fc520700 ("selftests/bpf: utility function to get
> program disassembly after jit"), Makefile will link libLLVM* related
> libraries to the user binary execution file when detecting that
> feature-llvm is enabled, which will cause the local vmtest to appear as
> follows mistake:
>
> ./test_progs: error while loading shared libraries: libLLVM-17.so.1:
> cannot open shared object file: No such file or directory
>
> Considering that the get_jited_program_text() function is a useful tool
> for user debugging and will not be relied upon by the entire bpf
> selftests, let's turn it off in local vmtest.
>
> Signed-off-by: Pu Lehui <pulehui@huawei.com>
> ---
I actually don't agree.
The __jited tag is supposed to be used by selftests
(granted, used by a single selftest for now).
Maybe add an option to forgo LLVM linkage when test_progs are compiled?
Regarding base image lacking libLLVM -- I need to fix this.
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH bpf-next v2 05/10] selftests/bpf: Support local rootfs image for vmtest
2024-09-04 14:19 ` [PATCH bpf-next v2 05/10] selftests/bpf: Support local rootfs image for vmtest Pu Lehui
@ 2024-09-04 21:40 ` Eduard Zingerman
0 siblings, 0 replies; 17+ messages in thread
From: Eduard Zingerman @ 2024-09-04 21:40 UTC (permalink / raw)
To: Pu Lehui, bpf, linux-riscv, netdev
Cc: Andrii Nakryiko, 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
On Wed, 2024-09-04 at 14:19 +0000, Pu Lehui wrote:
> 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]
> Signed-off-by: Pu Lehui <pulehui@huawei.com>
> ---
Acked-by: Eduard Zingerman <eddyz87@gmail.com>
[...]
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH bpf-next v2 03/10] selftests/bpf: Disable feature-llvm for vmtest
2024-09-04 19:37 ` Eduard Zingerman
@ 2024-09-04 23:08 ` Eduard Zingerman
2024-09-05 8:36 ` Pu Lehui
0 siblings, 1 reply; 17+ messages in thread
From: Eduard Zingerman @ 2024-09-04 23:08 UTC (permalink / raw)
To: Pu Lehui, bpf, linux-riscv, netdev
Cc: Andrii Nakryiko, 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
On Wed, 2024-09-04 at 12:37 -0700, Eduard Zingerman wrote:
> On Wed, 2024-09-04 at 14:19 +0000, Pu Lehui wrote:
> > From: Pu Lehui <pulehui@huawei.com>
> >
> > After commit b991fc520700 ("selftests/bpf: utility function to get
> > program disassembly after jit"), Makefile will link libLLVM* related
> > libraries to the user binary execution file when detecting that
> > feature-llvm is enabled, which will cause the local vmtest to appear as
> > follows mistake:
> >
> > ./test_progs: error while loading shared libraries: libLLVM-17.so.1:
> > cannot open shared object file: No such file or directory
> >
> > Considering that the get_jited_program_text() function is a useful tool
> > for user debugging and will not be relied upon by the entire bpf
> > selftests, let's turn it off in local vmtest.
> >
> > Signed-off-by: Pu Lehui <pulehui@huawei.com>
> > ---
>
> I actually don't agree.
> The __jited tag is supposed to be used by selftests
> (granted, used by a single selftest for now).
> Maybe add an option to forgo LLVM linkage when test_progs are compiled?
> Regarding base image lacking libLLVM -- I need to fix this.
>
Please consider using my commit [1] instead of this patch, it forces
static linking form LLVM libraries, thus avoiding issues with rootfs.
(This was suggested by Andrii off list).
[1] https://git.kernel.org/pub/scm/linux/kernel/git/ez/bpf-next.git/commit/?h=selftest-llvm-static-linking&id=263bacf2f20fbc17204fd912609e26bdf6ac5a13
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH bpf-next v2 03/10] selftests/bpf: Disable feature-llvm for vmtest
2024-09-04 23:08 ` Eduard Zingerman
@ 2024-09-05 8:36 ` Pu Lehui
0 siblings, 0 replies; 17+ messages in thread
From: Pu Lehui @ 2024-09-05 8:36 UTC (permalink / raw)
To: Eduard Zingerman, bpf, linux-riscv, netdev
Cc: Andrii Nakryiko, 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
On 2024/9/5 7:08, Eduard Zingerman wrote:
> On Wed, 2024-09-04 at 12:37 -0700, Eduard Zingerman wrote:
>> On Wed, 2024-09-04 at 14:19 +0000, Pu Lehui wrote:
>>> From: Pu Lehui <pulehui@huawei.com>
>>>
>>> After commit b991fc520700 ("selftests/bpf: utility function to get
>>> program disassembly after jit"), Makefile will link libLLVM* related
>>> libraries to the user binary execution file when detecting that
>>> feature-llvm is enabled, which will cause the local vmtest to appear as
>>> follows mistake:
>>>
>>> ./test_progs: error while loading shared libraries: libLLVM-17.so.1:
>>> cannot open shared object file: No such file or directory
>>>
>>> Considering that the get_jited_program_text() function is a useful tool
>>> for user debugging and will not be relied upon by the entire bpf
>>> selftests, let's turn it off in local vmtest.
>>>
>>> Signed-off-by: Pu Lehui <pulehui@huawei.com>
>>> ---
>>
>> I actually don't agree.
>> The __jited tag is supposed to be used by selftests
>> (granted, used by a single selftest for now).
>> Maybe add an option to forgo LLVM linkage when test_progs are compiled?
>> Regarding base image lacking libLLVM -- I need to fix this.
>>
>
> Please consider using my commit [1] instead of this patch, it forces
> static linking form LLVM libraries, thus avoiding issues with rootfs.
> (This was suggested by Andrii off list).
>
> [1] https://git.kernel.org/pub/scm/linux/kernel/git/ez/bpf-next.git/commit/?h=selftest-llvm-static-linking&id=263bacf2f20fbc17204fd912609e26bdf6ac5a13
Happy to see this modification only on llvm lib. I test it works good
and have picked this in next version. Thanks
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2024-09-05 8:36 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-04 14:19 [PATCH bpf-next v2 00/10] Local vmtest enhancement and RV64 enabled Pu Lehui
2024-09-04 14:19 ` [PATCH bpf-next v2 01/10] selftests/bpf: Adapt OUTPUT appending logic to lower versions of Make Pu Lehui
2024-09-04 18:49 ` Andrii Nakryiko
2024-09-04 19:29 ` Eduard Zingerman
2024-09-04 14:19 ` [PATCH bpf-next v2 02/10] selftests/bpf: Rename fallback in bpf_dctcp to avoid naming conflict Pu Lehui
2024-09-04 14:19 ` [PATCH bpf-next v2 03/10] selftests/bpf: Disable feature-llvm for vmtest Pu Lehui
2024-09-04 19:37 ` Eduard Zingerman
2024-09-04 23:08 ` Eduard Zingerman
2024-09-05 8:36 ` Pu Lehui
2024-09-04 14:19 ` [PATCH bpf-next v2 04/10] selftests/bpf: Limit URLS parsing logic to actual scope in vmtest Pu Lehui
2024-09-04 14:19 ` [PATCH bpf-next v2 05/10] selftests/bpf: Support local rootfs image for vmtest Pu Lehui
2024-09-04 21:40 ` Eduard Zingerman
2024-09-04 14:19 ` [PATCH bpf-next v2 06/10] selftests/bpf: Enable cross platform testing " Pu Lehui
2024-09-04 14:19 ` [PATCH bpf-next v2 07/10] selftests/bpf: Add config.riscv64 Pu Lehui
2024-09-04 14:19 ` [PATCH bpf-next v2 08/10] selftests/bpf: Add DENYLIST.riscv64 Pu Lehui
2024-09-04 14:19 ` [PATCH bpf-next v2 09/10] selftests/bpf: Add riscv64 configurations to local vmtest Pu Lehui
2024-09-04 14:19 ` [PATCH bpf-next v2 10/10] selftests/bpf: Add description for running vmtest on RV64 Pu Lehui
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox