From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: passt.top; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=jCCmTG1T; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by passt.top (Postfix) with ESMTP id EC4A55A004E for ; Wed, 21 Aug 2024 00:41:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1724193683; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=q83lDvOQTy8GKulFmlryIxsKy9k4iGSdv4WHGRGMJ2M=; b=jCCmTG1ThwVVi3avX2HYzPVaqzTjmJ/B5GN7J52AUBVaUP44qAhso+pgyAW0mm5cDnJobc 4tfhvUl72PCpuwZTlYjXbxOHYlS92KXnAUIRzbFvGJD+hSdf8gwT1FIU15xD+AIZidYLmE b1HX47nj3n/FsPidzuFDOCn8Y9KkZ0w= Received: from mail-pl1-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-270-Gx703CK8PIuPeFz0vAkwQA-1; Tue, 20 Aug 2024 18:41:21 -0400 X-MC-Unique: Gx703CK8PIuPeFz0vAkwQA-1 Received: by mail-pl1-f199.google.com with SMTP id d9443c01a7336-201f2de64ddso55035065ad.2 for ; Tue, 20 Aug 2024 15:41:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724193679; x=1724798479; h=mime-version:organization:references:in-reply-to:message-id:subject :cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=q83lDvOQTy8GKulFmlryIxsKy9k4iGSdv4WHGRGMJ2M=; b=VT/h41pIc3MZX9B6ob+nBZyhuKe+Sch4w+C/JBVDqnTgF5jvpcUvTDe8l4OGWvm5pv lLajRVUgyiKjwWWQUCBvd4z+oruNVs/Wz3rw0bIPg3TLlQu56vbWclU/4dy23hNbKeJ0 Erv7z/5WFHQqLCwrbughs8N5WEQN5sACsJbUkZQBeU00exN6wQl31pfN10DvE63/5Jaw PSa2Ef/mxFsQac5jNe4g0+rh3/hHcz7E5fo4YDDKGjtPKlNThqrVpnMqLAkvSh5rNulX YyxYPE9UMdzOtlAV1DB/Dkiz/vtavhFf+Q2mcW0PVctL2a1k0Ln0Dxz2zmWN0h6ejQZf yIQA== X-Gm-Message-State: AOJu0Yy8VRPhUV3bYKRT0EHcgij88BPCYSUbOI8av2921taLoRXRM6uS mU7PK+Q5JGYujy48m+NMc4plyV57QgOsoNM84cl75uO+26HARKmj/3QHC0rGhmZ1hFzeeENq2p/ NYf/4n/ut7WG4BEvwj+ChOIRZPWgz+7wQ5ZfqLaSVeO2fj7mL9gdT/YYOXOi72gBboZK7Ft/goP n0UgHoEe127eOtFgBzzHN/2Y3j2K9akwT8 X-Received: by 2002:a17:903:41c8:b0:202:359:9f66 with SMTP id d9443c01a7336-203681a9dc5mr3914015ad.54.1724193679630; Tue, 20 Aug 2024 15:41:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE8MlpFn4E+n1bV7JyQMRqXfhVOH2C9wVf0bVXOjSO9AvXnByuk0MszBUjf1t/6VLcEj/pTjQ== X-Received: by 2002:a17:903:41c8:b0:202:359:9f66 with SMTP id d9443c01a7336-203681a9dc5mr3913735ad.54.1724193679124; Tue, 20 Aug 2024 15:41:19 -0700 (PDT) Received: from maya.myfinge.rs (ifcgrfdd.trafficplex.cloud. [2a10:fc81:a806:d6a9::1]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-201f02fb458sm82120795ad.27.2024.08.20.15.41.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Aug 2024 15:41:17 -0700 (PDT) Date: Wed, 21 Aug 2024 00:41:14 +0200 From: Stefano Brivio To: passt-dev@passt.top Subject: Re: [PATCH v3 0/4] Add vhost-user support to passt. (part 3) Message-ID: <20240821004114.008ddc08@elisabeth> In-Reply-To: <20240815155024.827956-1-lvivier@redhat.com> References: <20240815155024.827956-1-lvivier@redhat.com> Organization: Red Hat X-Mailer: Claws Mail 4.2.0 (GTK 3.24.41; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/mixed; boundary="MP_/DZ7Lx.77/LzRpm3Hc_ba2WW" Message-ID-Hash: DYMFPG5BBRHETGLZLKBWKPXG6RRWCG7V X-Message-ID-Hash: DYMFPG5BBRHETGLZLKBWKPXG6RRWCG7V X-MailFrom: sbrivio@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Laurent Vivier X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --MP_/DZ7Lx.77/LzRpm3Hc_ba2WW Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline On Thu, 15 Aug 2024 17:50:19 +0200 Laurent Vivier 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 --MP_/DZ7Lx.77/LzRpm3Hc_ba2WW Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=vhost_user_tests.patch 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 --MP_/DZ7Lx.77/LzRpm3Hc_ba2WW--