* [PATCH virtme-docker 1/3] change watchdog to device
2024-01-28 6:16 [PATCH virtme-docker 0/3] bpf: add bpftests support Geliang Tang
@ 2024-01-28 6:16 ` Geliang Tang
2024-01-28 6:16 ` [PATCH virtme-docker 2/3] upgrade to ubuntu 23.10 Geliang Tang
2024-01-28 6:16 ` [PATCH virtme-docker 3/3] bpf: add bpftests support Geliang Tang
2 siblings, 0 replies; 7+ messages in thread
From: Geliang Tang @ 2024-01-28 6:16 UTC (permalink / raw)
To: mptcp; +Cc: Geliang Tang
This patch should be merged into virtme repo:
'''
architectures: use qemu -device option
Use qemu '-device' option instead of '-watchdog' to fix this error in
Ubuntu 23.04:
qemu-system-x86_64: -watchdog: invalid option
ret = Arch.qemuargs(is_native)
# Add a watchdog. This is useful for testing.
- ret.extend(['-watchdog', 'i6300esb'])
+ ret.extend(['-device', 'i6300esb'])
if is_native and os.access('/dev/kvm', os.R_OK):
# If we're likely to use KVM, request a full-featured CPU.
'''
Signed-off-by: Geliang Tang <geliang@kernel.org>
---
Dockerfile | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/Dockerfile b/Dockerfile
index bf7f733..cf8c692 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -35,7 +35,8 @@ ARG VIRTME_GIT_SHA="a680c0861cf6f9dc6a8a821e9e58ae43c5e68435"
RUN cd /opt && \
git clone "${VIRTME_GIT_URL}" && \
cd virtme && \
- git checkout "${VIRTME_GIT_SHA}"
+ git checkout "${VIRTME_GIT_SHA}" && \
+ sed -i 's/-watchdog/-device/g' virtme/architectures.py
# byobu (not to have a dep to iproute2)
ARG BYOBU_URL="https://launchpad.net/byobu/trunk/5.133/+download/byobu_5.133.orig.tar.gz"
--
2.40.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH virtme-docker 2/3] upgrade to ubuntu 23.10
2024-01-28 6:16 [PATCH virtme-docker 0/3] bpf: add bpftests support Geliang Tang
2024-01-28 6:16 ` [PATCH virtme-docker 1/3] change watchdog to device Geliang Tang
@ 2024-01-28 6:16 ` Geliang Tang
2024-01-30 0:50 ` Geliang Tang
2024-01-28 6:16 ` [PATCH virtme-docker 3/3] bpf: add bpftests support Geliang Tang
2 siblings, 1 reply; 7+ messages in thread
From: Geliang Tang @ 2024-01-28 6:16 UTC (permalink / raw)
To: mptcp; +Cc: Geliang Tang
There will be many build errors when comliling bpf selftests under
Ubuntu 22.04. Upgrade to 23.10 to use the new versions of gcc, clang
and LLVM.
Fix sparse build errors for llvm-16. This part alse be sent to sparse
upstream. It can be dropped from this patch when accepted.
Signed-off-by: Geliang Tang <geliang@kernel.org>
---
Dockerfile | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/Dockerfile b/Dockerfile
index cf8c692..cbc11f7 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,4 +1,4 @@
-FROM ubuntu:22.04
+FROM ubuntu:23.10
LABEL name=mptcp-upstream-virtme-docker
@@ -71,6 +71,10 @@ ARG SPARSE_GIT_SHA="ce1a6720f69e6233ec9abd4e9aae5945e05fda41" # include a fix fo
RUN cd /opt && \
git clone "${SPARSE_GIT_URL}" sparse && \
cd "sparse" && \
+ sed -i 's/LLVMConstGEP(/LLVMConstGEP2(type, /g' sparse-llvm.c && \
+ sed -i 's/LLVMBuildInBoundsGEP(builder/LLVMBuildInBoundsGEP2(builder, type/g' sparse-llvm.c && \
+ sed -i 's/LLVMBuildLoad(fn->builder/LLVMBuildLoad2(fn->builder, insn_symbol_type(insn)/g' sparse-llvm.c && \
+ sed -i 's/LLVMBuildCall(fn->builder/LLVMBuildCall2(fn->builder, insn_symbol_type(insn)/g' sparse-llvm.c && \
make -j"$(nproc)" -l"$(nproc)" && \
make PREFIX=/usr install && \
cd .. && \
--
2.40.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH virtme-docker 2/3] upgrade to ubuntu 23.10
2024-01-28 6:16 ` [PATCH virtme-docker 2/3] upgrade to ubuntu 23.10 Geliang Tang
@ 2024-01-30 0:50 ` Geliang Tang
2024-01-30 15:50 ` Matthieu Baerts
0 siblings, 1 reply; 7+ messages in thread
From: Geliang Tang @ 2024-01-30 0:50 UTC (permalink / raw)
To: mptcp
On Sun, Jan 28, 2024 at 02:16:02PM +0800, Geliang Tang wrote:
> There will be many build errors when comliling bpf selftests under
> Ubuntu 22.04. Upgrade to 23.10 to use the new versions of gcc, clang
> and LLVM.
>
> Fix sparse build errors for llvm-16. This part alse be sent to sparse
> upstream. It can be dropped from this patch when accepted.
This part has been upstreamed, we can drop it now from this patch.
>
> Signed-off-by: Geliang Tang <geliang@kernel.org>
> ---
> Dockerfile | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/Dockerfile b/Dockerfile
> index cf8c692..cbc11f7 100644
> --- a/Dockerfile
> +++ b/Dockerfile
> @@ -1,4 +1,4 @@
> -FROM ubuntu:22.04
> +FROM ubuntu:23.10
>
> LABEL name=mptcp-upstream-virtme-docker
>
> @@ -71,6 +71,10 @@ ARG SPARSE_GIT_SHA="ce1a6720f69e6233ec9abd4e9aae5945e05fda41" # include a fix fo
> RUN cd /opt && \
> git clone "${SPARSE_GIT_URL}" sparse && \
> cd "sparse" && \
> + sed -i 's/LLVMConstGEP(/LLVMConstGEP2(type, /g' sparse-llvm.c && \
> + sed -i 's/LLVMBuildInBoundsGEP(builder/LLVMBuildInBoundsGEP2(builder, type/g' sparse-llvm.c && \
> + sed -i 's/LLVMBuildLoad(fn->builder/LLVMBuildLoad2(fn->builder, insn_symbol_type(insn)/g' sparse-llvm.c && \
> + sed -i 's/LLVMBuildCall(fn->builder/LLVMBuildCall2(fn->builder, insn_symbol_type(insn)/g' sparse-llvm.c && \
> make -j"$(nproc)" -l"$(nproc)" && \
> make PREFIX=/usr install && \
> cd .. && \
> --
> 2.40.1
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH virtme-docker 2/3] upgrade to ubuntu 23.10
2024-01-30 0:50 ` Geliang Tang
@ 2024-01-30 15:50 ` Matthieu Baerts
2024-01-31 9:00 ` Geliang Tang
0 siblings, 1 reply; 7+ messages in thread
From: Matthieu Baerts @ 2024-01-30 15:50 UTC (permalink / raw)
To: Geliang Tang, mptcp
Hi Geliang,
On 30/01/2024 01:50, Geliang Tang wrote:
> On Sun, Jan 28, 2024 at 02:16:02PM +0800, Geliang Tang wrote:
>> There will be many build errors when comliling bpf selftests under
>> Ubuntu 22.04. Upgrade to 23.10 to use the new versions of gcc, clang
>> and LLVM.
>>
>> Fix sparse build errors for llvm-16. This part alse be sent to sparse
>> upstream. It can be dropped from this patch when accepted.
>
> This part has been upstreamed, we can drop it now from this patch.
Thank you for the patches and this note, I didn't see it has been fixed
upstream.
I didn't know you needed to upgrade to Ubuntu 23.10. I did something
similar for your two first patches last week when looking at the issue
471 [1] to switch to a more recent version of QEmu, but I didn't push my
changes. I hope you don't mind if I apply my modifications (with your
co-dev tag) where I use new versions of the dependences instead of
patching them.
I will look at the patch 3/3 (v2). I will need to modify it slightly I
think not to have the current CI failing. I can also look at modifying
the current CI job to validate this BPF test. I will probably need more
conditions to be able to run on older kernels as well. I will push that
after having done some tests, not to have regressions for the tests we
are currently validating.
[1] https://github.com/multipath-tcp/mptcp_net-next/issues/471
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH virtme-docker 2/3] upgrade to ubuntu 23.10
2024-01-30 15:50 ` Matthieu Baerts
@ 2024-01-31 9:00 ` Geliang Tang
0 siblings, 0 replies; 7+ messages in thread
From: Geliang Tang @ 2024-01-31 9:00 UTC (permalink / raw)
To: Matthieu Baerts; +Cc: mptcp
On Tue, Jan 30, 2024 at 04:50:46PM +0100, Matthieu Baerts wrote:
> Hi Geliang,
>
> On 30/01/2024 01:50, Geliang Tang wrote:
> > On Sun, Jan 28, 2024 at 02:16:02PM +0800, Geliang Tang wrote:
> >> There will be many build errors when comliling bpf selftests under
> >> Ubuntu 22.04. Upgrade to 23.10 to use the new versions of gcc, clang
> >> and LLVM.
> >>
> >> Fix sparse build errors for llvm-16. This part alse be sent to sparse
> >> upstream. It can be dropped from this patch when accepted.
> >
> > This part has been upstreamed, we can drop it now from this patch.
>
> Thank you for the patches and this note, I didn't see it has been fixed
> upstream.
It fixed in the commit 0544c547 ("llvm: fix LLVM 15 deprecation
warnings").
>
> I didn't know you needed to upgrade to Ubuntu 23.10. I did something
> similar for your two first patches last week when looking at the issue
> 471 [1] to switch to a more recent version of QEmu, but I didn't push my
> changes. I hope you don't mind if I apply my modifications (with your
> co-dev tag) where I use new versions of the dependences instead of
> patching them.
Sure, thanks.
-Geliang
>
> I will look at the patch 3/3 (v2). I will need to modify it slightly I
> think not to have the current CI failing. I can also look at modifying
> the current CI job to validate this BPF test. I will probably need more
> conditions to be able to run on older kernels as well. I will push that
> after having done some tests, not to have regressions for the tests we
> are currently validating.
>
> [1] https://github.com/multipath-tcp/mptcp_net-next/issues/471
>
> Cheers,
> Matt
> --
> Sponsored by the NGI0 Core fund.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH virtme-docker 3/3] bpf: add bpftests support
2024-01-28 6:16 [PATCH virtme-docker 0/3] bpf: add bpftests support Geliang Tang
2024-01-28 6:16 ` [PATCH virtme-docker 1/3] change watchdog to device Geliang Tang
2024-01-28 6:16 ` [PATCH virtme-docker 2/3] upgrade to ubuntu 23.10 Geliang Tang
@ 2024-01-28 6:16 ` Geliang Tang
2 siblings, 0 replies; 7+ messages in thread
From: Geliang Tang @ 2024-01-28 6:16 UTC (permalink / raw)
To: mptcp; +Cc: Geliang Tang
This patch builds bpf tests after building other mptcp selftests in bft
mode. And add run_bpftest_all to run bpftests.
Disable IA32_EMULATION config to fix this error:
./include/linux/if.h:28:10: fatal error: sys/socket.h: no such file or directory
Signed-off-by: Geliang Tang <geliang@kernel.org>
---
Dockerfile | 1 +
entrypoint.sh | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 56 insertions(+)
diff --git a/Dockerfile b/Dockerfile
index cbc11f7..77d7423 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -26,6 +26,7 @@ RUN apt-get update && \
wget xz-utils lftp cpio u-boot-tools \
cscope \
bpftrace \
+ python3-docutils \
&& \
apt-get clean
diff --git a/entrypoint.sh b/entrypoint.sh
index caddd5f..c334cf6 100755
--- a/entrypoint.sh
+++ b/entrypoint.sh
@@ -87,6 +87,8 @@ VIRTME_RUN_EXPECT="${VIRTME_SCRIPTS_DIR}/virtme.expect"
SELFTESTS_DIR="${INPUT_SELFTESTS_DIR:-tools/testing/selftests/net/mptcp}"
SELFTESTS_CONFIG="${SELFTESTS_DIR}/config"
+BPFTESTS_DIR="${INPUT_BPFTESTS_DIR:-tools/testing/selftests/bpf}"
+BPFTESTS_CONFIG="${BPFTESTS_DIR}/config"
export CCACHE_MAXSIZE="${INPUT_CCACHE_MAXSIZE}"
export CCACHE_DIR="${VIRTME_WORKDIR}/ccache"
@@ -349,6 +351,13 @@ gen_kconfig() { local mode kconfig=()
# Extra options are needed for kselftests
./scripts/kconfig/merge_config.sh -m "${VIRTME_KCONFIG}" "${SELFTESTS_CONFIG}"
+ if [ "${mode}" = "btf" ]; then
+ # Extra options are needed for bpftests
+ ./scripts/kconfig/merge_config.sh -m "${VIRTME_KCONFIG}" "${BPFTESTS_CONFIG}"
+ kconfig+=(-e DEBUG_INFO_BTF_MODULES -e MODULE_ALLOW_BTF_MISMATCH)
+ kconfig+=(-d IA32_EMULATION)
+ fi
+
./scripts/config --file "${VIRTME_KCONFIG}" "${kconfig[@]}"
_make_o olddefconfig
@@ -416,6 +425,21 @@ build_selftests() {
_make_o KHDR_INCLUDES="-I${VIRTME_BUILD_DIR}/include" -C "${SELFTESTS_DIR}"
}
+build_bpftests() {
+ if [ "${INPUT_BUILD_SKIP_BPFTESTS}" = 1 ]; then
+ printinfo "Skip bpftests build"
+ return 0
+ fi
+
+ rm -rf ${BPFTESTS_DIR}/{test_progs,bpf_testmod.ko,test_progs-no_alu32,no_alu32}
+
+ _make_o KHDR_INCLUDES="-I${VIRTME_BUILD_DIR}/include" -C "${BPFTESTS_DIR}"
+
+ ln -s ${VIRTME_BUILD_DIR}/{test_progs,bpf_testmod.ko,test_progs-no_alu32,no_alu32} ${BPFTESTS_DIR}/
+ printf "#!/bin/sh\n\n./test_progs -t mptcp\n./test_progs-no_alu32 -t mptcp" > ${BPFTESTS_DIR}/bpf_selftest.sh
+ chmod +x ${BPFTESTS_DIR}/bpf_selftest.sh
+}
+
build_packetdrill() { local old_pwd kversion kver_maj kver_min branch
if [ "${INPUT_BUILD_SKIP_PACKETDRILL}" = 1 ]; then
printinfo "Skip Packetdrill build"
@@ -503,6 +527,9 @@ prepare() { local mode no_tap=1
printinfo "Prepare the environment"
build_selftests
+ if [ "${mode}" = "btf" ]; then
+ build_bpftests
+ fi
build_packetdrill
prepare_hosts_file
@@ -760,11 +787,39 @@ run_packetdrill_all() { local pktd_dir rc=0
return \${rc}
}
+# \$1: output tap file; rest: command to launch
+_run_bpftest_one_tap() {
+ cd "${KERNEL_SRC}/${BPFTESTS_DIR}"
+ _tap "\${@}"
+}
+
+# \$1: script file; rest: command to launch
+run_bpftest_one() { local sf tap
+ sf=\$(basename \${1})
+ tap=bpftest_\${sf:0:-3}
+ shift
+
+ _can_run "\${tap}" || return 0
+
+ _run_bpftest_one_tap "${RESULTS_DIR}/\${tap}" "./\${sf}" "\${@}"
+}
+
+run_bpftest_all() { local sf rc=0
+ sf=${KERNEL_SRC}/${BPFTESTS_DIR}/bpf_selftest.sh
+ if [ -e "\${sf}" ]; then
+ run_bpftest_one "\${sf}" || rc=\${?}
+ rm -rf "\${sf}"
+ fi
+
+ return \${rc}
+}
+
run_all() {
run_kunit_all
run_selftest_all
run_mptcp_connect_mmap
run_packetdrill_all
+ run_bpftest_all
}
has_call_trace() {
--
2.40.1
^ permalink raw reply related [flat|nested] 7+ messages in thread