Skip to contentSkip to conversation

automation: Test a pv network interface under dom0less enhanced

PATCH Superseded Xenia Ragiadakou 2 participants 7 messages Aug 5, 2022 – Aug 6, 2022

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover automation: Test a pv network interface under dom0less enhanced

Xenia Ragiadakou (2):
automation: qemu-smoke-arm64: Use kernel 5.19
automation: qemu-smoke-arm64: Run ping test over a pv network
interface

 automation/gitlab-ci/build.yaml               | 11 +++++
 automation/gitlab-ci/test.yaml                | 10 +++--
 automation/scripts/qemu-smoke-arm64.sh        | 43 +++++++++++++++++--
 .../kernel/5.19-arm64v8.dockerfile            | 37 ++++++++++++++++
 4 files changed, 93 insertions(+), 8 deletions(-)
 create mode 100644 automation/tests-artifacts/kernel/5.19-arm64v8.dockerfile
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/2 automation: qemu-smoke-arm64: Use kernel 5.19

Use kernel 5.19 to unblock testing dom0less enhanced.
This kernel version has the necessary patches for deferring xenbus probe until xenstore is fully initialized.
Also, build kernel with bridging and xen netback support enabled because it will be used for testing network connectivity between Dom0 and Dom1 over a pv network interface.

---
 automation/gitlab-ci/build.yaml               | 11 ++++++
 automation/gitlab-ci/test.yaml                |  4 +-
 .../kernel/5.19-arm64v8.dockerfile            | 37 +++++++++++++++++++
 3 files changed, 50 insertions(+), 2 deletions(-)
 create mode 100644 automation/tests-artifacts/kernel/5.19-arm64v8.dockerfile
automation/gitlab-ci/build.yaml +11 -0
index 23b306e7d0..d2f75a090c 100644
@@ -597,6 +597,17 @@ kernel-5.9.9-arm64-export:
   tags:
     - arm64
 
+kernel-5.19-arm64-export:
+  extends: .test-jobs-artifact-common
+  image: registry.gitlab.com/xen-project/xen/tests-artifacts/kernel:5.19-arm64v8
+  script:
+    - mkdir binaries && cp /Image binaries/Image
+  artifacts:
+    paths:
+      - binaries/Image
+  tags:
+    - arm64
+
 qemu-system-aarch64-6.0.0-arm64-export:
   extends: .test-jobs-artifact-common
   image: registry.gitlab.com/xen-project/xen/tests-artifacts/qemu-system-aarch64:6.0.0-arm64v8
automation/gitlab-ci/test.yaml +2 -2
index 6f9f64a8da..aa633fb655 100644
@@ -70,7 +70,7 @@ qemu-smoke-arm64-gcc:
     - ./automation/scripts/qemu-smoke-arm64.sh 2>&1 | tee qemu-smoke-arm64.log
   needs:
     - debian-unstable-gcc-arm64
-    - kernel-5.9.9-arm64-export
+    - kernel-5.19-arm64-export
     - qemu-system-aarch64-6.0.0-arm64-export
   artifacts:
     paths:
@@ -88,7 +88,7 @@ qemu-smoke-arm64-gcc-staticmem:
     - ./automation/scripts/qemu-smoke-arm64.sh static-mem 2>&1 | tee qemu-smoke-arm64.log
   needs:
     - debian-unstable-gcc-arm64
-    - kernel-5.9.9-arm64-export
+    - kernel-5.19-arm64-export
     - qemu-system-aarch64-6.0.0-arm64-export
   artifacts:
     paths:
automation/tests-artifacts/kernel/5.19-arm64v8.dockerfile new file +37 -0
new file mode 100644
index 0000000000..e445c1f03a
@@ -0,0 +1,37 @@
+FROM arm64v8/debian:unstable
+LABEL maintainer.name="The Xen Project" \
+      maintainer.email="[email protected]"
+
+ENV DEBIAN_FRONTEND=noninteractive
+ENV LINUX_VERSION=5.19
+ENV USER root
+
+RUN mkdir /build
+WORKDIR /build
+
+# build depends
+RUN apt-get update && \
+    apt-get --quiet --yes install \
+        build-essential \
+        libssl-dev \
+        bc \
+        curl \
+        flex \
+        bison \
+        && \
+    \
+    # Build the kernel
+    curl -fsSLO https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-"$LINUX_VERSION".tar.xz && \
+    tar xvJf linux-"$LINUX_VERSION".tar.xz && \
+    cd linux-"$LINUX_VERSION" && \
+    make defconfig && \
+    sed -i 's/CONFIG_IPV6=m/CONFIG_IPV6=y/g' .config && \
+    sed -i 's/CONFIG_BRIDGE=m/CONFIG_BRIDGE=y/g' .config && \
+    sed -i 's/# CONFIG_XEN_NETDEV_BACKEND is not set/CONFIG_XEN_NETDEV_BACKEND=y/g' .config && \
+    make -j$(nproc) Image.gz && \
+    cp arch/arm64/boot/Image / && \
+    cd /build && \
+    rm -rf linux-"$LINUX_VERSION"* && \
+    apt-get autoremove -y && \
+    apt-get clean && \
+    rm -rf /var/lib/apt/lists* /tmp/* /var/tmp/*
Signature · 1 line
2.34.1
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] automation: qemu-smoke-arm64: Use kernel 5.19

Quoted 8 lines · Xenia Ragiadakou

Use kernel 5.19 to unblock testing dom0less enhanced.
This kernel version has the necessary patches for deferring xenbus probe until xenstore is fully initialized.
Also, build kernel with bridging and xen netback support enabled because it will be used for testing network connectivity between Dom0 and Dom1 over a pv network interface.

Quoted 97 lines
---
 automation/gitlab-ci/build.yaml               | 11 ++++++
 automation/gitlab-ci/test.yaml                |  4 +-
 .../kernel/5.19-arm64v8.dockerfile            | 37 +++++++++++++++++++
 3 files changed, 50 insertions(+), 2 deletions(-)
 create mode 100644 automation/tests-artifacts/kernel/5.19-arm64v8.dockerfile
automation/gitlab-ci/build.yaml +11 -0
index 23b306e7d0..d2f75a090c 100644
@@ -597,6 +597,17 @@ kernel-5.9.9-arm64-export:
   tags:
     - arm64
 
+kernel-5.19-arm64-export:
+  extends: .test-jobs-artifact-common
+  image: registry.gitlab.com/xen-project/xen/tests-artifacts/kernel:5.19-arm64v8
+  script:
+    - mkdir binaries && cp /Image binaries/Image
+  artifacts:
+    paths:
+      - binaries/Image
+  tags:
+    - arm64
+
 qemu-system-aarch64-6.0.0-arm64-export:
   extends: .test-jobs-artifact-common
   image: registry.gitlab.com/xen-project/xen/tests-artifacts/qemu-system-aarch64:6.0.0-arm64v8
automation/gitlab-ci/test.yaml +2 -2
index 6f9f64a8da..aa633fb655 100644
@@ -70,7 +70,7 @@ qemu-smoke-arm64-gcc:
     - ./automation/scripts/qemu-smoke-arm64.sh 2>&1 | tee qemu-smoke-arm64.log
   needs:
     - debian-unstable-gcc-arm64
-    - kernel-5.9.9-arm64-export
+    - kernel-5.19-arm64-export
     - qemu-system-aarch64-6.0.0-arm64-export
   artifacts:
     paths:
@@ -88,7 +88,7 @@ qemu-smoke-arm64-gcc-staticmem:
     - ./automation/scripts/qemu-smoke-arm64.sh static-mem 2>&1 | tee qemu-smoke-arm64.log
   needs:
     - debian-unstable-gcc-arm64
-    - kernel-5.9.9-arm64-export
+    - kernel-5.19-arm64-export
     - qemu-system-aarch64-6.0.0-arm64-export
   artifacts:
     paths:
automation/tests-artifacts/kernel/5.19-arm64v8.dockerfile new file +37 -0
new file mode 100644
index 0000000000..e445c1f03a
@@ -0,0 +1,37 @@
+FROM arm64v8/debian:unstable
+LABEL maintainer.name="The Xen Project" \
+      maintainer.email="[email protected]"
+
+ENV DEBIAN_FRONTEND=noninteractive
+ENV LINUX_VERSION=5.19
+ENV USER root
+
+RUN mkdir /build
+WORKDIR /build
+
+# build depends
+RUN apt-get update && \
+    apt-get --quiet --yes install \
+        build-essential \
+        libssl-dev \
+        bc \
+        curl \
+        flex \
+        bison \
+        && \
+    \
+    # Build the kernel
+    curl -fsSLO https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-"$LINUX_VERSION".tar.xz && \
+    tar xvJf linux-"$LINUX_VERSION".tar.xz && \
+    cd linux-"$LINUX_VERSION" && \
+    make defconfig && \
+    sed -i 's/CONFIG_IPV6=m/CONFIG_IPV6=y/g' .config && \
+    sed -i 's/CONFIG_BRIDGE=m/CONFIG_BRIDGE=y/g' .config && \
+    sed -i 's/# CONFIG_XEN_NETDEV_BACKEND is not set/CONFIG_XEN_NETDEV_BACKEND=y/g' .config && \
+    make -j$(nproc) Image.gz && \
+    cp arch/arm64/boot/Image / && \
+    cd /build && \
+    rm -rf linux-"$LINUX_VERSION"* && \
+    apt-get autoremove -y && \
+    apt-get clean && \
+    rm -rf /var/lib/apt/lists* /tmp/* /var/tmp/*
Signature · 1 line
2.34.1
#3 lore raw

PATCH 2/2 automation: qemu-smoke-arm64: Run ping test over a pv network interface

In reply to Xenia Ragiadakou

This patch modified the test in the following way
- Dom0 is booted with an alpine linux rootfs with the xen tools.
- Once Dom0 is booted, it starts xenstored, calls init-dom0less to setup the xenstore interface for the dom0less Dom1, setups the bridged network and attaches a pv network interface to Dom1.
- In the meantime, Dom1 in its init script tries to assign an ip to eth0 and ping Dom0,
- If Dom1 manages to ping Dom0, it prints 'passed'.

---
 automation/gitlab-ci/test.yaml         |  6 ++--
 automation/scripts/qemu-smoke-arm64.sh | 43 +++++++++++++++++++++++---
 2 files changed, 43 insertions(+), 6 deletions(-)
automation/gitlab-ci/test.yaml +4 -2
index aa633fb655..2eb6c3866e 100644
@@ -69,7 +69,8 @@ qemu-smoke-arm64-gcc:
   script:
     - ./automation/scripts/qemu-smoke-arm64.sh 2>&1 | tee qemu-smoke-arm64.log
   needs:
-    - debian-unstable-gcc-arm64
+    - alpine-3.12-gcc-arm64
+    - alpine-3.12-arm64-rootfs-export
     - kernel-5.19-arm64-export
     - qemu-system-aarch64-6.0.0-arm64-export
   artifacts:
@@ -87,7 +88,8 @@ qemu-smoke-arm64-gcc-staticmem:
   script:
     - ./automation/scripts/qemu-smoke-arm64.sh static-mem 2>&1 | tee qemu-smoke-arm64.log
   needs:
-    - debian-unstable-gcc-arm64
+    - alpine-3.12-gcc-arm64
+    - alpine-3.12-arm64-rootfs-export
     - kernel-5.19-arm64-export
     - qemu-system-aarch64-6.0.0-arm64-export
   artifacts:
automation/scripts/qemu-smoke-arm64.sh +39 -4

65 lines not on this page · raw message

Signature · 1 line
2.34.1
#4 lore raw

Re: [PATCH 2/2] automation: qemu-smoke-arm64: Run ping test over a pv network interface

Quoted 106 lines · Xenia Ragiadakou

This patch modified the test in the following way
- Dom0 is booted with an alpine linux rootfs with the xen tools.
- Once Dom0 is booted, it starts xenstored, calls init-dom0less to setup the xenstore interface for the dom0less Dom1, setups the bridged network and attaches a pv network interface to Dom1.
- In the meantime, Dom1 in its init script tries to assign an ip to eth0 and ping Dom0,
- If Dom1 manages to ping Dom0, it prints 'passed'.

---
 automation/gitlab-ci/test.yaml         |  6 ++--
 automation/scripts/qemu-smoke-arm64.sh | 43 +++++++++++++++++++++++---
 2 files changed, 43 insertions(+), 6 deletions(-)
automation/gitlab-ci/test.yaml +4 -2
index aa633fb655..2eb6c3866e 100644
@@ -69,7 +69,8 @@ qemu-smoke-arm64-gcc:
   script:
     - ./automation/scripts/qemu-smoke-arm64.sh 2>&1 | tee qemu-smoke-arm64.log
   needs:
-    - debian-unstable-gcc-arm64
+    - alpine-3.12-gcc-arm64
+    - alpine-3.12-arm64-rootfs-export
     - kernel-5.19-arm64-export
     - qemu-system-aarch64-6.0.0-arm64-export
   artifacts:
@@ -87,7 +88,8 @@ qemu-smoke-arm64-gcc-staticmem:
   script:
     - ./automation/scripts/qemu-smoke-arm64.sh static-mem 2>&1 | tee qemu-smoke-arm64.log
   needs:
-    - debian-unstable-gcc-arm64
+    - alpine-3.12-gcc-arm64
+    - alpine-3.12-arm64-rootfs-export
     - kernel-5.19-arm64-export
     - qemu-system-aarch64-6.0.0-arm64-export
   artifacts:
automation/scripts/qemu-smoke-arm64.sh +38 -3
index b48a20988f..0d19ad52cc 100755
@@ -4,8 +4,13 @@ set -ex
 
 test_variant=$1
 
-passed="BusyBox"
-check=""
+passed="passed"
+check="
+until ifconfig eth0 192.168.0.2 && ping -c 10 192.168.0.1; do
+    sleep 30
+done
+echo \"${passed}\"
+"
 
 if [[ "${test_variant}" == "static-mem" ]]; then
     # Memory range that is statically allocated to DOM1
@@ -68,6 +73,36 @@ cd initrd
 find . | cpio --create --format='newc' | gzip > ../binaries/initrd
 cd ..
 
+# DOM0 rootfs
+mkdir -p rootfs
+cd rootfs
+tar xzf ../binaries/initrd.tar.gz
+mkdir proc
+mkdir run
+mkdir srv
+mkdir sys
+rm var/run
+cp -ar ../binaries/dist/install/* .
+
+echo "#!/bin/bash
+
+export LD_LIBRARY_PATH=/usr/local/lib
+bash /etc/init.d/xencommons start
+
+/usr/local/lib/xen/bin/init-dom0less
+
+brctl addbr xenbr0
+brctl addif xenbr0 eth0
+ifconfig eth0 up
+ifconfig xenbr0 up
+ifconfig xenbr0 192.168.0.1
+
+xl network-attach 1 type=vif
+" > etc/local.d/xen.start
+chmod +x etc/local.d/xen.start
+echo "rc_verbose=yes" >> etc/rc.conf
+find . | cpio -H newc -o | gzip > ../binaries/dom0-rootfs.cpio.gz
+cd ..
 
 # ImageBuilder
 echo 'MEMORY_START="0x40000000"
@@ -76,7 +111,7 @@ MEMORY_END="0x80000000"
 DEVICE_TREE="virt-gicv2.dtb"
 XEN="xen"
 DOM0_KERNEL="Image"
-DOM0_RAMDISK="initrd"
+DOM0_RAMDISK="dom0-rootfs.cpio.gz"
 XEN_CMD="console=dtuart dom0_mem=512M"
 
 NUM_DOMUS=1

automation/scripts/qemu-smoke-arm64.sh timeout -k 1 240 \ · line 152

Quoted 6 lines
automation/scripts/qemu-smoke-arm64.sh +1 -1
@@ -113,5 +148,5 @@ timeout -k 1 240 \
     -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin |& tee smoke.serial
 
 set -e
-(grep -q "^BusyBox" smoke.serial && grep -q "DOM1: ${passed}" smoke.serial) || exit 1
+(grep -q "^Welcome to Alpine Linux 3.12" smoke.serial && grep -q "DOM1: ${passed}" smoke.serial) || exit 1
 exit 0

This patch looks great! One minor comment: Should we great only for "^Welcome to Alpine Linux" without the version (3.12) to make it easier to upgrade in the future?

If you are OK with it, I can remove "3.12" on commit.

#5 lore raw

Re: [PATCH 2/2] automation: qemu-smoke-arm64: Run ping test over a pv network interface

Quoted 11 lines · Stefano Stabellini
Quoted 10 lines · Xenia Ragiadakou

This patch modified the test in the following way
- Dom0 is booted with an alpine linux rootfs with the xen tools.
- Once Dom0 is booted, it starts xenstored, calls init-dom0less to setup the xenstore interface for the dom0less Dom1, setups the bridged network and attaches a pv network interface to Dom1.
- In the meantime, Dom1 in its init script tries to assign an ip to eth0 and ping Dom0,
- If Dom1 manages to ping Dom0, it prints 'passed'.

[...]

Quoted 12 lines

Review timeout -k 1 240 \ · line 152

Quoted 7 lines
(quoted diff) +1 -1
@@ -113,5 +148,5 @@ timeout -k 1 240 \
     -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin |& tee smoke.serial
 
 set -e
-(grep -q "^BusyBox" smoke.serial && grep -q "DOM1: ${passed}" smoke.serial) || exit 1
+(grep -q "^Welcome to Alpine Linux 3.12" smoke.serial && grep -q "DOM1: ${passed}" smoke.serial) || exit 1
 exit 0

This patch looks great! One minor comment: Should we great only for "^Welcome to Alpine Linux" without the version (3.12) to make it easier to upgrade in the future?

Quoted 1 line

If you are OK with it, I can remove "3.12" on commit.

We also need to remove DOMU_ENHANCED[0] from the ImageBuilder config otherwise this is not going to work.

automation/scripts/qemu-smoke-arm64.sh +0 -1
index a79401fd81..0d19ad52cc 100755
@@ -118,7 +118,6 @@ NUM_DOMUS=1
 DOMU_KERNEL[0]="Image"
 DOMU_RAMDISK[0]="initrd"
 DOMU_MEM[0]="256"
-DOMU_ENHANCED[0]=0
 
 LOAD_CMD="tftpb"
 UBOOT_SOURCE="boot.source"
#6 lore raw

Re: [PATCH 2/2] automation: qemu-smoke-arm64: Run ping test over a pv network interface

Hi Stefano,

Quoted 37 lines · Stefano Stabellini
Quoted 11 lines · Stefano Stabellini
Quoted 10 lines · Xenia Ragiadakou

This patch modified the test in the following way
- Dom0 is booted with an alpine linux rootfs with the xen tools.
- Once Dom0 is booted, it starts xenstored, calls init-dom0less to setup the xenstore interface for the dom0less Dom1, setups the bridged network and attaches a pv network interface to Dom1.
- In the meantime, Dom1 in its init script tries to assign an ip to eth0 and ping Dom0,
- If Dom1 manages to ping Dom0, it prints 'passed'.

[...]

Quoted 12 lines

Review timeout -k 1 240 \ · line 152

Quoted 7 lines
(quoted diff) +1 -1
@@ -113,5 +148,5 @@ timeout -k 1 240 \
      -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin |& tee smoke.serial
 
  set -e
-(grep -q "^BusyBox" smoke.serial && grep -q "DOM1: ${passed}" smoke.serial) || exit 1
+(grep -q "^Welcome to Alpine Linux 3.12" smoke.serial && grep -q "DOM1: ${passed}" smoke.serial) || exit 1
  exit 0

This patch looks great! One minor comment: Should we great only for "^Welcome to Alpine Linux" without the version (3.12) to make it easier to upgrade in the future?

Quoted 1 line

If you are OK with it, I can remove "3.12" on commit.

We also need to remove DOMU_ENHANCED[0] from the ImageBuilder config otherwise this is not going to work.

automation/scripts/qemu-smoke-arm64.sh +0 -0
index a79401fd81..0d19ad52cc 100755

automation/scripts/qemu-smoke-arm64.sh NUM_DOMUS=1 · line 123

Quoted 7 lines
automation/scripts/qemu-smoke-arm64.sh +0 -1
@@ -118,7 +118,6 @@ NUM_DOMUS=1
  DOMU_KERNEL[0]="Image"
  DOMU_RAMDISK[0]="initrd"
  DOMU_MEM[0]="256"
-DOMU_ENHANCED[0]=0
 
  LOAD_CMD="tftpb"
  UBOOT_SOURCE="boot.source"

This change was not there when I was testing, that's why.
I will wait a bit in case there are more comments and I will send a v2 with this fixed and 3.12 removed.

Signature · 1 line
Xenia