1
0
mirror of https://passt.top/passt synced 2024-12-22 13:45:32 +00:00

test: Add tests for passt in vhost-user mode

Run functional and performance tests for vhost-user mode as well. For
functional tests, we add passt_vu and passt_vu_in_ns as symbolic links
to their non-vhost-user counterparts, as no differences are intended
but we want to distinguish them in test logs.

For performance tests, instead, we add separate perf/passt_vu_tcp and
perf/passt_vu_udp files, as we need longer test duration, as well as
higher UDP sending bandwidths and larger TCP windows, to actually get
the highest throughput vhost-user mode offers.

For valgrind tests, vhost-user mode needs two extra system calls:
statx and readlink. Add them as EXTRA_SYSCALLS for the valgrind
target.

Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
Stefano Brivio 2024-11-22 17:43:35 +01:00
parent 28997fcb29
commit 676bf5488e
10 changed files with 479 additions and 16 deletions

View File

@ -101,7 +101,8 @@ qrap: $(QRAP_SRCS) passt.h
valgrind: EXTRA_SYSCALLS += rt_sigprocmask rt_sigtimedwait rt_sigaction \ valgrind: EXTRA_SYSCALLS += rt_sigprocmask rt_sigtimedwait rt_sigaction \
rt_sigreturn getpid gettid kill clock_gettime mmap \ rt_sigreturn getpid gettid kill clock_gettime mmap \
mmap2 munmap open unlink gettimeofday futex mmap2 munmap open unlink gettimeofday futex statx \
readlink
valgrind: FLAGS += -g -DVALGRIND valgrind: FLAGS += -g -DVALGRIND
valgrind: all valgrind: all

View File

@ -49,6 +49,21 @@ td:empty { visibility: hidden; }
__passt_tcp_LINE__ __passt_udp_LINE__ __passt_tcp_LINE__ __passt_udp_LINE__
</table> </table>
</li><li><p>passt with vhost-user support</p>
<table class="passt" width="70%">
<tr>
<th/>
<th id="perf_passt_vu_tcp" colspan="__passt_vu_tcp_cols__">TCP, __passt_vu_tcp_threads__ at __passt_vu_tcp_freq__ GHz</th>
<th id="perf_passt_vu_udp" colspan="__passt_vu_udp_cols__">UDP, __passt_vu_udp_threads__ at __passt_vu_udp_freq__ GHz</th>
</tr>
<tr>
<td align="right">MTU:</td>
__passt_vu_tcp_header__
__passt_vu_udp_header__
</tr>
__passt_vu_tcp_LINE__ __passt_vu_udp_LINE__
</table>
<style type="text/CSS"> <style type="text/CSS">
table.pasta_local td { border: 0px solid; padding: 6px; line-height: 1; } table.pasta_local td { border: 0px solid; padding: 6px; line-height: 1; }
table.pasta_local td { text-align: right; } table.pasta_local td { text-align: right; }

View File

@ -15,8 +15,7 @@
INITRAMFS="${BASEPATH}/mbuto.img" INITRAMFS="${BASEPATH}/mbuto.img"
VCPUS="$( [ $(nproc) -ge 8 ] && echo 6 || echo $(( $(nproc) / 2 + 1 )) )" VCPUS="$( [ $(nproc) -ge 8 ] && echo 6 || echo $(( $(nproc) / 2 + 1 )) )"
__mem_kib="$(sed -n 's/MemTotal:[ ]*\([0-9]*\) kB/\1/p' /proc/meminfo)" MEM_KIB="$(sed -n 's/MemTotal:[ ]*\([0-9]*\) kB/\1/p' /proc/meminfo)"
VMEM="$((${__mem_kib} / 1024 / 4))"
QEMU_ARCH="$(uname -m)" QEMU_ARCH="$(uname -m)"
[ "${QEMU_ARCH}" = "i686" ] && QEMU_ARCH=i386 [ "${QEMU_ARCH}" = "i686" ] && QEMU_ARCH=i386
@ -46,6 +45,7 @@ setup_passt() {
[ ${PCAP} -eq 1 ] && __opts="${__opts} -p ${LOGDIR}/passt.pcap" [ ${PCAP} -eq 1 ] && __opts="${__opts} -p ${LOGDIR}/passt.pcap"
[ ${DEBUG} -eq 1 ] && __opts="${__opts} -d" [ ${DEBUG} -eq 1 ] && __opts="${__opts} -d"
[ ${TRACE} -eq 1 ] && __opts="${__opts} --trace" [ ${TRACE} -eq 1 ] && __opts="${__opts} --trace"
[ ${VHOST_USER} -eq 1 ] && __opts="${__opts} --vhost-user"
context_run passt "make clean" context_run passt "make clean"
context_run passt "make valgrind" context_run passt "make valgrind"
@ -54,16 +54,29 @@ setup_passt() {
# pidfile isn't created until passt is listening # pidfile isn't created until passt is listening
wait_for [ -f "${STATESETUP}/passt.pid" ] wait_for [ -f "${STATESETUP}/passt.pid" ]
__vmem="$((${MEM_KIB} / 1024 / 4))"
if [ ${VHOST_USER} -eq 1 ]; then
__vmem="$(((${__vmem} + 500) / 1000))G"
__qemu_netdev=" \
-chardev socket,id=c,path=${STATESETUP}/passt.socket \
-netdev vhost-user,id=v,chardev=c \
-device virtio-net,netdev=v \
-object memory-backend-memfd,id=m,share=on,size=${__vmem} \
-numa node,memdev=m"
else
__qemu_netdev="-device virtio-net-pci,netdev=s \
-netdev stream,id=s,server=off,addr.type=unix,addr.path=${STATESETUP}/passt.socket"
fi
GUEST_CID=94557 GUEST_CID=94557
context_run_bg qemu 'qemu-system-'"${QEMU_ARCH}" \ context_run_bg qemu 'qemu-system-'"${QEMU_ARCH}" \
' -machine accel=kvm' \ ' -machine accel=kvm' \
' -m '${VMEM}' -cpu host -smp '${VCPUS} \ ' -m '${__vmem}' -cpu host -smp '${VCPUS} \
' -kernel '"${KERNEL}" \ ' -kernel '"${KERNEL}" \
' -initrd '${INITRAMFS}' -nographic -serial stdio' \ ' -initrd '${INITRAMFS}' -nographic -serial stdio' \
' -nodefaults' \ ' -nodefaults' \
' -append "console=ttyS0 mitigations=off apparmor=0" ' \ ' -append "console=ttyS0 mitigations=off apparmor=0" ' \
' -device virtio-net-pci,netdev=s0 ' \ " ${__qemu_netdev}" \
" -netdev stream,id=s0,server=off,addr.type=unix,addr.path=${STATESETUP}/passt.socket " \
" -pidfile ${STATESETUP}/qemu.pid" \ " -pidfile ${STATESETUP}/qemu.pid" \
" -device vhost-vsock-pci,guest-cid=$GUEST_CID" " -device vhost-vsock-pci,guest-cid=$GUEST_CID"
@ -142,6 +155,7 @@ setup_passt_in_ns() {
[ ${PCAP} -eq 1 ] && __opts="${__opts} -p ${LOGDIR}/passt_in_pasta.pcap" [ ${PCAP} -eq 1 ] && __opts="${__opts} -p ${LOGDIR}/passt_in_pasta.pcap"
[ ${DEBUG} -eq 1 ] && __opts="${__opts} -d" [ ${DEBUG} -eq 1 ] && __opts="${__opts} -d"
[ ${TRACE} -eq 1 ] && __opts="${__opts} --trace" [ ${TRACE} -eq 1 ] && __opts="${__opts} --trace"
[ ${VHOST_USER} -eq 1 ] && __opts="${__opts} --vhost-user"
if [ ${VALGRIND} -eq 1 ]; then if [ ${VALGRIND} -eq 1 ]; then
context_run passt "make clean" context_run passt "make clean"
@ -154,17 +168,30 @@ setup_passt_in_ns() {
fi fi
wait_for [ -f "${STATESETUP}/passt.pid" ] wait_for [ -f "${STATESETUP}/passt.pid" ]
__vmem="$((${MEM_KIB} / 1024 / 4))"
if [ ${VHOST_USER} -eq 1 ]; then
__vmem="$(((${__vmem} + 500) / 1000))G"
__qemu_netdev=" \
-chardev socket,id=c,path=${STATESETUP}/passt.socket \
-netdev vhost-user,id=v,chardev=c \
-device virtio-net,netdev=v \
-object memory-backend-memfd,id=m,share=on,size=${__vmem} \
-numa node,memdev=m"
else
__qemu_netdev="-device virtio-net-pci,netdev=s \
-netdev stream,id=s,server=off,addr.type=unix,addr.path=${STATESETUP}/passt.socket"
fi
GUEST_CID=94557 GUEST_CID=94557
context_run_bg qemu 'qemu-system-'"${QEMU_ARCH}" \ context_run_bg qemu 'qemu-system-'"${QEMU_ARCH}" \
' -machine accel=kvm' \ ' -machine accel=kvm' \
' -M accel=kvm:tcg' \ ' -M accel=kvm:tcg' \
' -m '${VMEM}' -cpu host -smp '${VCPUS} \ ' -m '${__vmem}' -cpu host -smp '${VCPUS} \
' -kernel '"${KERNEL}" \ ' -kernel '"${KERNEL}" \
' -initrd '${INITRAMFS}' -nographic -serial stdio' \ ' -initrd '${INITRAMFS}' -nographic -serial stdio' \
' -nodefaults' \ ' -nodefaults' \
' -append "console=ttyS0 mitigations=off apparmor=0" ' \ ' -append "console=ttyS0 mitigations=off apparmor=0" ' \
' -device virtio-net-pci,netdev=s0 ' \ " ${__qemu_netdev}" \
" -netdev stream,id=s0,server=off,addr.type=unix,addr.path=${STATESETUP}/passt.socket " \
" -pidfile ${STATESETUP}/qemu.pid" \ " -pidfile ${STATESETUP}/qemu.pid" \
" -device vhost-vsock-pci,guest-cid=$GUEST_CID" " -device vhost-vsock-pci,guest-cid=$GUEST_CID"
@ -214,6 +241,7 @@ setup_two_guests() {
[ ${PCAP} -eq 1 ] && __opts="${__opts} -p ${LOGDIR}/passt_1.pcap" [ ${PCAP} -eq 1 ] && __opts="${__opts} -p ${LOGDIR}/passt_1.pcap"
[ ${DEBUG} -eq 1 ] && __opts="${__opts} -d" [ ${DEBUG} -eq 1 ] && __opts="${__opts} -d"
[ ${TRACE} -eq 1 ] && __opts="${__opts} --trace" [ ${TRACE} -eq 1 ] && __opts="${__opts} --trace"
[ ${VHOST_USER} -eq 1 ] && __opts="${__opts} --vhost-user"
context_run_bg passt_1 "./passt -s ${STATESETUP}/passt_1.socket -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" ] wait_for [ -f "${STATESETUP}/passt_1.pid" ]
@ -222,33 +250,54 @@ setup_two_guests() {
[ ${PCAP} -eq 1 ] && __opts="${__opts} -p ${LOGDIR}/passt_2.pcap" [ ${PCAP} -eq 1 ] && __opts="${__opts} -p ${LOGDIR}/passt_2.pcap"
[ ${DEBUG} -eq 1 ] && __opts="${__opts} -d" [ ${DEBUG} -eq 1 ] && __opts="${__opts} -d"
[ ${TRACE} -eq 1 ] && __opts="${__opts} --trace" [ ${TRACE} -eq 1 ] && __opts="${__opts} --trace"
[ ${VHOST_USER} -eq 1 ] && __opts="${__opts} --vhost-user"
context_run_bg passt_2 "./passt -s ${STATESETUP}/passt_2.socket -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" ] wait_for [ -f "${STATESETUP}/passt_2.pid" ]
__vmem="$((${MEM_KIB} / 1024 / 4))"
if [ ${VHOST_USER} -eq 1 ]; then
__vmem="$(((${__vmem} + 500) / 1000))G"
__qemu_netdev1=" \
-chardev socket,id=c,path=${STATESETUP}/passt_1.socket \
-netdev vhost-user,id=v,chardev=c \
-device virtio-net,netdev=v \
-object memory-backend-memfd,id=m,share=on,size=${__vmem} \
-numa node,memdev=m"
__qemu_netdev2=" \
-chardev socket,id=c,path=${STATESETUP}/passt_2.socket \
-netdev vhost-user,id=v,chardev=c \
-device virtio-net,netdev=v \
-object memory-backend-memfd,id=m,share=on,size=${__vmem} \
-numa node,memdev=m"
else
__qemu_netdev1="-device virtio-net-pci,netdev=s \
-netdev stream,id=s,server=off,addr.type=unix,addr.path=${STATESETUP}/passt_1.socket"
__qemu_netdev2="-device virtio-net-pci,netdev=s \
-netdev stream,id=s,server=off,addr.type=unix,addr.path=${STATESETUP}/passt_2.socket"
fi
GUEST_1_CID=94557 GUEST_1_CID=94557
context_run_bg qemu_1 'qemu-system-'"${QEMU_ARCH}" \ context_run_bg qemu_1 'qemu-system-'"${QEMU_ARCH}" \
' -M accel=kvm:tcg' \ ' -M accel=kvm:tcg' \
' -m '${VMEM}' -cpu host -smp '${VCPUS} \ ' -m '${__vmem}' -cpu host -smp '${VCPUS} \
' -kernel '"${KERNEL}" \ ' -kernel '"${KERNEL}" \
' -initrd '${INITRAMFS}' -nographic -serial stdio' \ ' -initrd '${INITRAMFS}' -nographic -serial stdio' \
' -nodefaults' \ ' -nodefaults' \
' -append "console=ttyS0 mitigations=off apparmor=0" ' \ ' -append "console=ttyS0 mitigations=off apparmor=0" ' \
' -device virtio-net-pci,netdev=s0 ' \ " ${__qemu_netdev1}" \
" -netdev stream,id=s0,server=off,addr.type=unix,addr.path=${STATESETUP}/passt_1.socket " \
" -pidfile ${STATESETUP}/qemu_1.pid" \ " -pidfile ${STATESETUP}/qemu_1.pid" \
" -device vhost-vsock-pci,guest-cid=$GUEST_1_CID" " -device vhost-vsock-pci,guest-cid=$GUEST_1_CID"
GUEST_2_CID=94558 GUEST_2_CID=94558
context_run_bg qemu_2 'qemu-system-'"${QEMU_ARCH}" \ context_run_bg qemu_2 'qemu-system-'"${QEMU_ARCH}" \
' -M accel=kvm:tcg' \ ' -M accel=kvm:tcg' \
' -m '${VMEM}' -cpu host -smp '${VCPUS} \ ' -m '${__vmem}' -cpu host -smp '${VCPUS} \
' -kernel '"${KERNEL}" \ ' -kernel '"${KERNEL}" \
' -initrd '${INITRAMFS}' -nographic -serial stdio' \ ' -initrd '${INITRAMFS}' -nographic -serial stdio' \
' -nodefaults' \ ' -nodefaults' \
' -append "console=ttyS0 mitigations=off apparmor=0" ' \ ' -append "console=ttyS0 mitigations=off apparmor=0" ' \
' -device virtio-net-pci,netdev=s0 ' \ " ${__qemu_netdev2}" \
" -netdev stream,id=s0,server=off,addr.type=unix,addr.path=${STATESETUP}/passt_2.socket " \
" -pidfile ${STATESETUP}/qemu_2.pid" \ " -pidfile ${STATESETUP}/qemu_2.pid" \
" -device vhost-vsock-pci,guest-cid=$GUEST_2_CID" " -device vhost-vsock-pci,guest-cid=$GUEST_2_CID"

View File

@ -33,7 +33,7 @@ setup_memory() {
pane_or_context_run guest 'qemu-system-$(uname -m)' \ pane_or_context_run guest 'qemu-system-$(uname -m)' \
' -machine accel=kvm' \ ' -machine accel=kvm' \
' -m '${VMEM}' -cpu host -smp '${VCPUS} \ ' -m '$((${MEM_KIB} / 1024 / 4))' -cpu host -smp '${VCPUS} \
' -kernel ' "/boot/vmlinuz-$(uname -r)" \ ' -kernel ' "/boot/vmlinuz-$(uname -r)" \
' -initrd '${INITRAMFS_MEM}' -nographic -serial stdio' \ ' -initrd '${INITRAMFS_MEM}' -nographic -serial stdio' \
' -nodefaults' \ ' -nodefaults' \

1
test/passt_vu Symbolic link
View File

@ -0,0 +1 @@
passt

1
test/passt_vu_in_ns Symbolic link
View File

@ -0,0 +1 @@
passt_in_ns

211
test/perf/passt_vu_tcp Normal file
View File

@ -0,0 +1,211 @@
# SPDX-License-Identifier: GPL-2.0-or-later
#
# PASST - Plug A Simple Socket Transport
# for qemu/UNIX domain socket mode
#
# PASTA - Pack A Subtle Tap Abstraction
# for network namespace/tap device mode
#
# test/perf/passt_vu_tcp - Check TCP performance in passt vhost-user mode
#
# Copyright (c) 2021 Red Hat GmbH
# Author: Stefano Brivio <sbrivio@redhat.com>
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
set MAP_NS4 192.0.2.2
set MAP_NS6 2001:db8:9a55::2
test passt: throughput and latency
guest /sbin/sysctl -w net.core.rmem_max=536870912
guest /sbin/sysctl -w net.core.wmem_max=536870912
guest /sbin/sysctl -w net.core.rmem_default=33554432
guest /sbin/sysctl -w net.core.wmem_default=33554432
guest /sbin/sysctl -w net.ipv4.tcp_rmem="4096 131072 268435456"
guest /sbin/sysctl -w net.ipv4.tcp_wmem="4096 131072 268435456"
guest /sbin/sysctl -w net.ipv4.tcp_timestamps=0
ns /sbin/sysctl -w net.ipv4.tcp_rmem="4096 524288 134217728"
ns /sbin/sysctl -w net.ipv4.tcp_wmem="4096 524288 134217728"
ns /sbin/sysctl -w net.ipv4.tcp_timestamps=0
gout IFNAME ip -j link show | jq -rM '.[] | select(.link_type == "ether").ifname'
hout FREQ_PROCFS (echo "scale=1"; sed -n 's/cpu MHz.*: \([0-9]*\)\..*$/(\1+10^2\/2)\/10^3/p' /proc/cpuinfo) | bc -l | head -n1
hout FREQ_CPUFREQ (echo "scale=1"; printf '( %i + 10^5 / 2 ) / 10^6\n' $(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq) ) | bc -l
hout FREQ [ -n "__FREQ_CPUFREQ__" ] && echo __FREQ_CPUFREQ__ || echo __FREQ_PROCFS__
set THREADS 4
set TIME 5
set OMIT 0.1
set OPTS -Z -P __THREADS__ -l 1M -O__OMIT__ -N
info Throughput in Gbps, latency in µs, __THREADS__ threads at __FREQ__ GHz
report passt_vu tcp __THREADS__ __FREQ__
th MTU 256B 576B 1280B 1500B 9000B 65520B
tr TCP throughput over IPv6: guest to host
iperf3s ns 10002
bw -
bw -
guest ip link set dev __IFNAME__ mtu 1280
iperf3 BW guest __MAP_NS6__ 10002 __TIME__ __OPTS__ -w 16M
bw __BW__ 1.2 1.5
guest ip link set dev __IFNAME__ mtu 1500
iperf3 BW guest __MAP_NS6__ 10002 __TIME__ __OPTS__ -w 32M
bw __BW__ 1.6 1.8
guest ip link set dev __IFNAME__ mtu 9000
iperf3 BW guest __MAP_NS6__ 10002 __TIME__ __OPTS__ -w 64M
bw __BW__ 4.0 5.0
guest ip link set dev __IFNAME__ mtu 65520
iperf3 BW guest __MAP_NS6__ 10002 __TIME__ __OPTS__ -w 64M
bw __BW__ 7.0 8.0
iperf3k ns
tl TCP RR latency over IPv6: guest to host
lat -
lat -
lat -
lat -
lat -
nsb tcp_rr --nolog -6
gout LAT tcp_rr --nolog -l1 -6 -c -H __MAP_NS6__ | sed -n 's/^throughput=\(.*\)/\1/p'
lat __LAT__ 200 150
tl TCP CRR latency over IPv6: guest to host
lat -
lat -
lat -
lat -
lat -
nsb tcp_crr --nolog -6
gout LAT tcp_crr --nolog -l1 -6 -c -H __MAP_NS6__ | sed -n 's/^throughput=\(.*\)/\1/p'
lat __LAT__ 500 400
tr TCP throughput over IPv4: guest to host
iperf3s ns 10002
guest ip link set dev __IFNAME__ mtu 256
iperf3 BW guest __MAP_NS4__ 10002 __TIME__ __OPTS__ -w 2M
bw __BW__ 0.2 0.3
guest ip link set dev __IFNAME__ mtu 576
iperf3 BW guest __MAP_NS4__ 10002 __TIME__ __OPTS__ -w 4M
bw __BW__ 0.5 0.8
guest ip link set dev __IFNAME__ mtu 1280
iperf3 BW guest __MAP_NS4__ 10002 __TIME__ __OPTS__ -w 8M
bw __BW__ 1.2 1.5
guest ip link set dev __IFNAME__ mtu 1500
iperf3 BW guest __MAP_NS4__ 10002 __TIME__ __OPTS__ -w 16M
bw __BW__ 1.6 1.8
guest ip link set dev __IFNAME__ mtu 9000
iperf3 BW guest __MAP_NS4__ 10002 __TIME__ __OPTS__ -w 64M
bw __BW__ 4.0 5.0
guest ip link set dev __IFNAME__ mtu 65520
iperf3 BW guest __MAP_NS4__ 10002 __TIME__ __OPTS__ -w 64M
bw __BW__ 7.0 8.0
iperf3k ns
# Reducing MTU below 1280 deconfigures IPv6, get our address back
guest dhclient -6 -x
guest dhclient -6 __IFNAME__
tl TCP RR latency over IPv4: guest to host
lat -
lat -
lat -
lat -
lat -
nsb tcp_rr --nolog -4
gout LAT tcp_rr --nolog -l1 -4 -c -H __MAP_NS4__ | sed -n 's/^throughput=\(.*\)/\1/p'
lat __LAT__ 200 150
tl TCP CRR latency over IPv4: guest to host
lat -
lat -
lat -
lat -
lat -
nsb tcp_crr --nolog -4
gout LAT tcp_crr --nolog -l1 -4 -c -H __MAP_NS4__ | sed -n 's/^throughput=\(.*\)/\1/p'
lat __LAT__ 500 400
tr TCP throughput over IPv6: host to guest
iperf3s guest 10001
bw -
bw -
bw -
bw -
bw -
iperf3 BW ns ::1 10001 __TIME__ __OPTS__ -w 32M
bw __BW__ 6.0 6.8
iperf3k guest
tl TCP RR latency over IPv6: host to guest
lat -
lat -
lat -
lat -
lat -
guestb tcp_rr --nolog -P 10001 -C 10011 -6
sleep 1
nsout LAT tcp_rr --nolog -l1 -P 10001 -C 10011 -6 -c -H ::1 | sed -n 's/^throughput=\(.*\)/\1/p'
lat __LAT__ 200 150
tl TCP CRR latency over IPv6: host to guest
lat -
lat -
lat -
lat -
lat -
guestb tcp_crr --nolog -P 10001 -C 10011 -6
sleep 1
nsout LAT tcp_crr --nolog -l1 -P 10001 -C 10011 -6 -c -H ::1 | sed -n 's/^throughput=\(.*\)/\1/p'
lat __LAT__ 500 350
tr TCP throughput over IPv4: host to guest
iperf3s guest 10001
bw -
bw -
bw -
bw -
bw -
iperf3 BW ns 127.0.0.1 10001 __TIME__ __OPTS__ -w 32M
bw __BW__ 6.0 6.8
iperf3k guest
tl TCP RR latency over IPv4: host to guest
lat -
lat -
lat -
lat -
lat -
guestb tcp_rr --nolog -P 10001 -C 10011 -4
sleep 1
nsout LAT tcp_rr --nolog -l1 -P 10001 -C 10011 -4 -c -H 127.0.0.1 | sed -n 's/^throughput=\(.*\)/\1/p'
lat __LAT__ 200 150
tl TCP CRR latency over IPv6: host to guest
lat -
lat -
lat -
lat -
lat -
guestb tcp_crr --nolog -P 10001 -C 10011 -4
sleep 1
nsout LAT tcp_crr --nolog -l1 -P 10001 -C 10011 -4 -c -H 127.0.0.1 | sed -n 's/^throughput=\(.*\)/\1/p'
lat __LAT__ 500 300
te

159
test/perf/passt_vu_udp Normal file
View File

@ -0,0 +1,159 @@
# SPDX-License-Identifier: GPL-2.0-or-later
#
# PASST - Plug A Simple Socket Transport
# for qemu/UNIX domain socket mode
#
# PASTA - Pack A Subtle Tap Abstraction
# for network namespace/tap device mode
#
# test/perf/passt_vu_udp - Check UDP performance in passt vhost-user mode
#
# Copyright (c) 2021 Red Hat GmbH
# Author: Stefano Brivio <sbrivio@redhat.com>
gtools /sbin/sysctl ip jq nproc sleep iperf3 udp_rr # From neper
nstools ip jq sleep iperf3 udp_rr
htools bc head sed
set MAP_NS4 192.0.2.2
set MAP_NS6 2001:db8:9a55::2
test passt: throughput and latency
guest /sbin/sysctl -w net.core.rmem_max=16777216
guest /sbin/sysctl -w net.core.wmem_max=16777216
guest /sbin/sysctl -w net.core.rmem_default=16777216
guest /sbin/sysctl -w net.core.wmem_default=16777216
hout FREQ_PROCFS (echo "scale=1"; sed -n 's/cpu MHz.*: \([0-9]*\)\..*$/(\1+10^2\/2)\/10^3/p' /proc/cpuinfo) | bc -l | head -n1
hout FREQ_CPUFREQ (echo "scale=1"; printf '( %i + 10^5 / 2 ) / 10^6\n' $(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq) ) | bc -l
hout FREQ [ -n "__FREQ_CPUFREQ__" ] && echo __FREQ_CPUFREQ__ || echo __FREQ_PROCFS__
set THREADS 2
set TIME 1
set OPTS -u -P __THREADS__ --pacing-timer 1000
info Throughput in Gbps, latency in µs, __THREADS__ threads at __FREQ__ GHz
report passt_vu udp __THREADS__ __FREQ__
th pktlen 256B 576B 1280B 1500B 9000B 65520B
tr UDP throughput over IPv6: guest to host
iperf3s ns 10002
# (datagram size) = (packet size) - 48: 40 bytes of IPv6 header, 8 of UDP header
bw -
bw -
iperf3 BW guest __MAP_NS6__ 10002 __TIME__ __OPTS__ -b 3G -l 1232
bw __BW__ 0.8 1.2
iperf3 BW guest __MAP_NS6__ 10002 __TIME__ __OPTS__ -b 4G -l 1452
bw __BW__ 1.0 1.5
iperf3 BW guest __MAP_NS6__ 10002 __TIME__ __OPTS__ -b 10G -l 8952
bw __BW__ 4.0 5.0
iperf3 BW guest __MAP_NS6__ 10002 __TIME__ __OPTS__ -b 20G -l 64372
bw __BW__ 4.0 5.0
iperf3k ns
tl UDP RR latency over IPv6: guest to host
lat -
lat -
lat -
lat -
lat -
nsb udp_rr --nolog -6
gout LAT udp_rr --nolog -6 -c -H __MAP_NS6__ | sed -n 's/^throughput=\(.*\)/\1/p'
lat __LAT__ 200 150
tr UDP throughput over IPv4: guest to host
iperf3s ns 10002
# (datagram size) = (packet size) - 28: 20 bytes of IPv4 header, 8 of UDP header
iperf3 BW guest __MAP_NS4__ 10002 __TIME__ __OPTS__ -b 1G -l 228
bw __BW__ 0.0 0.0
iperf3 BW guest __MAP_NS4__ 10002 __TIME__ __OPTS__ -b 2G -l 548
bw __BW__ 0.4 0.6
iperf3 BW guest __MAP_NS4__ 10002 __TIME__ __OPTS__ -b 3G -l 1252
bw __BW__ 0.8 1.2
iperf3 BW guest __MAP_NS4__ 10002 __TIME__ __OPTS__ -b 4G -l 1472
bw __BW__ 1.0 1.5
iperf3 BW guest __MAP_NS4__ 10002 __TIME__ __OPTS__ -b 10G -l 8972
bw __BW__ 4.0 5.0
iperf3 BW guest __MAP_NS4__ 10002 __TIME__ __OPTS__ -b 20G -l 65492
bw __BW__ 4.0 5.0
iperf3k ns
tl UDP RR latency over IPv4: guest to host
lat -
lat -
lat -
lat -
lat -
nsb udp_rr --nolog -4
gout LAT udp_rr --nolog -4 -c -H __MAP_NS4__ | sed -n 's/^throughput=\(.*\)/\1/p'
lat __LAT__ 200 150
tr UDP throughput over IPv6: host to guest
iperf3s guest 10001
# (datagram size) = (packet size) - 48: 40 bytes of IPv6 header, 8 of UDP header
bw -
bw -
iperf3 BW ns ::1 10001 __TIME__ __OPTS__ -b 3G -l 1232
bw __BW__ 0.8 1.2
iperf3 BW ns ::1 10001 __TIME__ __OPTS__ -b 4G -l 1452
bw __BW__ 1.0 1.5
iperf3 BW ns ::1 10001 __TIME__ __OPTS__ -b 10G -l 8952
bw __BW__ 3.0 4.0
iperf3 BW ns ::1 10001 __TIME__ __OPTS__ -b 20G -l 64372
bw __BW__ 3.0 4.0
iperf3k guest
tl UDP RR latency over IPv6: host to guest
lat -
lat -
lat -
lat -
lat -
guestb udp_rr --nolog -P 10001 -C 10011 -6
sleep 1
nsout LAT udp_rr --nolog -P 10001 -C 10011 -6 -c -H ::1 | sed -n 's/^throughput=\(.*\)/\1/p'
lat __LAT__ 200 150
tr UDP throughput over IPv4: host to guest
iperf3s guest 10001
# (datagram size) = (packet size) - 28: 20 bytes of IPv4 header, 8 of UDP header
iperf3 BW ns 127.0.0.1 10001 __TIME__ __OPTS__ -b 1G -l 228
bw __BW__ 0.0 0.0
iperf3 BW ns 127.0.0.1 10001 __TIME__ __OPTS__ -b 2G -l 548
bw __BW__ 0.4 0.6
iperf3 BW ns 127.0.0.1 10001 __TIME__ __OPTS__ -b 3G -l 1252
bw __BW__ 0.8 1.2
iperf3 BW ns 127.0.0.1 10001 __TIME__ __OPTS__ -b 4G -l 1472
bw __BW__ 1.0 1.5
iperf3 BW ns 127.0.0.1 10001 __TIME__ __OPTS__ -b 10G -l 8972
bw __BW__ 3.0 4.0
iperf3 BW ns 127.0.0.1 10001 __TIME__ __OPTS__ -b 20G -l 65492
bw __BW__ 3.0 4.0
iperf3k guest
tl UDP RR latency over IPv4: host to guest
lat -
lat -
lat -
lat -
lat -
guestb udp_rr --nolog -P 10001 -C 10011 -4
sleep 1
nsout LAT udp_rr --nolog -P 10001 -C 10011 -4 -c -H 127.0.0.1 | sed -n 's/^throughput=\(.*\)/\1/p'
lat __LAT__ 200 150
te

View File

@ -93,6 +93,7 @@ run() {
test memory/passt test memory/passt
teardown memory teardown memory
VHOST_USER=0
setup passt setup passt
test passt/ndp test passt/ndp
test passt/dhcp test passt/dhcp
@ -115,7 +116,22 @@ run() {
test two_guests/basic test two_guests/basic
teardown two_guests teardown two_guests
VHOST_USER=1
setup passt_in_ns
test passt_vu/ndp
test passt_vu_in_ns/dhcp
test passt_vu_in_ns/icmp
test passt_vu_in_ns/tcp
test passt_vu_in_ns/udp
test passt_vu_in_ns/shutdown
teardown passt_in_ns
setup two_guests
test two_guests_vu/basic
teardown two_guests
VALGRIND=0 VALGRIND=0
VHOST_USER=0
setup passt_in_ns setup passt_in_ns
test passt/ndp test passt/ndp
test passt_in_ns/dhcp test passt_in_ns/dhcp
@ -126,6 +142,15 @@ run() {
test passt_in_ns/shutdown test passt_in_ns/shutdown
teardown passt_in_ns teardown passt_in_ns
VHOST_USER=1
setup passt_in_ns
test passt_vu/ndp
test passt_vu_in_ns/dhcp
test perf/passt_vu_tcp
test perf/passt_vu_udp
test passt_vu_in_ns/shutdown
teardown passt_in_ns
# TODO: Make those faster by at least pre-installing gcc and make on # TODO: Make those faster by at least pre-installing gcc and make on
# non-x86 images, then re-enable. # non-x86 images, then re-enable.
skip_distro() { skip_distro() {

1
test/two_guests_vu Symbolic link
View File

@ -0,0 +1 @@
two_guests