public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
* [PATCH 0/2] Refinements to memory usage tests
@ 2022-11-01  5:19 David Gibson
  2022-11-01  5:19 ` [PATCH 1/2] test: Correct passt binary path for " David Gibson
  2022-11-01  5:19 ` [PATCH 2/2] test: Don't use "outer" passt " David Gibson
  0 siblings, 2 replies; 4+ messages in thread
From: David Gibson @ 2022-11-01  5:19 UTC (permalink / raw)
  To: Stefano Brivio, passt-dev; +Cc: David Gibson

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] test: Correct passt binary path for memory usage tests
  2022-11-01  5:19 [PATCH 0/2] Refinements to memory usage tests David Gibson
@ 2022-11-01  5:19 ` David Gibson
  2022-11-01  5:19 ` [PATCH 2/2] test: Don't use "outer" passt " David Gibson
  1 sibling, 0 replies; 4+ messages in thread
From: David Gibson @ 2022-11-01  5:19 UTC (permalink / raw)
  To: Stefano Brivio, passt-dev; +Cc: David Gibson

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@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
-- 
@@ -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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] test: Don't use "outer" passt for memory usage tests
  2022-11-01  5:19 [PATCH 0/2] Refinements to memory usage tests David Gibson
  2022-11-01  5:19 ` [PATCH 1/2] test: Correct passt binary path for " David Gibson
@ 2022-11-01  5:19 ` David Gibson
  2022-11-01  8:02   ` Stefano Brivio
  1 sibling, 1 reply; 4+ messages in thread
From: David Gibson @ 2022-11-01  5:19 UTC (permalink / raw)
  To: Stefano Brivio, passt-dev; +Cc: David Gibson

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@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
-- 
@@ -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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] test: Don't use "outer" passt for memory usage tests
  2022-11-01  5:19 ` [PATCH 2/2] test: Don't use "outer" passt " David Gibson
@ 2022-11-01  8:02   ` Stefano Brivio
  0 siblings, 0 replies; 4+ messages in thread
From: Stefano Brivio @ 2022-11-01  8:02 UTC (permalink / raw)
  To: David Gibson; +Cc: passt-dev

On Tue,  1 Nov 2022 16:19:37 +1100
David Gibson <david@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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-11-01  8:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-01  5:19 [PATCH 0/2] Refinements to memory usage tests David Gibson
2022-11-01  5:19 ` [PATCH 1/2] test: Correct passt binary path for " David Gibson
2022-11-01  5:19 ` [PATCH 2/2] test: Don't use "outer" passt " David Gibson
2022-11-01  8:02   ` Stefano Brivio

Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).