From 52eca431b4ef4153092e7b5222287473cb1514b1 Mon Sep 17 00:00:00 2001 From: Stefan Lankes Date: Sat, 9 Sep 2023 11:17:08 +0200 Subject: [PATCH 1/7] add test for the network interface of qemu micro vm --- .github/workflows/ci.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4af80c298d..832a109138 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -243,6 +243,34 @@ jobs: -append "-freq $FREQ" \ || qemu_status=$? test $qemu_status -eq 3 + - name: Build minimal httpd with DHCP support (debug, virtio-net) + run: cargo build -Zbuild-std=std,panic_abort --target x86_64-unknown-hermit --package httpd --no-default-features --features ci,dhcpv4,acpi + - name: Test minimal httpd with DHCP support (debug, virtio-net) + run: | + qemu-system-x86_64 -smp 1 -cpu qemu64,apic,fsgsbase,rdtscp,xsave,xsaveopt,fxsr,rdrand \ + -M microvm,x-option-roms=off,pit=off,pic=off,rtc=on,pcie=on -global virtio-mmio.force-legacy=on \ + -display none -m 256M -serial stdio \ + -kernel rusty-loader-x86_64 \ + -initrd target/x86_64-unknown-hermit/debug/httpd \ + -netdev user,id=u1,hostfwd=tcp::9975-:9975,net=192.168.76.0/24,dhcpstart=192.168.76.9 \ + -device virtio-net-device,netdev=u1 & + sleep 5 + curl http://127.0.0.1:9975/help + sleep 1 + - name: Build minimal httpd with DHCP support (debug, virtio-net) + run: cargo build -Zbuild-std=std,panic_abort --target x86_64-unknown-hermit --package httpd --release --no-default-features --features ci,dhcpv4,acpi + - name: Test minimal httpd with DHCP support (release, virtio-net) + run: | + qemu-system-x86_64 -smp 1 -cpu qemu64,apic,fsgsbase,rdtscp,xsave,xsaveopt,fxsr,rdrand \ + -M microvm,x-option-roms=off,pit=off,pic=off,rtc=on,pcie=on -global virtio-mmio.force-legacy=on \ + -display none -m 256M -serial stdio \ + -kernel rusty-loader-x86_64 \ + -initrd target/x86_64-unknown-hermit/release/httpd \ + -netdev user,id=u1,hostfwd=tcp::9975-:9975,net=192.168.76.0/24,dhcpstart=192.168.76.9 \ + -device virtio-net-device,netdev=u1 & + sleep 5 + curl http://127.0.0.1:9975/help + sleep 1 - name: Build udp tests (debug, virtio-net) run: cargo build -Zbuild-std=std,panic_abort --target x86_64-unknown-hermit --package testudp --features udp,dhcpv4 - name: Test udp profile From 61f75379c9b2b91d66141c31da24933aea0e1e24 Mon Sep 17 00:00:00 2001 From: Stefan Lankes Date: Sat, 9 Sep 2023 11:45:10 +0200 Subject: [PATCH 2/7] enable TCP support --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 832a109138..52f1867a8d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -244,7 +244,7 @@ jobs: || qemu_status=$? test $qemu_status -eq 3 - name: Build minimal httpd with DHCP support (debug, virtio-net) - run: cargo build -Zbuild-std=std,panic_abort --target x86_64-unknown-hermit --package httpd --no-default-features --features ci,dhcpv4,acpi + run: cargo build -Zbuild-std=std,panic_abort --target x86_64-unknown-hermit --package httpd --no-default-features --features ci,dhcpv4,acpi,tcp - name: Test minimal httpd with DHCP support (debug, virtio-net) run: | qemu-system-x86_64 -smp 1 -cpu qemu64,apic,fsgsbase,rdtscp,xsave,xsaveopt,fxsr,rdrand \ @@ -258,7 +258,7 @@ jobs: curl http://127.0.0.1:9975/help sleep 1 - name: Build minimal httpd with DHCP support (debug, virtio-net) - run: cargo build -Zbuild-std=std,panic_abort --target x86_64-unknown-hermit --package httpd --release --no-default-features --features ci,dhcpv4,acpi + run: cargo build -Zbuild-std=std,panic_abort --target x86_64-unknown-hermit --package httpd --release --no-default-features --features ci,dhcpv4,acpi,tcp - name: Test minimal httpd with DHCP support (release, virtio-net) run: | qemu-system-x86_64 -smp 1 -cpu qemu64,apic,fsgsbase,rdtscp,xsave,xsaveopt,fxsr,rdrand \ From bed07216161c0b421e1b250bd0a0034060360298 Mon Sep 17 00:00:00 2001 From: Stefan Lankes Date: Sat, 9 Sep 2023 12:50:35 +0200 Subject: [PATCH 3/7] disable ioapic2 support in Qemu's microvm --- .github/workflows/ci.yml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 52f1867a8d..d4d1570546 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -227,19 +227,19 @@ jobs: curl http://127.0.0.1:9975/help sleep 1 - name: Build minimal profile - run: cargo build -Zbuild-std=std,panic_abort --target x86_64-unknown-hermit --no-default-features --release --package hello_world + run: cargo build -Zbuild-std=std,panic_abort --target x86_64-unknown-hermit --no-default-features --release --package hello_world --features acpi - name: Test minimal profile run: | FREQ=`grep 'cpu MHz' /proc/cpuinfo | head -1 | awk -F: '{print $2}' | awk '{printf("%d\n",$1 + 0.5)}'` echo "FREQ = $FREQ" qemu-system-x86_64 \ - -M microvm,x-option-roms=off,pit=off,pic=off,rtc=on \ - -global virtio-mmio.force-legacy=on -nodefaults -no-user-config \ + -M microvm,x-option-roms=off,pit=off,pic=off,rtc=on,pcie=on,ioapic2=off \ + -global virtio-mmio.force-legacy=false \ + -nodefaults -no-user-config \ -display none -smp 1 -m 64M -serial stdio \ -kernel rusty-loader-x86_64 \ -initrd target/x86_64-unknown-hermit/release/hello_world \ -cpu qemu64,apic,fsgsbase,rdtscp,xsave,xsaveopt,fxsr \ - -device isa-debug-exit,iobase=0xf4,iosize=0x04 \ -append "-freq $FREQ" \ || qemu_status=$? test $qemu_status -eq 3 @@ -248,7 +248,9 @@ jobs: - name: Test minimal httpd with DHCP support (debug, virtio-net) run: | qemu-system-x86_64 -smp 1 -cpu qemu64,apic,fsgsbase,rdtscp,xsave,xsaveopt,fxsr,rdrand \ - -M microvm,x-option-roms=off,pit=off,pic=off,rtc=on,pcie=on -global virtio-mmio.force-legacy=on \ + -M microvm,x-option-roms=off,pit=off,pic=off,rtc=on,pcie=on,ioapic2=off \ + -global virtio-mmio.force-legacy=false \ + -nodefaults -no-user-config \ -display none -m 256M -serial stdio \ -kernel rusty-loader-x86_64 \ -initrd target/x86_64-unknown-hermit/debug/httpd \ @@ -262,7 +264,9 @@ jobs: - name: Test minimal httpd with DHCP support (release, virtio-net) run: | qemu-system-x86_64 -smp 1 -cpu qemu64,apic,fsgsbase,rdtscp,xsave,xsaveopt,fxsr,rdrand \ - -M microvm,x-option-roms=off,pit=off,pic=off,rtc=on,pcie=on -global virtio-mmio.force-legacy=on \ + -M microvm,x-option-roms=off,pit=off,pic=off,rtc=on,pcie=on,ioapic2=off \ + -global virtio-mmio.force-legacy=false \ + -nodefaults -no-user-config \ -display none -m 256M -serial stdio \ -kernel rusty-loader-x86_64 \ -initrd target/x86_64-unknown-hermit/release/httpd \ From 98e4421072109c1284daa67f11a1bd25fad6a383 Mon Sep 17 00:00:00 2001 From: Stefan Lankes Date: Sat, 9 Sep 2023 13:03:32 +0200 Subject: [PATCH 4/7] pass cpu frequency to the kernel --- .github/workflows/ci.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d4d1570546..2639faf00d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -240,6 +240,7 @@ jobs: -kernel rusty-loader-x86_64 \ -initrd target/x86_64-unknown-hermit/release/hello_world \ -cpu qemu64,apic,fsgsbase,rdtscp,xsave,xsaveopt,fxsr \ + -device isa-debug-exit,iobase=0xf4,iosize=0x04 \ -append "-freq $FREQ" \ || qemu_status=$? test $qemu_status -eq 3 @@ -247,6 +248,8 @@ jobs: run: cargo build -Zbuild-std=std,panic_abort --target x86_64-unknown-hermit --package httpd --no-default-features --features ci,dhcpv4,acpi,tcp - name: Test minimal httpd with DHCP support (debug, virtio-net) run: | + FREQ=`grep 'cpu MHz' /proc/cpuinfo | head -1 | awk -F: '{print $2}' | awk '{printf("%d\n",$1 + 0.5)}'` + echo "FREQ = $FREQ" qemu-system-x86_64 -smp 1 -cpu qemu64,apic,fsgsbase,rdtscp,xsave,xsaveopt,fxsr,rdrand \ -M microvm,x-option-roms=off,pit=off,pic=off,rtc=on,pcie=on,ioapic2=off \ -global virtio-mmio.force-legacy=false \ @@ -254,8 +257,10 @@ jobs: -display none -m 256M -serial stdio \ -kernel rusty-loader-x86_64 \ -initrd target/x86_64-unknown-hermit/debug/httpd \ + -device isa-debug-exit,iobase=0xf4,iosize=0x04 \ -netdev user,id=u1,hostfwd=tcp::9975-:9975,net=192.168.76.0/24,dhcpstart=192.168.76.9 \ - -device virtio-net-device,netdev=u1 & + -device virtio-net-device,netdev=u1 \ + -append "-freq $FREQ" & sleep 5 curl http://127.0.0.1:9975/help sleep 1 @@ -263,6 +268,8 @@ jobs: run: cargo build -Zbuild-std=std,panic_abort --target x86_64-unknown-hermit --package httpd --release --no-default-features --features ci,dhcpv4,acpi,tcp - name: Test minimal httpd with DHCP support (release, virtio-net) run: | + FREQ=`grep 'cpu MHz' /proc/cpuinfo | head -1 | awk -F: '{print $2}' | awk '{printf("%d\n",$1 + 0.5)}'` + echo "FREQ = $FREQ" qemu-system-x86_64 -smp 1 -cpu qemu64,apic,fsgsbase,rdtscp,xsave,xsaveopt,fxsr,rdrand \ -M microvm,x-option-roms=off,pit=off,pic=off,rtc=on,pcie=on,ioapic2=off \ -global virtio-mmio.force-legacy=false \ @@ -270,8 +277,10 @@ jobs: -display none -m 256M -serial stdio \ -kernel rusty-loader-x86_64 \ -initrd target/x86_64-unknown-hermit/release/httpd \ + -device isa-debug-exit,iobase=0xf4,iosize=0x04 \ -netdev user,id=u1,hostfwd=tcp::9975-:9975,net=192.168.76.0/24,dhcpstart=192.168.76.9 \ - -device virtio-net-device,netdev=u1 & + -device virtio-net-device,netdev=u1 \ + -append "-freq $FREQ" & sleep 5 curl http://127.0.0.1:9975/help sleep 1 From a7f7d4e1fc725ee0c7dab38bebe09dce047ca656 Mon Sep 17 00:00:00 2001 From: Stefan Lankes Date: Sat, 9 Sep 2023 20:07:49 +0200 Subject: [PATCH 5/7] git disable apcpi support for microVMs --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2639faf00d..44b0dd20ba 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -227,7 +227,7 @@ jobs: curl http://127.0.0.1:9975/help sleep 1 - name: Build minimal profile - run: cargo build -Zbuild-std=std,panic_abort --target x86_64-unknown-hermit --no-default-features --release --package hello_world --features acpi + run: cargo build -Zbuild-std=std,panic_abort --target x86_64-unknown-hermit --no-default-features --release --package hello_world - name: Test minimal profile run: | FREQ=`grep 'cpu MHz' /proc/cpuinfo | head -1 | awk -F: '{print $2}' | awk '{printf("%d\n",$1 + 0.5)}'` @@ -245,7 +245,7 @@ jobs: || qemu_status=$? test $qemu_status -eq 3 - name: Build minimal httpd with DHCP support (debug, virtio-net) - run: cargo build -Zbuild-std=std,panic_abort --target x86_64-unknown-hermit --package httpd --no-default-features --features ci,dhcpv4,acpi,tcp + run: cargo build -Zbuild-std=std,panic_abort --target x86_64-unknown-hermit --package httpd --no-default-features --features ci,dhcpv4,tcp - name: Test minimal httpd with DHCP support (debug, virtio-net) run: | FREQ=`grep 'cpu MHz' /proc/cpuinfo | head -1 | awk -F: '{print $2}' | awk '{printf("%d\n",$1 + 0.5)}'` @@ -265,7 +265,7 @@ jobs: curl http://127.0.0.1:9975/help sleep 1 - name: Build minimal httpd with DHCP support (debug, virtio-net) - run: cargo build -Zbuild-std=std,panic_abort --target x86_64-unknown-hermit --package httpd --release --no-default-features --features ci,dhcpv4,acpi,tcp + run: cargo build -Zbuild-std=std,panic_abort --target x86_64-unknown-hermit --package httpd --release --no-default-features --features ci,dhcpv4,tcp - name: Test minimal httpd with DHCP support (release, virtio-net) run: | FREQ=`grep 'cpu MHz' /proc/cpuinfo | head -1 | awk -F: '{print $2}' | awk '{printf("%d\n",$1 + 0.5)}'` From efcc55fca4aeef685e42dcc2988a048ffd0350da Mon Sep 17 00:00:00 2001 From: Stefan Lankes Date: Sat, 9 Sep 2023 22:36:16 +0200 Subject: [PATCH 6/7] test microVM with KVM support --- .github/workflows/ci.yml | 74 ++++++++++++++++++---------------------- 1 file changed, 34 insertions(+), 40 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 44b0dd20ba..e56ef61477 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -244,46 +244,6 @@ jobs: -append "-freq $FREQ" \ || qemu_status=$? test $qemu_status -eq 3 - - name: Build minimal httpd with DHCP support (debug, virtio-net) - run: cargo build -Zbuild-std=std,panic_abort --target x86_64-unknown-hermit --package httpd --no-default-features --features ci,dhcpv4,tcp - - name: Test minimal httpd with DHCP support (debug, virtio-net) - run: | - FREQ=`grep 'cpu MHz' /proc/cpuinfo | head -1 | awk -F: '{print $2}' | awk '{printf("%d\n",$1 + 0.5)}'` - echo "FREQ = $FREQ" - qemu-system-x86_64 -smp 1 -cpu qemu64,apic,fsgsbase,rdtscp,xsave,xsaveopt,fxsr,rdrand \ - -M microvm,x-option-roms=off,pit=off,pic=off,rtc=on,pcie=on,ioapic2=off \ - -global virtio-mmio.force-legacy=false \ - -nodefaults -no-user-config \ - -display none -m 256M -serial stdio \ - -kernel rusty-loader-x86_64 \ - -initrd target/x86_64-unknown-hermit/debug/httpd \ - -device isa-debug-exit,iobase=0xf4,iosize=0x04 \ - -netdev user,id=u1,hostfwd=tcp::9975-:9975,net=192.168.76.0/24,dhcpstart=192.168.76.9 \ - -device virtio-net-device,netdev=u1 \ - -append "-freq $FREQ" & - sleep 5 - curl http://127.0.0.1:9975/help - sleep 1 - - name: Build minimal httpd with DHCP support (debug, virtio-net) - run: cargo build -Zbuild-std=std,panic_abort --target x86_64-unknown-hermit --package httpd --release --no-default-features --features ci,dhcpv4,tcp - - name: Test minimal httpd with DHCP support (release, virtio-net) - run: | - FREQ=`grep 'cpu MHz' /proc/cpuinfo | head -1 | awk -F: '{print $2}' | awk '{printf("%d\n",$1 + 0.5)}'` - echo "FREQ = $FREQ" - qemu-system-x86_64 -smp 1 -cpu qemu64,apic,fsgsbase,rdtscp,xsave,xsaveopt,fxsr,rdrand \ - -M microvm,x-option-roms=off,pit=off,pic=off,rtc=on,pcie=on,ioapic2=off \ - -global virtio-mmio.force-legacy=false \ - -nodefaults -no-user-config \ - -display none -m 256M -serial stdio \ - -kernel rusty-loader-x86_64 \ - -initrd target/x86_64-unknown-hermit/release/httpd \ - -device isa-debug-exit,iobase=0xf4,iosize=0x04 \ - -netdev user,id=u1,hostfwd=tcp::9975-:9975,net=192.168.76.0/24,dhcpstart=192.168.76.9 \ - -device virtio-net-device,netdev=u1 \ - -append "-freq $FREQ" & - sleep 5 - curl http://127.0.0.1:9975/help - sleep 1 - name: Build udp tests (debug, virtio-net) run: cargo build -Zbuild-std=std,panic_abort --target x86_64-unknown-hermit --package testudp --features udp,dhcpv4 - name: Test udp profile @@ -457,6 +417,40 @@ jobs: -enable-kvm -cpu qemu64,apic,fsgsbase,rdtscp,xsave,xsaveopt,fxsr,rdrand \ -kernel rusty-loader-x86_64 \ -initrd target/x86_64-unknown-hermit/release/rusty_demo + - name: Build minimal httpd with DHCP support (debug, virtio-net) + run: cargo build -Zbuild-std=std,panic_abort --target x86_64-unknown-hermit --package httpd --no-default-features --features ci,dhcpv4,tcp + - name: Test minimal httpd with DHCP support (debug, virtio-net) + run: | + qemu-system-x86_64 -smp 1 -enable-kvm -cpu qemu64,apic,fsgsbase,rdtscp,xsave,xsaveopt,fxsr,rdrand \ + -M microvm,x-option-roms=off,pit=off,pic=off,rtc=on,pcie=on,ioapic2=off \ + -global virtio-mmio.force-legacy=false \ + -nodefaults -no-user-config \ + -display none -m 256M -serial stdio \ + -kernel rusty-loader-x86_64 \ + -initrd target/x86_64-unknown-hermit/debug/httpd \ + -device isa-debug-exit,iobase=0xf4,iosize=0x04 \ + -netdev user,id=u1,hostfwd=tcp::9975-:9975,net=192.168.76.0/24,dhcpstart=192.168.76.9 \ + -device virtio-net-device,netdev=u1 & + sleep 5 + curl http://127.0.0.1:9975/help + sleep 1 + - name: Build minimal httpd with DHCP support (debug, virtio-net) + run: cargo build -Zbuild-std=std,panic_abort --target x86_64-unknown-hermit --package httpd --release --no-default-features --features ci,dhcpv4,tcp + - name: Test minimal httpd with DHCP support (release, virtio-net) + run: | + qemu-system-x86_64 -smp 1 -enable-kvm -cpu qemu64,apic,fsgsbase,rdtscp,xsave,xsaveopt,fxsr,rdrand \ + -M microvm,x-option-roms=off,pit=off,pic=off,rtc=on,pcie=on,ioapic2=off \ + -global virtio-mmio.force-legacy=false \ + -nodefaults -no-user-config \ + -display none -m 256M -serial stdio \ + -kernel rusty-loader-x86_64 \ + -initrd target/x86_64-unknown-hermit/release/httpd \ + -device isa-debug-exit,iobase=0xf4,iosize=0x04 \ + -netdev user,id=u1,hostfwd=tcp::9975-:9975,net=192.168.76.0/24,dhcpstart=192.168.76.9 \ + -device virtio-net-device,netdev=u1 & + sleep 5 + curl http://127.0.0.1:9975/help + sleep 1 - name: Build minimal profile (debug) run: cargo build -Zbuild-std=std,panic_abort --target x86_64-unknown-hermit --no-default-features --package hello_world - name: Test debug profile (Firecracker) From 38bce00af09a188bd203a2e3b29ec0171a779253 Mon Sep 17 00:00:00 2001 From: Stefan Lankes Date: Sat, 9 Sep 2023 22:42:14 +0200 Subject: [PATCH 7/7] remove unsupported flag --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e56ef61477..16f897b9ae 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -422,7 +422,7 @@ jobs: - name: Test minimal httpd with DHCP support (debug, virtio-net) run: | qemu-system-x86_64 -smp 1 -enable-kvm -cpu qemu64,apic,fsgsbase,rdtscp,xsave,xsaveopt,fxsr,rdrand \ - -M microvm,x-option-roms=off,pit=off,pic=off,rtc=on,pcie=on,ioapic2=off \ + -M microvm,x-option-roms=off,pit=off,pic=off,rtc=on,pcie=on \ -global virtio-mmio.force-legacy=false \ -nodefaults -no-user-config \ -display none -m 256M -serial stdio \ @@ -439,7 +439,7 @@ jobs: - name: Test minimal httpd with DHCP support (release, virtio-net) run: | qemu-system-x86_64 -smp 1 -enable-kvm -cpu qemu64,apic,fsgsbase,rdtscp,xsave,xsaveopt,fxsr,rdrand \ - -M microvm,x-option-roms=off,pit=off,pic=off,rtc=on,pcie=on,ioapic2=off \ + -M microvm,x-option-roms=off,pit=off,pic=off,rtc=on,pcie=on \ -global virtio-mmio.force-legacy=false \ -nodefaults -no-user-config \ -display none -m 256M -serial stdio \