Skip to contentSkip to conversation

bpf: add bpftests support

PATCH Superseded Geliang Tang 2 participants 7 messages Jan 28, 2024 – Jan 31, 2024 Networking MPTCP

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Geliang Tang

author reviewer
#0 lore raw

cover bpf: add bpftests support

Address #406.

Geliang Tang (3):
change watchdog to device
upgrade to ubuntu 23.10
bpf: add bpftests support

 Dockerfile    | 10 ++++++++--
 entrypoint.sh | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 63 insertions(+), 2 deletions(-)
Signature · 1 line
2.40.1
author reviewer
#1 lore raw

PATCH 1/3 change watchdog to device

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.
'''

---
 Dockerfile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Dockerfile +2 -1
index bf7f733..cf8c692 100644
@@ -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"
Signature · 1 line
2.40.1
author reviewer
#2 lore raw

PATCH 2/3 upgrade to ubuntu 23.10

In reply to 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.

---
 Dockerfile | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
Dockerfile +5 -1
index cf8c692..cbc11f7 100644
@@ -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 .. && \
Signature · 1 line
2.40.1
author reviewer
#3 lore raw

Re: [PATCH virtme-docker 2/3] upgrade to ubuntu 23.10

Quoted 6 lines · 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.

This part has been upstreamed, we can drop it now from this patch.

Quoted 29 lines
---
 Dockerfile | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
Dockerfile +5 -1
index cf8c692..cbc11f7 100644
@@ -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 .. && \
Signature · 1 line
2.40.1
maintainer
#4 lore raw

Re: [PATCH virtme-docker 2/3] upgrade to ubuntu 23.10

Hi Geliang,

Quoted 9 lines · Geliang Tang
Quoted 6 lines · 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.

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

Signature · 1 line
Sponsored by the NGI0 Core fund.
author reviewer
#5 lore raw

Re: [PATCH virtme-docker 2/3] upgrade to ubuntu 23.10

Quoted 8 lines · Matthieu Baerts

Hi Geliang,

Quoted 5 lines · Geliang Tang
Quoted 4 lines · 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.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

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").

Quoted 7 lines

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

Quoted 14 lines

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

Signature · 1 line
Sponsored by the NGI0 Core fund.
author reviewer
#6 lore raw

PATCH 3/3 bpf: add bpftests support

In reply to 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

---
 Dockerfile    |  1 +
 entrypoint.sh | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 56 insertions(+)
Dockerfile +1 -0
index cbc11f7..77d7423 100644
@@ -26,6 +26,7 @@ RUN apt-get update && \
 		wget xz-utils lftp cpio u-boot-tools \
 		cscope \
 		bpftrace \
+		python3-docutils \
 		&& \
 	apt-get clean
 
entrypoint.sh +55 -0

90 lines not on this page · raw message

Signature · 1 line
2.40.1