Here are some patches on top of Stefano's series which adds tests showing userspace and kernel memory usage for passt. The first I needed to get the tests running on my system. The second just removes some unneccesary things. David Gibson (2): test: Correct passt binary path for memory usage tests test: Don't use "outer" passt for memory usage tests test/lib/layout_ugly | 9 --------- test/lib/setup_ugly | 21 ++------------------- test/passt.mem.mbuto | 6 ++++-- 3 files changed, 6 insertions(+), 30 deletions(-) -- 2.38.1
With mbuto, binaries typically end up in /bin not /usr/bin. In some cases /usr/bin might not even exist. So we should put the passt binary in /bin as well to avoid errors if /usr/bin doesn't exist. While we're there symlink /bin to /usr/bin so that anything which refers to /usr/bin explicitly will also work. Signed-off-by: David Gibson <david(a)gibson.dropbear.id.au> --- test/passt.mem.mbuto | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/passt.mem.mbuto b/test/passt.mem.mbuto index 1550c15..537ff80 100755 --- a/test/passt.mem.mbuto +++ b/test/passt.mem.mbuto @@ -24,9 +24,10 @@ LINKS="${LINKS:- DIRS="${DIRS} /tmp /sbin" -COPIES="${COPIES} ../passt.avx2,/usr/bin/passt.avx2" +COPIES="${COPIES} ../passt.avx2,/bin/passt.avx2" FIXUP="${FIXUP}"' +ln -s /bin /usr/bin chmod 777 /tmp ip link set eth0 up ip address add 192.0.2.2/24 dev eth0 -- 2.38.1
The memory usage tests check both userspace and kernel memory usage of passt. We run it inside a VM so that we can examine kernel memory usage without noise from whatever else is happening on the host system. Currently we also give that VM network connectivity to the outside world using another instance of passt on the host. The memory usage tests are purely local to the VM, so outside connectivity is neither needed nor desirable. Remove it and instead run the passt within the VM against a local dummy interface. Signed-off-by: David Gibson <david(a)gibson.dropbear.id.au> --- test/lib/layout_ugly | 9 --------- test/lib/setup_ugly | 21 ++------------------- test/passt.mem.mbuto | 3 ++- 3 files changed, 4 insertions(+), 29 deletions(-) diff --git a/test/lib/layout_ugly b/test/lib/layout_ugly index d62d337..22f6169 100644 --- a/test/lib/layout_ugly +++ b/test/lib/layout_ugly @@ -90,9 +90,7 @@ layout_memory() { cmd_write 0 clear tmux split-window -h -l '35%' -t passt_test - tmux split-window -v -l '15%' -t passt_test - PANE_PASST=2 PANE_GUEST=0 PANE_INFO=1 @@ -109,13 +107,6 @@ layout_memory() { tmux select-pane -t ${PANE_GUEST} -T "guest" fi - if context_exists passt; then - pane_watch_contexts ${PANE_PASST} passt passt - else - tmux pipe-pane -O -t ${PANE_PASST} "cat >> ${LOGDIR}/pane_passt.log" - tmux select-pane -t ${PANE_PASST} -T "passt" - fi - info_layout "memory usage" sleep 1 diff --git a/test/lib/setup_ugly b/test/lib/setup_ugly index f2e07ba..bcf07ef 100755 --- a/test/lib/setup_ugly +++ b/test/lib/setup_ugly @@ -29,25 +29,15 @@ setup_pasta_options() { # setup_memory() - Start qemu in guest pane, and passt in passt context setup_memory() { - context_setup_host passt - layout_memory - context_run passt "./passt -P ${STATESETUP}/passt.pid" - - # pidfile isn't created until passt is listening - wait_for [ -f "${STATESETUP}/passt.pid" ] - - pane_or_context_run guest './qrap 5 qemu-system-$(uname -m)' \ + pane_or_context_run guest 'qemu-system-$(uname -m)' \ ' -machine accel=kvm' \ ' -m '${VMEM}' -cpu host -smp '${VCPUS} \ ' -kernel ' "/boot/vmlinuz-$(uname -r)" \ ' -initrd '${INITRAMFS_MEM}' -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"' \ " -pidfile ${STATESETUP}/qemu.pid" } @@ -65,11 +55,4 @@ teardown_pasta_options() { # teardown_passt() - Kill qemu with ^C, remove passt PID file teardown_memory() { kill $(cat "${STATESETUP}/qemu.pid") - - rm "${STATESETUP}/passt.pid" - - tmux send-keys -t ${PANE_PASST} "C-c" - - teardown_context_watch ${PANE_PASST} passt - teardown_context_watch ${PANE_GUEST} qemu } diff --git a/test/passt.mem.mbuto b/test/passt.mem.mbuto index 537ff80..dc06015 100755 --- a/test/passt.mem.mbuto +++ b/test/passt.mem.mbuto @@ -14,7 +14,7 @@ PROGS="${PROGS:-ash,dash,bash chmod ip mount insmod mkdir ln cat chmod modprobe grep mknod sed chown sleep bc ls ps mount unshare chroot cp kill diff head tail sort tr tee cut nm which}" -KMODS="${KMODS:- virtio_net virtio_pci vmw_vsock_virtio_transport}" +KMODS="${KMODS:- dummy}" NODES="${NODES:-console kmsg null ptmx random urandom zero}" @@ -29,6 +29,7 @@ COPIES="${COPIES} ../passt.avx2,/bin/passt.avx2" FIXUP="${FIXUP}"' ln -s /bin /usr/bin chmod 777 /tmp +ip link add eth0 type dummy ip link set eth0 up ip address add 192.0.2.2/24 dev eth0 ip address add 2001:db8::2/64 dev eth0 -- 2.38.1
On Tue, 1 Nov 2022 16:19:37 +1100 David Gibson <david(a)gibson.dropbear.id.au> wrote:The memory usage tests check both userspace and kernel memory usage of passt. We run it inside a VM so that we can examine kernel memory usage without noise from whatever else is happening on the host system. Currently we also give that VM network connectivity to the outside world using another instance of passt on the host. The memory usage tests are purely local to the VM, so outside connectivity is neither needed nor desirable. Remove it and instead run the passt within the VM against a local dummy interface.Oh, brilliant, I didn't even consider using a dummy interface here. I would apply this series after re-spinning mine. -- Stefano