public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: Stefano Brivio <sbrivio@redhat.com>
To: passt-dev@passt.top
Cc: Laurent Vivier <lvivier@redhat.com>
Subject: Re: [PATCH v3 0/4] Add vhost-user support to passt. (part 3)
Date: Wed, 21 Aug 2024 00:41:14 +0200	[thread overview]
Message-ID: <20240821004114.008ddc08@elisabeth> (raw)
In-Reply-To: <20240815155024.827956-1-lvivier@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 956 bytes --]

On Thu, 15 Aug 2024 17:50:19 +0200
Laurent Vivier <lvivier@redhat.com> wrote:

> This series of patches adds vhost-user support to passt
> and then allows passt to connect to QEMU network backend using
> virtqueue rather than a socket.
> 
> With QEMU, rather than using to connect:
> 
>   -netdev stream,id=s,server=off,addr.type=unix,addr.path=/tmp/passt_1.socket
> 
> we will use:
> 
>   -chardev socket,id=chr0,path=/tmp/passt_1.socket
>   -netdev vhost-user,id=netdev0,chardev=chr0
>   -device virtio-net,netdev=netdev0
>   -object memory-backend-memfd,id=memfd0,share=on,size=$RAMSIZE
>   -numa node,memdev=memfd0
> 
> The memory backend is needed to share data between passt and QEMU.
> 
> Performance comparison between "-netdev stream" and "-netdev vhost-user":

By the way, I attached a quick patch adding vhost-user-based tests to
the usual throughput and latency tests.

UDP doesn't work (I didn't look into that at all), TCP does.

-- 
Stefano

[-- Attachment #2: vhost_user_tests.patch --]
[-- Type: text/x-patch, Size: 3981 bytes --]

diff --git a/test/lib/setup b/test/lib/setup
index 58371bd..cc24cb0 100755
--- a/test/lib/setup
+++ b/test/lib/setup
@@ -17,6 +17,7 @@ INITRAMFS="${BASEPATH}/mbuto.img"
 VCPUS="$( [ $(nproc) -ge 8 ] && echo 6 || echo $(( $(nproc) / 2 + 1 )) )"
 __mem_kib="$(sed -n 's/MemTotal:[ ]*\([0-9]*\) kB/\1/p' /proc/meminfo)"
 VMEM="$((${__mem_kib} / 1024 / 4))"
+VMEM_ROUND="$(((${VMEM} + 500) / 1000))G"
 QEMU_ARCH="$(uname -m)"
 [ "${QEMU_ARCH}" = "i686" ] && QEMU_ARCH=i386
 
@@ -145,23 +146,45 @@ setup_passt_in_ns() {
 	else
 		context_run passt "make clean"
 		context_run passt "make"
-		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"
+		if [ ${VHOST_USER} -eq 1 ]; then
+			context_run_bg passt "./passt -f ${__opts} --vhost-user -s ${STATESETUP}/passt.socket -t 10001,10011,10021,10031 -u 10001,10011,10021,10031 -P ${STATESETUP}/passt.pid"
+		else
+			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
 	fi
 	wait_for [ -f "${STATESETUP}/passt.pid" ]
 
 	GUEST_CID=94557
-	context_run_bg qemu 'qemu-system-'"${QEMU_ARCH}"		   \
-		' -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" '	   \
-		' -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"
+	if [ ${VHOST_USER} -eq 1 ]; then
+		context_run_bg qemu 'qemu-system-$(uname -m)'			   \
+			' -machine accel=kvm'                                      \
+			' -M accel=kvm:tcg'                                        \
+			' -m '${VMEM_ROUND}' -cpu host -smp '${VCPUS}              \
+			' -kernel ' "/boot/vmlinuz-$(uname -r)"			   \
+			' -initrd '${INITRAMFS}' -nographic -serial stdio'	   \
+			' -nodefaults'						   \
+			' -append "console=ttyS0 mitigations=off apparmor=0" '	   \
+			" -chardev socket,id=chr0,path=${STATESETUP}/passt.socket" \
+			' -netdev vhost-user,id=netdev0,chardev=chr0'		   \
+			' -device virtio-net,netdev=netdev0'			   \
+			" -object memory-backend-memfd,id=memfd0,share=on,size=${VMEM_ROUND}" \
+			' -numa node,memdev=memfd0'				   \
+			" -pidfile ${STATESETUP}/qemu.pid"			   \
+			" -device vhost-vsock-pci,guest-cid=$GUEST_CID"
+	else
+		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" '	   \
+			' -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"
+	fi
 
 	context_setup_guest guest $GUEST_CID
 }
diff --git a/test/run b/test/run
index 3b37663..b522a69 100755
--- a/test/run
+++ b/test/run
@@ -70,6 +70,18 @@ run() {
 	test build/clang_tidy
 	teardown build
 
+	VALGRIND=0
+	VHOST_USER=1
+	setup passt_in_ns
+	test passt/ndp
+	test passt/dhcp
+	test perf_vhost_user/passt_tcp
+	test perf_vhost_user/passt_udp
+	test perf_vhost_user/pasta_tcp
+	test perf_vhost_user/pasta_udp
+	test passt_in_ns/shutdown
+	teardown passt_in_ns
+
 	setup pasta
 	test pasta/ndp
 	test pasta/dhcp

  parent reply	other threads:[~2024-08-20 22:41 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-15 15:50 [PATCH v3 0/4] Add vhost-user support to passt. (part 3) Laurent Vivier
2024-08-15 15:50 ` [PATCH v3 1/4] packet: replace struct desc by struct iovec Laurent Vivier
2024-08-20  0:27   ` David Gibson
2024-08-15 15:50 ` [PATCH v3 2/4] vhost-user: introduce virtio API Laurent Vivier
2024-08-20  1:00   ` David Gibson
2024-08-22 22:14   ` Stefano Brivio
2024-08-15 15:50 ` [PATCH v3 3/4] vhost-user: introduce vhost-user API Laurent Vivier
2024-08-22 22:14   ` Stefano Brivio
2024-08-26  5:27     ` David Gibson
2024-08-26  7:55       ` Stefano Brivio
2024-08-26  9:53         ` David Gibson
2024-08-26  5:26   ` David Gibson
2024-08-26 22:14     ` Stefano Brivio
2024-08-27  4:42       ` David Gibson
2024-09-05  9:58     ` Laurent Vivier
2024-08-15 15:50 ` [PATCH v3 4/4] vhost-user: add vhost-user Laurent Vivier
2024-08-22  9:59   ` Stefano Brivio
2024-08-22 22:14   ` Stefano Brivio
2024-08-23 12:32   ` Stefano Brivio
2024-08-20 22:41 ` Stefano Brivio [this message]
2024-08-22 16:53   ` [PATCH v3 0/4] Add vhost-user support to passt. (part 3) Stefano Brivio
2024-08-23 12:32     ` Stefano Brivio

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240821004114.008ddc08@elisabeth \
    --to=sbrivio@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=passt-dev@passt.top \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).