Patches 1/3 and 2/3 deal with the tests, patch 3/3 updates usage notes and documentation bits. Indeed, we'll need to keep qrap around for a little longer, but it's probably time to start telling users about this. Stefano Brivio (3): test: Switch to qemu -netdev stream option instead of using qrap test/perf: Finally drop workaround for virtio_net TX stall passt, qrap, README: Update notes and documentation for AF_UNIX support in qemu README.md | 10 ++++----- passt.1 | 8 ++----- qrap.1 | 13 +++++------- qrap.c | 5 +++-- tap.c | 10 ++++----- test/README.md | 5 +++++ test/demo/passt | 9 +++----- test/distro/debian | 24 ++++++++++----------- test/distro/fedora | 38 ++++++++++++++++----------------- test/distro/opensuse | 14 ++++++------- test/distro/ubuntu | 12 +++++------ test/lib/setup | 50 ++++++++++++++++++++------------------------ test/perf/passt_tcp | 15 ------------- test/perf/passt_udp | 15 ------------- 14 files changed, 93 insertions(+), 135 deletions(-) -- 2.35.1
qemu commit 13c6be96618c ("net: stream: add unix socket") introduces support for native AF_UNIX support, finally making qrap useless. We can't quite drop that yet until a qemu release includes it, and then we'll need to wait a while for users to switch anyway, but at least for tests, we can use that support. Signed-off-by: Stefano Brivio <sbrivio(a)redhat.com> --- test/README.md | 5 +++++ test/demo/passt | 9 +++----- test/distro/debian | 24 ++++++++++----------- test/distro/fedora | 38 ++++++++++++++++----------------- test/distro/opensuse | 14 ++++++------- test/distro/ubuntu | 12 +++++------ test/lib/setup | 50 ++++++++++++++++++++------------------------ 7 files changed, 75 insertions(+), 77 deletions(-) diff --git a/test/README.md b/test/README.md index 09ad05d..3b085bd 100644 --- a/test/README.md +++ b/test/README.md @@ -33,6 +33,11 @@ Example for Debian, and possibly most Debian-based distributions: netcat-openbsd fakeroot lz4 lm-sensors qemu-system-arm qemu-system-ppc qemu-system-misc qemu-system-x86 valgrind +NOTE: the tests need a qemu version >= 7.2, or one that contains commit +13c6be96618c ("net: stream: add unix socket"): this change introduces support +for UNIX domain sockets as network device back-end, which qemu uses to connect +to passt. + ### Other tools Test measuring request-response and connect-request-response latencies use diff --git a/test/demo/passt b/test/demo/passt index ce40e20..879169f 100644 --- a/test/demo/passt +++ b/test/demo/passt @@ -85,7 +85,7 @@ guest cd passt gout TARGET_PID pgrep -P $(cat pasta.pid) sleep 1 -passtb ./passt -f -t 10001,10003 +passtb ./passt -f -t 10001,10003 -s __STATEDIR__/passt.socket sleep 2 guest nsenter -t __TARGET_PID__ -U -n --preserve-credentials @@ -93,14 +93,11 @@ sleep 5 nl nl -say We're ready to start qemu with the qrap wrapper, +say We're ready to start qemu nl -say that we currently need to connect the netdev -nl -say back-end to passt's UNIX domain socket. sleep 2 hout VMLINUZ echo "/boot/vmlinuz-$(uname -r)" -guest ./qrap 5 qemu-system-x86_64 -enable-kvm -m 4096 -cpu host -smp 4 -kernel __VMLINUZ__ -initrd ../passt.img -nographic -serial stdio -nodefaults -append "console=ttyS0 virtio-net.napi_tx=1" -device virtio-net-pci,netdev=hostnet0,x-txburst=16384 -netdev socket,fd=5,id=hostnet0 +guest qemu-system-x86_64 -enable-kvm -m 4096 -cpu host -smp 4 -kernel __VMLINUZ__ -initrd ../passt.img -nographic -serial stdio -nodefaults -append "console=ttyS0" -device virtio-net-pci,netdev=s0 -netdev stream,id=s0,server=off,addr.type=unix,addr.path=__STATEDIR__/passt.socket sleep 10 nl diff --git a/test/distro/debian b/test/distro/debian index 4a19f95..5633c22 100644 --- a/test/distro/debian +++ b/test/distro/debian @@ -36,14 +36,14 @@ check [ __INIT_MSG__ = "from_ns" ] endef # Start passt, set common variables -hostb ./passt -P __PIDFILE__ & +hostb ./passt -s __STATEDIR__/passt.socket -P __PIDFILE__ & sleep 1 host echo test Debian GNU/Linux 8 (jessie), amd64 -host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none -drive file=__BASEPATH__/prepared-debian-8.11.0-openstack-amd64.qcow2,if=virtio -net socket,fd=5 -net nic,model=virtio -snapshot +host qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none -drive file=__BASEPATH__/prepared-debian-8.11.0-openstack-amd64.qcow2,if=virtio -device virtio-net-pci,netdev=s0 -netdev stream,id=s0,server=off,addr.type=unix,addr.path=__STATEDIR__/passt.socket -snapshot host PS1='$ ' sleep 2 host apt-get update @@ -64,7 +64,7 @@ hout PID cat __PIDFILE__ test Debian GNU/Linux 9 (stretch, oldoldstable), amd64 -host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-debian-9-nocloud-amd64-daily-20200210-166.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot +host qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-debian-9-nocloud-amd64-daily-20200210-166.qcow2 -device virtio-net-pci,netdev=s0 -netdev stream,id=s0,server=off,addr.type=unix,addr.path=__STATEDIR__/passt.socket -snapshot host PS1='$ ' sleep 2 host apt-get update @@ -82,7 +82,7 @@ sleep 1 test Debian GNU/Linux 10 (buster, oldstable), amd64 -host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-debian-10-nocloud-amd64.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot +host qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-debian-10-nocloud-amd64.qcow2 -device virtio-net-pci,netdev=s0 -netdev stream,id=s0,server=off,addr.type=unix,addr.path=__STATEDIR__/passt.socket -snapshot host PS1='$ ' sleep 2 host apt-get update @@ -100,7 +100,7 @@ sleep 1 test Debian GNU/Linux 10 (buster, oldstable), aarch64 -host ./qrap 5 qemu-system-aarch64 -m 2048 -cpu cortex-a57 -smp 2 -M virt -bios __BASEPATH__/QEMU_EFI.fd -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-debian-10-generic-arm64.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot +host qemu-system-aarch64 -m 2048 -cpu cortex-a57 -smp 2 -M virt -bios __BASEPATH__/QEMU_EFI.fd -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-debian-10-generic-arm64.qcow2 -device virtio-net-pci,netdev=s0 -netdev stream,id=s0,server=off,addr.type=unix,addr.path=__STATEDIR__/passt.socket -snapshot host PS1='$ ' sleep 2 host apt-get update @@ -118,7 +118,7 @@ sleep 1 test Debian GNU/Linux 10 (buster, oldstable), ppc64le -host ./qrap 5 qemu-system-ppc64 -m 2048 -smp 2 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-debian-10-generic-ppc64el.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot +host qemu-system-ppc64 -m 2048 -smp 2 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-debian-10-generic-ppc64el.qcow2 -device virtio-net-pci,netdev=s0 -netdev stream,id=s0,server=off,addr.type=unix,addr.path=__STATEDIR__/passt.socket -snapshot host PS1='$ ' sleep 2 host apt-get update @@ -137,7 +137,7 @@ hostb reset test Debian GNU/Linux 11 (bullseye, stable), amd64 -host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-debian-11-nocloud-amd64.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot +host qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-debian-11-nocloud-amd64.qcow2 -device virtio-net-pci,netdev=s0 -netdev stream,id=s0,server=off,addr.type=unix,addr.path=__STATEDIR__/passt.socket -snapshot sleep 2 host apt-get update host apt-get -y install make gcc socat @@ -153,7 +153,7 @@ sleep 1 test Debian GNU/Linux 11 (bullseye, stable), aarch64 -host ./qrap 5 qemu-system-aarch64 -m 2048 -cpu cortex-a57 -smp 2 -M virt -bios __BASEPATH__/QEMU_EFI.fd -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-debian-11-generic-arm64.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot +host qemu-system-aarch64 -m 2048 -cpu cortex-a57 -smp 2 -M virt -bios __BASEPATH__/QEMU_EFI.fd -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-debian-11-generic-arm64.qcow2 -device virtio-net-pci,netdev=s0 -netdev stream,id=s0,server=off,addr.type=unix,addr.path=__STATEDIR__/passt.socket -snapshot sleep 2 host apt-get update host apt-get -y install make gcc socat @@ -169,7 +169,7 @@ sleep 1 test Debian GNU/Linux 11 (bullseye, stable), ppc64le -host ./qrap 5 qemu-system-ppc64 -m 2048 -smp 2 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-debian-11-generic-ppc64el.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot +host qemu-system-ppc64 -m 2048 -smp 2 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-debian-11-generic-ppc64el.qcow2 -device virtio-net-pci,netdev=s0 -netdev stream,id=s0,server=off,addr.type=unix,addr.path=__STATEDIR__/passt.socket -snapshot sleep 2 host apt-get update host apt-get -y install make gcc socat @@ -193,7 +193,7 @@ hostb reset test Debian GNU/Linux sid (experimental), amd64 host qemu-img resize __BASEPATH__/prepared-debian-sid-nocloud-amd64-daily.qcow2 4G -host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-debian-sid-nocloud-amd64-daily.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot +host qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-debian-sid-nocloud-amd64-daily.qcow2 -device virtio-net-pci,netdev=s0 -netdev stream,id=s0,server=off,addr.type=unix,addr.path=__STATEDIR__/passt.socket -snapshot sleep 2 host growpart /dev/sda 1 host resize2fs -p /dev/sda1 @@ -213,7 +213,7 @@ sleep 1 test Debian GNU/Linux sid (experimental), aarch64 host qemu-img resize __BASEPATH__/prepared-debian-sid-nocloud-arm64-daily.qcow2 4G -host ./qrap 5 qemu-system-aarch64 -m 2048 -cpu cortex-a57 -smp 2 -M virt -bios __BASEPATH__/QEMU_EFI.fd -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-debian-sid-nocloud-arm64-daily.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot +host qemu-system-aarch64 -m 2048 -cpu cortex-a57 -smp 2 -M virt -bios __BASEPATH__/QEMU_EFI.fd -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-debian-sid-nocloud-arm64-daily.qcow2 -device virtio-net-pci,netdev=s0 -netdev stream,id=s0,server=off,addr.type=unix,addr.path=__STATEDIR__/passt.socket -snapshot sleep 2 host growpart /dev/vda 1 host resize2fs -p /dev/vda1 @@ -232,7 +232,7 @@ sleep 1 test Debian GNU/Linux sid (experimental), ppc64le -host ./qrap 5 qemu-system-ppc64 -m 2048 -smp 2 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-debian-sid-nocloud-ppc64el-daily.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot +host qemu-system-ppc64 -m 2048 -smp 2 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-debian-sid-nocloud-ppc64el-daily.qcow2 -device virtio-net-pci,netdev=s0 -netdev stream,id=s0,server=off,addr.type=unix,addr.path=__STATEDIR__/passt.socket -snapshot sleep 2 host export DEBIAN_FRONTEND=noninteractive host apt-get update diff --git a/test/distro/fedora b/test/distro/fedora index a8d3b51..73a53b5 100644 --- a/test/distro/fedora +++ b/test/distro/fedora @@ -56,13 +56,13 @@ check [ __INIT_MSG__ = "from_ns" ] endef # Start passt, set common variables -hostb ./passt -P __PIDFILE__ & +hostb ./passt -s __STATEDIR__/passt.socket -P __PIDFILE__ & sleep 1 host echo test Fedora 26, x86_64 -host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-Fedora-Cloud-Base-26-1.5.x86_64.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot +host qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-Fedora-Cloud-Base-26-1.5.x86_64.qcow2 -device virtio-net-pci,netdev=s0 -netdev stream,id=s0,server=off,addr.type=unix,addr.path=__STATEDIR__/passt.socket -snapshot host PS1='$ ' sleep 2 host yum -y install make gcc socat @@ -82,7 +82,7 @@ hout PID cat __PIDFILE__ test Fedora 27, x86_64 -host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-Fedora-Cloud-Base-27-1.6.x86_64.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot +host qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-Fedora-Cloud-Base-27-1.6.x86_64.qcow2 -device virtio-net-pci,netdev=s0 -netdev stream,id=s0,server=off,addr.type=unix,addr.path=__STATEDIR__/passt.socket -snapshot host PS1='$ ' sleep 2 host yum -y install make gcc socat @@ -99,7 +99,7 @@ sleep 1 test Fedora 28, x86_64 -host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-Fedora-Cloud-Base-28-1.1.x86_64.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot +host qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-Fedora-Cloud-Base-28-1.1.x86_64.qcow2 -device virtio-net-pci,netdev=s0 -netdev stream,id=s0,server=off,addr.type=unix,addr.path=__STATEDIR__/passt.socket -snapshot host PS1='$ ' sleep 2 host yum -y install make gcc socat @@ -116,7 +116,7 @@ sleep 1 test Fedora 28, aarch64 -host ./qrap 5 qemu-system-aarch64 -m 2048 -cpu cortex-a57 -smp 2 -M virt -bios __BASEPATH__/QEMU_EFI.fd -nodefaults -nographic -vga none -serial stdio __BASEPATH__/prepared-Fedora-Cloud-Base-28-1.1.aarch64.qcow2 -net socket,fd=5 -net nic,model=virtio -device virtio-rng-pci -snapshot +host qemu-system-aarch64 -m 2048 -cpu cortex-a57 -smp 2 -M virt -bios __BASEPATH__/QEMU_EFI.fd -nodefaults -nographic -vga none -serial stdio __BASEPATH__/prepared-Fedora-Cloud-Base-28-1.1.aarch64.qcow2 -device virtio-net-pci,netdev=s0 -netdev stream,id=s0,server=off,addr.type=unix,addr.path=__STATEDIR__/passt.socket -device virtio-rng-pci -snapshot host PS1='$ ' sleep 2 host yum -y install make gcc socat @@ -136,7 +136,7 @@ host echo test Fedora 29, x86_64 -host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-Fedora-Cloud-Base-29-1.2.x86_64.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot +host qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-Fedora-Cloud-Base-29-1.2.x86_64.qcow2 -device virtio-net-pci,netdev=s0 -netdev stream,id=s0,server=off,addr.type=unix,addr.path=__STATEDIR__/passt.socket -snapshot host PS1='$ ' sleep 2 host yum -y install make gcc socat @@ -153,7 +153,7 @@ sleep 1 test Fedora 29, aarch64 -host ./qrap 5 qemu-system-aarch64 -m 2048 -cpu cortex-a57 -smp 2 -M virt -bios __BASEPATH__/QEMU_EFI.fd -nodefaults -nographic -vga none -serial stdio __BASEPATH__/prepared-Fedora-Cloud-Base-29-1.2.aarch64.qcow2 -net socket,fd=5 -net nic,model=virtio -device virtio-rng-pci -snapshot +host qemu-system-aarch64 -m 2048 -cpu cortex-a57 -smp 2 -M virt -bios __BASEPATH__/QEMU_EFI.fd -nodefaults -nographic -vga none -serial stdio __BASEPATH__/prepared-Fedora-Cloud-Base-29-1.2.aarch64.qcow2 -device virtio-net-pci,netdev=s0 -netdev stream,id=s0,server=off,addr.type=unix,addr.path=__STATEDIR__/passt.socket -device virtio-rng-pci -snapshot host PS1='$ ' sleep 2 host yum -y install make gcc socat @@ -173,7 +173,7 @@ host echo test Fedora 30, x86_64 -host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-Fedora-Cloud-Base-30-1.2.x86_64.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot +host qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-Fedora-Cloud-Base-30-1.2.x86_64.qcow2 -device virtio-net-pci,netdev=s0 -netdev stream,id=s0,server=off,addr.type=unix,addr.path=__STATEDIR__/passt.socket -snapshot host PS1='$ ' sleep 2 host yum -y install make gcc socat @@ -190,7 +190,7 @@ sleep 1 test Fedora 30, aarch64 -host ./qrap 5 qemu-system-aarch64 -m 2048 -cpu cortex-a57 -smp 2 -M virt -bios __BASEPATH__/QEMU_EFI.fd -nodefaults -nographic -vga none -serial stdio __BASEPATH__/prepared-Fedora-Cloud-Base-30-1.2.aarch64.qcow2 -net socket,fd=5 -net nic,model=virtio -device virtio-rng-pci -snapshot +host qemu-system-aarch64 -m 2048 -cpu cortex-a57 -smp 2 -M virt -bios __BASEPATH__/QEMU_EFI.fd -nodefaults -nographic -vga none -serial stdio __BASEPATH__/prepared-Fedora-Cloud-Base-30-1.2.aarch64.qcow2 -device virtio-net-pci,netdev=s0 -netdev stream,id=s0,server=off,addr.type=unix,addr.path=__STATEDIR__/passt.socket -device virtio-rng-pci -snapshot host PS1='$ ' sleep 2 host yum -y install make gcc socat @@ -210,7 +210,7 @@ host echo test Fedora 31, x86_64 -host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-Fedora-Cloud-Base-31-1.9.x86_64.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot +host qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-Fedora-Cloud-Base-31-1.9.x86_64.qcow2 -device virtio-net-pci,netdev=s0 -netdev stream,id=s0,server=off,addr.type=unix,addr.path=__STATEDIR__/passt.socket -snapshot host PS1='$ ' sleep 2 host yum -y install make gcc socat @@ -227,7 +227,7 @@ sleep 1 test Fedora 31, aarch64 -host ./qrap 5 qemu-system-aarch64 -m 2048 -cpu cortex-a57 -smp 2 -M virt -bios __BASEPATH__/QEMU_EFI.fd -nodefaults -nographic -vga none -serial stdio __BASEPATH__/prepared-Fedora-Cloud-Base-31-1.9.aarch64.qcow2 -net socket,fd=5 -net nic,model=virtio -device virtio-rng-pci -snapshot +host qemu-system-aarch64 -m 2048 -cpu cortex-a57 -smp 2 -M virt -bios __BASEPATH__/QEMU_EFI.fd -nodefaults -nographic -vga none -serial stdio __BASEPATH__/prepared-Fedora-Cloud-Base-31-1.9.aarch64.qcow2 -device virtio-net-pci,netdev=s0 -netdev stream,id=s0,server=off,addr.type=unix,addr.path=__STATEDIR__/passt.socket -device virtio-rng-pci -snapshot host PS1='$ ' sleep 2 host yum -y install make gcc socat @@ -247,7 +247,7 @@ host echo test Fedora 32, x86_64 -host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-Fedora-Cloud-Base-32-1.6.x86_64.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot +host qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-Fedora-Cloud-Base-32-1.6.x86_64.qcow2 -device virtio-net-pci,netdev=s0 -netdev stream,id=s0,server=off,addr.type=unix,addr.path=__STATEDIR__/passt.socket -snapshot host PS1='$ ' sleep 2 host yum -y install make gcc socat @@ -264,7 +264,7 @@ sleep 1 test Fedora 32, aarch64 -host ./qrap 5 qemu-system-aarch64 -m 2048 -cpu cortex-a57 -smp 2 -M virt -bios __BASEPATH__/QEMU_EFI.fd -nodefaults -nographic -vga none -serial stdio __BASEPATH__/prepared-Fedora-Cloud-Base-32-1.6.aarch64.qcow2 -net socket,fd=5 -net nic,model=virtio -device virtio-rng-pci -snapshot +host qemu-system-aarch64 -m 2048 -cpu cortex-a57 -smp 2 -M virt -bios __BASEPATH__/QEMU_EFI.fd -nodefaults -nographic -vga none -serial stdio __BASEPATH__/prepared-Fedora-Cloud-Base-32-1.6.aarch64.qcow2 -device virtio-net-pci,netdev=s0 -netdev stream,id=s0,server=off,addr.type=unix,addr.path=__STATEDIR__/passt.socket -device virtio-rng-pci -snapshot host PS1='$ ' sleep 2 host yum -y install make gcc socat @@ -284,7 +284,7 @@ host echo test Fedora 33, x86_64 -host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-Fedora-Cloud-Base-33-1.2.x86_64.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot +host qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-Fedora-Cloud-Base-33-1.2.x86_64.qcow2 -device virtio-net-pci,netdev=s0 -netdev stream,id=s0,server=off,addr.type=unix,addr.path=__STATEDIR__/passt.socket -snapshot host PS1='$ ' sleep 2 host yum -y install make gcc socat @@ -301,7 +301,7 @@ sleep 1 test Fedora 33, aarch64 -host ./qrap 5 qemu-system-aarch64 -m 2048 -cpu cortex-a57 -smp 2 -M virt -bios __BASEPATH__/QEMU_EFI.fd -nodefaults -nographic -vga none -serial stdio __BASEPATH__/prepared-Fedora-Cloud-Base-33-1.2.aarch64.qcow2 -net socket,fd=5 -net nic,model=virtio -device virtio-rng-pci -snapshot +host qemu-system-aarch64 -m 2048 -cpu cortex-a57 -smp 2 -M virt -bios __BASEPATH__/QEMU_EFI.fd -nodefaults -nographic -vga none -serial stdio __BASEPATH__/prepared-Fedora-Cloud-Base-33-1.2.aarch64.qcow2 -device virtio-net-pci,netdev=s0 -netdev stream,id=s0,server=off,addr.type=unix,addr.path=__STATEDIR__/passt.socket -device virtio-rng-pci -snapshot host PS1='$ ' sleep 2 host yum -y install make gcc socat @@ -321,7 +321,7 @@ host echo test Fedora 34, x86_64 -host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-Fedora-Cloud-Base-34-1.2.x86_64.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot +host qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-Fedora-Cloud-Base-34-1.2.x86_64.qcow2 -device virtio-net-pci,netdev=s0 -netdev stream,id=s0,server=off,addr.type=unix,addr.path=__STATEDIR__/passt.socket -snapshot host PS1='$ ' sleep 2 host yum -y install make gcc socat @@ -338,7 +338,7 @@ sleep 1 test Fedora 34, aarch64 -host ./qrap 5 qemu-system-aarch64 -m 2048 -cpu cortex-a57 -smp 2 -M virt -bios __BASEPATH__/QEMU_EFI.fd -nodefaults -nographic -vga none -serial stdio __BASEPATH__/prepared-Fedora-Cloud-Base-34-1.2.aarch64.qcow2 -net socket,fd=5 -net nic,model=virtio -device virtio-rng-pci -snapshot +host qemu-system-aarch64 -m 2048 -cpu cortex-a57 -smp 2 -M virt -bios __BASEPATH__/QEMU_EFI.fd -nodefaults -nographic -vga none -serial stdio __BASEPATH__/prepared-Fedora-Cloud-Base-34-1.2.aarch64.qcow2 -device virtio-net-pci,netdev=s0 -netdev stream,id=s0,server=off,addr.type=unix,addr.path=__STATEDIR__/passt.socket -device virtio-rng-pci -snapshot host PS1='$ ' sleep 2 host yum -y install make gcc socat @@ -358,7 +358,7 @@ host echo test Fedora 35, x86_64 -host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-Fedora-Cloud-Base-35-1.2.x86_64.qcow2 -net socket,fd=5 -net nic,model=virtio -snapshot +host qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __BASEPATH__/prepared-Fedora-Cloud-Base-35-1.2.x86_64.qcow2 -device virtio-net-pci,netdev=s0 -netdev stream,id=s0,server=off,addr.type=unix,addr.path=__STATEDIR__/passt.socket -snapshot host PS1='$ ' sleep 2 host yum -y install make gcc socat @@ -375,7 +375,7 @@ sleep 1 test Fedora 35, aarch64 -host ./qrap 5 qemu-system-aarch64 -m 2048 -cpu cortex-a57 -smp 2 -M virt -bios __BASEPATH__/QEMU_EFI.fd -nodefaults -nographic -vga none -serial stdio __BASEPATH__/prepared-Fedora-Cloud-Base-35-1.2.aarch64.qcow2 -net socket,fd=5 -net nic,model=virtio -device virtio-rng-pci -snapshot +host qemu-system-aarch64 -m 2048 -cpu cortex-a57 -smp 2 -M virt -bios __BASEPATH__/QEMU_EFI.fd -nodefaults -nographic -vga none -serial stdio __BASEPATH__/prepared-Fedora-Cloud-Base-35-1.2.aarch64.qcow2 -device virtio-net-pci,netdev=s0 -netdev stream,id=s0,server=off,addr.type=unix,addr.path=__STATEDIR__/passt.socket -device virtio-rng-pci -snapshot host PS1='$ ' sleep 2 host yum -y install make gcc socat diff --git a/test/distro/opensuse b/test/distro/opensuse index 314870f..03d1406 100644 --- a/test/distro/opensuse +++ b/test/distro/opensuse @@ -35,7 +35,7 @@ check [ __INIT_MSG__ = "from_ns" ] endef # Start passt, set common variables -hostb ./passt -P __PIDFILE__ & +hostb ./passt -s __STATEDIR__/passt.socket -P __PIDFILE__ & sleep 1 host echo hout DNS6 sed -n 's/^nameserver \([^:]*:\)\([^%]*\).*/\1\2/p' /etc/resolv.conf | head -1 @@ -51,7 +51,7 @@ host guestfish --rw -a __IMG__ -i rm /etc/systemd/system/default.target.wants/je host virt-edit -a __IMG__ /etc/systemd/system/getty.target.wants/getty(a)tty1.service -e 's/ExecStart=.*/ExecStart=\/sbin\/agetty --timeout 5000 --autologin root -i -8 --keep-baud 115200,38400,9600 ttyS0 $TERM/g' host guestfish --rw -a __IMG__ -i copy-in __GUEST_FILES__ /root/ -host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __IMG__ -net socket,fd=5 -net nic,model=virtio +host qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __IMG__ -device virtio-net-pci,netdev=s0 -netdev stream,id=s0,server=off,addr.type=unix,addr.path=__STATEDIR__/passt.socket host PS1='$ ' host ip link set eth0 up sleep 2 @@ -80,7 +80,7 @@ host guestfish --rw -a __IMG__ -i rm /etc/systemd/system/default.target.wants/je host virt-edit -a __IMG__ /etc/systemd/system/getty.target.wants/getty(a)tty1.service -e 's/ExecStart=.*/ExecStart=\/sbin\/agetty --timeout 5000 --autologin root -i -8 --keep-baud 115200,38400,9600 ttyS0 $TERM/g' host guestfish --rw -a __IMG__ -i copy-in __GUEST_FILES__ /root/ -host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __IMG__ -net socket,fd=5 -net nic,model=virtio +host qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __IMG__ -device virtio-net-pci,netdev=s0 -netdev stream,id=s0,server=off,addr.type=unix,addr.path=__STATEDIR__/passt.socket host PS1='$ ' host ip link set eth0 up sleep 2 @@ -106,7 +106,7 @@ host guestfish --rw -a __IMG__ -i rm /etc/systemd/system/default.target.wants/je host virt-edit -a __IMG__ /etc/systemd/system/getty.target.wants/getty(a)tty1.service -e 's/ExecStart=.*/ExecStart=\/sbin\/agetty --timeout 5000 --autologin root -i -8 --keep-baud 115200,38400,9600 ttyS0 $TERM/g' host guestfish --rw -a __IMG__ -i copy-in __GUEST_FILES__ /root/ -host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __IMG__ -net socket,fd=5 -net nic,model=virtio +host qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __IMG__ -device virtio-net-pci,netdev=s0 -netdev stream,id=s0,server=off,addr.type=unix,addr.path=__STATEDIR__/passt.socket # Multiple prompt logins might come up here sleep 10 host PS1='$ ' @@ -132,7 +132,7 @@ host xzcat __BASEPATH__/openSUSE-Tumbleweed-ARM-JeOS-efi.aarch64.raw.xz > __IMG_ host virt-edit -a __IMG__ -m /dev/sda3 /usr/lib/systemd/system/serial-getty@.service -e 's/ExecStart=.*/ExecStart=\/sbin\/agetty --timeout 5000 --autologin root -i -8 --keep-baud 115200,38400,9600 %I $TERM/g' host guestfish --rw -a __IMG__ -i copy-in __GUEST_FILES__ /root/ -host ./qrap 5 qemu-system-aarch64 -m 2048 -cpu cortex-a57 -smp 2 -M virt -bios __BASEPATH__/QEMU_EFI.fd -nodefaults -nographic -vga none -serial stdio __IMG__ -net socket,fd=5 -net nic,model=virtio +host qemu-system-aarch64 -m 2048 -cpu cortex-a57 -smp 2 -M virt -bios __BASEPATH__/QEMU_EFI.fd -nodefaults -nographic -vga none -serial stdio __IMG__ -device virtio-net-pci,netdev=s0 -netdev stream,id=s0,server=off,addr.type=unix,addr.path=__STATEDIR__/passt.socket host PS1='$ ' host ip link set enp0s1 up sleep 10 @@ -161,7 +161,7 @@ host guestfish -a __IMG__ -i download /boot/initrd __INITRD__ host virt-edit -a __IMG__ -m /dev/sda3 /usr/lib/systemd/system/serial-getty@.service -e 's/ExecStart=.*/ExecStart=\/sbin\/agetty --timeout 5000 --autologin root -i -8 --keep-baud 115200,38400,9600 %I $TERM/g' host guestfish --rw -a __IMG__ -i copy-in __GUEST_FILES__ /root/ -host ./qrap 5 qemu-system-arm -M virt -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none -kernel __ZIMAGE__ -initrd __INITRD__ -append 'root=/dev/sda3' -drive if=none,file=__IMG__,format=raw,id=hd,media=disk -device virtio-scsi-device -device scsi-hd,drive=hd -netdev socket,fd=5,id=passt -device virtio-net-device,netdev=passt +host qemu-system-arm -M virt -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none -kernel __ZIMAGE__ -initrd __INITRD__ -append 'root=/dev/sda3' -drive if=none,file=__IMG__,format=raw,id=hd,media=disk -device virtio-scsi-device -device scsi-hd,drive=hd -netdev socket,fd=5,id=passt -device virtio-net-device,netdev=passt host PS1='$ ' host ip link set eth0 up sleep 10 @@ -188,7 +188,7 @@ host guestfish --rw -a __IMG__ -i rm /usr/lib/systemd/system/serial-getty@.servi host virt-edit -a __IMG__ /etc/systemd/system/getty.target.wants/getty(a)tty1.service -e 's/ExecStart=.*/ExecStart=\/sbin\/agetty --timeout 5000 --autologin root -i -8 --keep-baud 115200,38400,9600 ttyS0 $TERM/g' host guestfish --rw -a __IMG__ -i copy-in __GUEST_FILES__ /root/ -host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __IMG__ -net socket,fd=5 -net nic,model=virtio +host qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __IMG__ -device virtio-net-pci,netdev=s0 -netdev stream,id=s0,server=off,addr.type=unix,addr.path=__STATEDIR__/passt.socket host PS1='$ ' host ip link set ens2 up sleep 2 diff --git a/test/distro/ubuntu b/test/distro/ubuntu index 343fa03..2f0dbdc 100644 --- a/test/distro/ubuntu +++ b/test/distro/ubuntu @@ -60,7 +60,7 @@ host r=10; while [ \${r} -gt 0 ]; do host ubuntu.com && break; sleep 5; r=\$((r endef # Start passt, set common variables -hostb ./passt -P __PIDFILE__ & +hostb ./passt -s __STATEDIR__/passt.socket -P __PIDFILE__ & sleep 1 host echo hout GUEST_FILES ls -1 *.c *.h *.sh passt.1 qrap.1 Makefile README.md | tr '\n' ' '; echo @@ -80,7 +80,7 @@ host guestfish --rw -a __IMG__ -i rm /etc/init/cloud-init.conf host guestfish --rw -a __IMG__ -i rm /etc/init/cloud-log-shutdown.conf host guestfish --rw -a __IMG__ -i copy-in __GUEST_FILES__ /root/ -host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none -drive file=__IMG__,if=virtio -net socket,fd=5 -net nic,model=virtio +host qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none -drive file=__IMG__,if=virtio -device virtio-net-pci,netdev=s0 -netdev stream,id=s0,server=off,addr.type=unix,addr.path=__STATEDIR__/passt.socket host PS1='$ ' sleep 2 host apt-get update @@ -113,7 +113,7 @@ host guestfish --rw -a __IMG__ -i rm /etc/init/cloud-init.conf host guestfish --rw -a __IMG__ -i rm /etc/init/cloud-log-shutdown.conf host guestfish --rw -a __IMG__ -i copy-in __GUEST_FILES__ /root/ -host ./qrap 5 qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none -drive file=__IMG__,if=virtio -net socket,fd=5 -net nic,model=virtio +host qemu-system-x86_64 -M pc,accel=kvm:tcg -m 1024 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none -drive file=__IMG__,if=virtio -device virtio-net-pci,netdev=s0 -netdev stream,id=s0,server=off,addr.type=unix,addr.path=__STATEDIR__/passt.socket host PS1='$ ' sleep 2 host apt-get update @@ -143,7 +143,7 @@ host guestfish --rw -a __IMG__ -i rm /etc/init/cloud-init.conf host guestfish --rw -a __IMG__ -i rm /etc/init/cloud-log-shutdown.conf host guestfish --rw -a __IMG__ -i copy-in __GUEST_FILES__ /root/ -host ./qrap 5 qemu-system-ppc64 -m 2048 -smp 2 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __IMG__ -net socket,fd=5 -net nic,model=virtio +host qemu-system-ppc64 -m 2048 -smp 2 -nographic -serial stdio -nodefaults -no-reboot -nographic -vga none __IMG__ -device virtio-net-pci,netdev=s0 -netdev stream,id=s0,server=off,addr.type=unix,addr.path=__STATEDIR__/passt.socket host PS1='$ ' sleep 2 host apt-get update @@ -164,7 +164,7 @@ host echo test Ubuntu 16.04 LTS (Xenial Xerus), ppc64 (be) -host ./qrap 5 qemu-system-ppc64 -m 1024 -M pseries -nographic -nodefaults -serial stdio -no-reboot -nographic -vga none -hda __BASEPATH__/prepared-xenial-server-cloudimg-powerpc-disk1.img -net socket,fd=5 -net nic,model=virtio -snapshot +host qemu-system-ppc64 -m 1024 -M pseries -nographic -nodefaults -serial stdio -no-reboot -nographic -vga none -hda __BASEPATH__/prepared-xenial-server-cloudimg-powerpc-disk1.img -device virtio-net-pci,netdev=s0 -netdev stream,id=s0,server=off,addr.type=unix,addr.path=__STATEDIR__/passt.socket -snapshot host PS1='$ ' host dhclient -4 # Skip apt-get update here: some updates to xenial-updates around 2022-01-30 @@ -188,7 +188,7 @@ host echo test Ubuntu 22.04 (Jammy Jellyfish), s390x -host ./qrap 5 qemu-system-s390x -m 2048 -smp 2 -serial stdio -nodefaults -nographic __BASEPATH__/prepared-jammy-server-cloudimg-s390x.img -net socket,fd=5 -net nic,model=virtio -device virtio-rng-ccw -snapshot +host qemu-system-s390x -m 2048 -smp 2 -serial stdio -nodefaults -nographic __BASEPATH__/prepared-jammy-server-cloudimg-s390x.img -device virtio-net-pci,netdev=s0 -netdev stream,id=s0,server=off,addr.type=unix,addr.path=__STATEDIR__/passt.socket -device virtio-rng-ccw -snapshot host export DEBIAN_FRONTEND=noninteractive host service systemd-networkd stop diff --git a/test/lib/setup b/test/lib/setup index 07d5056..5f8ce26 100755 --- a/test/lib/setup +++ b/test/lib/setup @@ -48,22 +48,21 @@ setup_passt() { context_run passt "make clean" context_run passt "make valgrind" - context_run_bg passt "valgrind --max-stackframe=$((4 * 1024 * 1024)) --trace-children=yes --vgdb=no --error-exitcode=1 --suppressions=test/valgrind.supp ./passt ${__opts} -f -t 10001 -u 10001 -P ${STATESETUP}/passt.pid" + context_run_bg passt "valgrind --max-stackframe=$((4 * 1024 * 1024)) --trace-children=yes --vgdb=no --error-exitcode=1 --suppressions=test/valgrind.supp ./passt ${__opts} -s ${STATESETUP}/passt.socket -f -t 10001 -u 10001 -P ${STATESETUP}/passt.pid" # pidfile isn't created until passt is listening wait_for [ -f "${STATESETUP}/passt.pid" ] GUEST_CID=94557 - context_run_bg qemu './qrap 5 qemu-system-$(uname -m)' \ + context_run_bg qemu 'qemu-system-$(uname -m)' \ ' -machine accel=kvm' \ ' -m '${VMEM}' -cpu host -smp '${VCPUS} \ ' -kernel ' "/boot/vmlinuz-$(uname -r)" \ ' -initrd '${INITRAMFS}' -nographic -serial stdio' \ ' -nodefaults' \ - ' -append "console=ttyS0 mitigations=off apparmor=0 ' \ - 'virtio-net.napi_tx=1"' \ - " -device virtio-net-pci,netdev=hostnet0,x-txburst=16384" \ - " -netdev socket,fd=5,id=hostnet0" \ + ' -append "console=ttyS0 mitigations=off apparmor=0" ' \ + ' -device virtio-net-pci,netdev=s0 ' \ + " -netdev stream,id=s0,server=off,addr.type=unix,addr.path=${STATESETUP}/passt.socket " \ " -pidfile ${STATESETUP}/qemu.pid" \ " -device vhost-vsock-pci,guest-cid=$GUEST_CID" @@ -143,26 +142,25 @@ setup_passt_in_ns() { if [ ${VALGRIND} -eq 1 ]; then context_run passt "make clean" context_run passt "make valgrind" - context_run_bg passt "valgrind --max-stackframe=$((4 * 1024 * 1024)) --trace-children=yes --vgdb=no --error-exitcode=1 --suppressions=test/valgrind.supp ./passt -f ${__opts} -t 10001,10011,10021,10031 -u 10001,10011,10021,10031 -P ${STATESETUP}/passt.pid" + context_run_bg passt "valgrind --max-stackframe=$((4 * 1024 * 1024)) --trace-children=yes --vgdb=no --error-exitcode=1 --suppressions=test/valgrind.supp ./passt -f ${__opts} -s ${STATESETUP}/passt.socket -t 10001,10011,10021,10031 -u 10001,10011,10021,10031 -P ${STATESETUP}/passt.pid" else context_run passt "make clean" context_run passt "make" - context_run_bg passt "./passt -f ${__opts} -t 10001,10011,10021,10031 -u 10001,10011,10021,10031 -P ${STATESETUP}/passt.pid" + context_run_bg passt "./passt -f ${__opts} -s ${STATESETUP}/passt.socket -t 10001,10011,10021,10031 -u 10001,10011,10021,10031 -P ${STATESETUP}/passt.pid" fi wait_for [ -f "${STATESETUP}/passt.pid" ] GUEST_CID=94557 - context_run_bg qemu './qrap 5 qemu-system-$(uname -m)' \ + context_run_bg qemu 'qemu-system-$(uname -m)' \ ' -machine accel=kvm' \ ' -M accel=kvm:tcg' \ ' -m '${VMEM}' -cpu host -smp '${VCPUS} \ ' -kernel ' "/boot/vmlinuz-$(uname -r)" \ ' -initrd '${INITRAMFS}' -nographic -serial stdio' \ ' -nodefaults' \ - ' -append "console=ttyS0 mitigations=off apparmor=0 ' \ - 'virtio-net.napi_tx=1"' \ - " -device virtio-net-pci,netdev=hostnet0,x-txburst=524288" \ - " -netdev socket,fd=5,id=hostnet0" \ + ' -append "console=ttyS0 mitigations=off apparmor=0" ' \ + ' -device virtio-net-pci,netdev=s0 ' \ + " -netdev stream,id=s0,server=off,addr.type=unix,addr.path=${STATESETUP}/passt.socket " \ " -pidfile ${STATESETUP}/qemu.pid" \ " -device vhost-vsock-pci,guest-cid=$GUEST_CID" @@ -191,7 +189,7 @@ setup_two_guests() { [ ${PCAP} -eq 1 ] && __opts="${__opts} -p ${LOGDIR}/pasta_1.pcap" [ ${DEBUG} -eq 1 ] && __opts="${__opts} -d" [ ${TRACE} -eq 1 ] && __opts="${__opts} --trace" - context_run_bg pasta_1 "./pasta ${__opts} -P ${STATESETUP}/pasta_1.pid -t 10001,10002 -T 10003,10004 -u 10001,10002 -U 10003,10004 --config-net ${NSHOLDER} ${STATESETUP}/ns1.hold hold" + context_run_bg pasta_1 "./pasta ${__opts} --trace -l /tmp/pasta1.log -P ${STATESETUP}/pasta_1.pid -t 10001,10002 -T 10003,10004 -u 10001,10002 -U 10003,10004 --config-net ${NSHOLDER} ${STATESETUP}/ns1.hold hold" __ns1_pid=$(${NSHOLDER} ${STATESETUP}/ns1.hold pid) context_setup_nsenter passt_1 -U -n -p --preserve-credentials -t ${__ns1_pid} @@ -199,7 +197,7 @@ setup_two_guests() { [ ${PCAP} -eq 1 ] && __opts="${__opts} -p ${LOGDIR}/pasta_2.pcap" [ ${DEBUG} -eq 1 ] && __opts="${__opts} -d" [ ${TRACE} -eq 1 ] && __opts="${__opts} --trace" - context_run_bg pasta_2 "./pasta ${__opts} -P ${STATESETUP}/pasta_2.pid -t 10004,10005 -T 10003,10001 -u 10004,10005 -U 10003,10001 --config-net ${NSHOLDER} ${STATESETUP}/ns2.hold hold" + context_run_bg pasta_2 "./pasta ${__opts} --trace -l /tmp/pasta2.log -P ${STATESETUP}/pasta_2.pid -t 10004,10005 -T 10003,10001 -u 10004,10005 -U 10003,10001 --config-net ${NSHOLDER} ${STATESETUP}/ns2.hold hold" __ns2_pid=$(${NSHOLDER} ${STATESETUP}/ns2.hold pid) context_setup_nsenter passt_2 -U -n -p --preserve-credentials -t ${__ns2_pid} @@ -215,7 +213,7 @@ setup_two_guests() { [ ${DEBUG} -eq 1 ] && __opts="${__opts} -d" [ ${TRACE} -eq 1 ] && __opts="${__opts} --trace" - context_run_bg passt_1 "./passt -P ${STATESETUP}/passt_1.pid -f ${__opts} -t 10001 -u 10001" + context_run_bg passt_1 "./passt -s ${STATESETUP}/passt_1.socket -P ${STATESETUP}/passt_1.pid -f ${__opts} -t 10001 -u 10001" wait_for [ -f "${STATESETUP}/passt_1.pid" ] __opts= @@ -223,34 +221,32 @@ setup_two_guests() { [ ${DEBUG} -eq 1 ] && __opts="${__opts} -d" [ ${TRACE} -eq 1 ] && __opts="${__opts} --trace" - context_run_bg passt_2 "./passt -P ${STATESETUP}/passt_2.pid -f ${__opts} -t 10004 -u 10004" + context_run_bg passt_2 "./passt -s ${STATESETUP}/passt_2.socket -P ${STATESETUP}/passt_2.pid -f ${__opts} -t 10004 -u 10004" wait_for [ -f "${STATESETUP}/passt_2.pid" ] GUEST_1_CID=94557 - context_run_bg qemu_1 './qrap 5 qemu-system-$(uname -m)' \ + context_run_bg qemu_1 'qemu-system-$(uname -m)' \ ' -M accel=kvm:tcg' \ ' -m '${VMEM}' -cpu host -smp '${VCPUS} \ ' -kernel ' "/boot/vmlinuz-$(uname -r)" \ ' -initrd '${INITRAMFS}' -nographic -serial stdio' \ ' -nodefaults' \ - ' -append "console=ttyS0 mitigations=off apparmor=0 ' \ - 'virtio-net.napi_tx=1"' \ - " -device virtio-net-pci,netdev=hostnet0,x-txburst=16384" \ - " -netdev socket,fd=5,id=hostnet0" \ + ' -append "console=ttyS0 mitigations=off apparmor=0" ' \ + ' -device virtio-net-pci,netdev=s0 ' \ + " -netdev stream,id=s0,server=off,addr.type=unix,addr.path=${STATESETUP}/passt_1.socket " \ " -pidfile ${STATESETUP}/qemu_1.pid" \ " -device vhost-vsock-pci,guest-cid=$GUEST_1_CID" GUEST_2_CID=94558 - context_run_bg qemu_2 './qrap 5 qemu-system-$(uname -m)' \ + context_run_bg qemu_2 'qemu-system-$(uname -m)' \ ' -M accel=kvm:tcg' \ ' -m '${VMEM}' -cpu host -smp '${VCPUS} \ ' -kernel ' "/boot/vmlinuz-$(uname -r)" \ ' -initrd '${INITRAMFS}' -nographic -serial stdio' \ ' -nodefaults' \ - ' -append "console=ttyS0 mitigations=off apparmor=0 ' \ - 'virtio-net.napi_tx=1"' \ - " -device virtio-net-pci,netdev=hostnet0,x-txburst=16384" \ - " -netdev socket,fd=5,id=hostnet0" \ + ' -append "console=ttyS0 mitigations=off apparmor=0" ' \ + ' -device virtio-net-pci,netdev=s0 ' \ + " -netdev stream,id=s0,server=off,addr.type=unix,addr.path=${STATESETUP}/passt_2.socket " \ " -pidfile ${STATESETUP}/qemu_2.pid" \ " -device vhost-vsock-pci,guest-cid=$GUEST_2_CID" -- 2.35.1
Now that we require 13c6be96618c ("net: stream: add unix socket") in qemu to run the tests, we can also assume that commit df8d07081718 ("virtio-net: fix bottom-half packet TX on asynchronous completion") is present, as it was merged before that one. This fixes the issue we attempted to work around in passt TCP and UDP performance tests: finally drop that stuff. Signed-off-by: Stefano Brivio <sbrivio(a)redhat.com> --- test/perf/passt_tcp | 15 --------------- test/perf/passt_udp | 15 --------------- 2 files changed, 30 deletions(-) diff --git a/test/perf/passt_tcp b/test/perf/passt_tcp index 8b912c4..3338f14 100644 --- a/test/perf/passt_tcp +++ b/test/perf/passt_tcp @@ -15,11 +15,6 @@ gtools /sbin/sysctl ip jq nproc seq sleep iperf3 tcp_rr tcp_crr # From neper nstools /sbin/sysctl ip jq nproc seq sleep iperf3 tcp_rr tcp_crr htools bc head sed seq -# In this setup, virtio_net TX queue sometimes hangs, still under investigation -def virtio_net_workaround -guest modprobe -r virtio_net; modprobe virtio_net napi_tx=1; ip link set dev eth0 up; dhclient -4; dhclient -6; sleep 3 -endef - test passt: throughput and latency guest /sbin/sysctl -w net.core.rmem_max=536870912 @@ -58,19 +53,15 @@ tr TCP throughput over IPv6: guest to host bw - bw - -virtio_net_workaround guest ip link set dev __IFNAME__ mtu 1280 iperf3 BW guest ns __GW6__%__IFNAME__ 100${i}2 __THREADS__ __TIME__ __OPTS__ -w 4M bw __BW__ 1.2 1.5 -virtio_net_workaround guest ip link set dev __IFNAME__ mtu 1500 iperf3 BW guest ns __GW6__%__IFNAME__ 100${i}2 __THREADS__ __TIME__ __OPTS__ -w 4M bw __BW__ 1.6 1.8 -virtio_net_workaround guest ip link set dev __IFNAME__ mtu 9000 iperf3 BW guest ns __GW6__%__IFNAME__ 100${i}2 __THREADS__ __TIME__ __OPTS__ -w 8M bw __BW__ 4.0 5.0 -virtio_net_workaround guest ip link set dev __IFNAME__ mtu 65520 iperf3 BW guest ns __GW6__%__IFNAME__ 100${i}2 __THREADS__ __TIME__ __OPTS__ -w 16M bw __BW__ 7.0 8.0 @@ -97,27 +88,21 @@ lat __LAT__ 500 400 tr TCP throughput over IPv4: guest to host -virtio_net_workaround guest ip link set dev __IFNAME__ mtu 256 iperf3 BW guest ns __GW__ 100${i}2 __THREADS__ __TIME__ __OPTS__ -w 1M bw __BW__ 0.2 0.3 -virtio_net_workaround guest ip link set dev __IFNAME__ mtu 576 iperf3 BW guest ns __GW__ 100${i}2 __THREADS__ __TIME__ __OPTS__ -w 1M bw __BW__ 0.5 0.8 -virtio_net_workaround guest ip link set dev __IFNAME__ mtu 1280 iperf3 BW guest ns __GW__ 100${i}2 __THREADS__ __TIME__ __OPTS__ -w 4M bw __BW__ 1.2 1.5 -virtio_net_workaround guest ip link set dev __IFNAME__ mtu 1500 iperf3 BW guest ns __GW__ 100${i}2 __THREADS__ __TIME__ __OPTS__ -w 4M bw __BW__ 1.6 1.8 -virtio_net_workaround guest ip link set dev __IFNAME__ mtu 9000 iperf3 BW guest ns __GW__ 100${i}2 __THREADS__ __TIME__ __OPTS__ -w 8M bw __BW__ 4.0 5.0 -virtio_net_workaround guest ip link set dev __IFNAME__ mtu 65520 iperf3 BW guest ns __GW__ 100${i}2 __THREADS__ __TIME__ __OPTS__ -w 16M bw __BW__ 7.0 8.0 diff --git a/test/perf/passt_udp b/test/perf/passt_udp index 3ad630e..0cfb669 100644 --- a/test/perf/passt_udp +++ b/test/perf/passt_udp @@ -15,11 +15,6 @@ gtools /sbin/sysctl ip jq nproc sleep iperf3 udp_rr # From neper nstools ip jq sleep iperf3 udp_rr htools bc head sed -# In this setup, virtio_net TX queue sometimes hangs, still under investigation -def virtio_net_workaround -guest modprobe -r virtio_net; modprobe virtio_net napi_tx=1; ip link set dev eth0 up; dhclient -4; dhclient -6; sleep 3 -endef - test passt: throughput and latency guest /sbin/sysctl -w net.core.rmem_max=16777216 @@ -50,19 +45,15 @@ th MTU 256B 576B 1280B 1500B 9000B 65520B tr UDP throughput over IPv6: guest to host bw - bw - -virtio_net_workaround guest ip link set dev __IFNAME__ mtu 1280 iperf3 BW guest ns __GW6__%__IFNAME__ 100${i}2 __THREADS__ __TIME__ __OPTS__ -b 2G bw __BW__ 0.8 1.2 -virtio_net_workaround guest ip link set dev __IFNAME__ mtu 1500 iperf3 BW guest ns __GW6__%__IFNAME__ 100${i}2 __THREADS__ __TIME__ __OPTS__ -b 3G bw __BW__ 1.0 1.5 -virtio_net_workaround guest ip link set dev __IFNAME__ mtu 9000 iperf3 BW guest ns __GW6__%__IFNAME__ 100${i}2 __THREADS__ __TIME__ __OPTS__ -b 5G bw __BW__ 4.0 5.0 -virtio_net_workaround guest ip link set dev __IFNAME__ mtu 65520 iperf3 BW guest ns __GW6__%__IFNAME__ 100${i}2 __THREADS__ __TIME__ __OPTS__ -b 7G bw __BW__ 4.0 5.0 @@ -79,27 +70,21 @@ lat __LAT__ 200 150 tr UDP throughput over IPv4: guest to host -virtio_net_workaround guest ip link set dev __IFNAME__ mtu 256 iperf3 BW guest ns __GW__ 100${i}2 __THREADS__ __TIME__ __OPTS__ -b 500M bw __BW__ 0.0 0.0 -virtio_net_workaround guest ip link set dev __IFNAME__ mtu 576 iperf3 BW guest ns __GW__ 100${i}2 __THREADS__ __TIME__ __OPTS__ -b 1G bw __BW__ 0.4 0.6 -virtio_net_workaround guest ip link set dev __IFNAME__ mtu 1280 iperf3 BW guest ns __GW__ 100${i}2 __THREADS__ __TIME__ __OPTS__ -b 2G bw __BW__ 0.8 1.2 -virtio_net_workaround guest ip link set dev __IFNAME__ mtu 1500 iperf3 BW guest ns __GW__ 100${i}2 __THREADS__ __TIME__ __OPTS__ -b 3G bw __BW__ 1.0 1.5 -virtio_net_workaround guest ip link set dev __IFNAME__ mtu 9000 iperf3 BW guest ns __GW__ 100${i}2 __THREADS__ __TIME__ __OPTS__ -b 6G bw __BW__ 4.0 5.0 -virtio_net_workaround guest ip link set dev __IFNAME__ mtu 65520 iperf3 BW guest ns __GW__ 100${i}2 __THREADS__ __TIME__ __OPTS__ -b 7G bw __BW__ 4.0 5.0 -- 2.35.1
We can't get rid of qrap quite yet, but at least we should start telling users it's not going to be needed anymore starting from qemu 7.2. Signed-off-by: Stefano Brivio <sbrivio(a)redhat.com> --- README.md | 10 ++++------ passt.1 | 8 ++------ qrap.1 | 13 +++++-------- qrap.c | 5 +++-- tap.c | 10 ++++------ 5 files changed, 18 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index e1df972..0e2ca78 100644 --- a/README.md +++ b/README.md @@ -368,13 +368,11 @@ speeding up local connections, and usually requiring NAT. _pasta_: ## Interfaces and Environment _passt_ exchanges packets with _qemu_ via UNIX domain socket, using the `socket` -back-end in qemu. Currently, qemu can only connect to a listening process via -TCP. Two temporary solutions are available: +back-end in qemu. This is supported since qemu 7.2. -* a [patch](/passt/tree/qemu) for qemu -* a wrapper, [qrap](/passt/tree/qrap.c), that connects to a - UNIX domain socket and starts qemu, which can now use the file descriptor - that's already opened +For older versions, the [qrap](/passt/tree/qrap.c) wrapper can be used to +connect to a UNIX domain socket and to start qemu, which can now use the file +descriptor that's already opened. This approach, compared to using a _tap_ device, doesn't require any security capabilities, as we don't need to create any interface. diff --git a/passt.1 b/passt.1 index 2c93907..e34a3e0 100644 --- a/passt.1 +++ b/passt.1 @@ -51,12 +51,8 @@ one peer's observed parameters (congestion window size, acknowledged data, etc.) to the corresponding peer. Currently, the only supported hypervisor is \fBqemu\fR(1), connecting to -\fBpasst\fR by means of a UNIX domain socket. This configuration can be obtained -via out-of-tree qemu patches, available at: - - \fIhttps://passt.top/passt/tree/contrib/qemu\fR - -or with the \fBqrap\fR(1) wrapper. +\fBpasst\fR by means of a UNIX domain socket. This is supported starting from +qemu 7.2. For older qemu versions, see the \fBqrap\fR(1) wrapper. .SS pasta diff --git a/qrap.1 b/qrap.1 index cc73f1e..5246e1b 100644 --- a/qrap.1 +++ b/qrap.1 @@ -5,7 +5,7 @@ .SH NAME .B qrap -\- qemu wrapper connecting UNIX domain socket to file descriptor +\- temporary qemu wrapper connecting UNIX domain socket to file descriptor .SH SYNOPSIS .B qrap @@ -47,13 +47,10 @@ $ ./qrap test.qcow2 -m 1024 -display none -nodefaults -nographic .SH NOTES -This wrapper is temporary and needed only as long as \fBqemu\fR(1) does not -directly support a UNIX domain socket as \fInetdev\fR back-end. - -Out-of-tree patches for \fBqemu\fR(1) introducing support for a UNIX domain -socket back-end are available at: - - \fIhttps://passt.top/passt/tree/contrib/qemu\fR +This wrapper is temporary: qemu commit 13c6be96618c ("net: stream: add unix +socket") introduces native AF_UNIX socket support, and it should be included in +qemu starting from the 7.2 release. It will be around for a little bit longer to +give users enough time to switch. .SH AUTHOR diff --git a/qrap.c b/qrap.c index 3c6f5b8..287198e 100644 --- a/qrap.c +++ b/qrap.c @@ -7,8 +7,9 @@ * Copyright (c) 2020-2021 Red Hat GmbH * Author: Stefano Brivio <sbrivio(a)redhat.com> * - * TODO: Implement this functionality directly in qemu: we have TCP and UDP - * socket back-ends already. + * TODO: Drop this implementation once qemu commit 13c6be96618c ("net: stream: + * add unix socket") is included in a release (7.2), and once we can reasonably + * assume existing users switched to it. */ #include <stdio.h> diff --git a/tap.c b/tap.c index 84e93c2..ceb6e1d 100644 --- a/tap.c +++ b/tap.c @@ -943,13 +943,11 @@ static void tap_sock_unix_init(struct ctx *c) ev.events = EPOLLIN | EPOLLET | EPOLLRDHUP; epoll_ctl(c->epollfd, EPOLL_CTL_ADD, c->fd_tap_listen, &ev); - info("You can now start qrap:"); - info(" ./qrap 5 kvm ... -net socket,fd=5 -net nic,model=virtio"); - info("or directly qemu, patched with:"); - info(" qemu/0001-net-Allow-also-UNIX-domain-sockets-to-be-used-as-net.patch"); - info("as follows:"); - info(" kvm ... -net socket,connect=%s -net nic,model=virtio", + info("You can now start qemu (>= 7.2, with commit 13c6be96618c):"); + info(" kvm ... -device virtio-net-pci,netdev=s -netdev stream,id=s,server=off,addr.type=unix,addr.path=%s", addr.sun_path); + info("or qrap, for earlier qemu versions:"); + info(" ./qrap 5 kvm ... -net socket,fd=5 -net nic,model=virtio"); } /** -- 2.35.1