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=Q2uoou5Y; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by passt.top (Postfix) with ESMTP id 41F515A061E for ; Wed, 13 Nov 2024 09:04:19 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1731485058; 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: content-transfer-encoding:content-transfer-encoding; bh=TEuvmKo0GaNBYKLFW0xbX1xeJlUCRQe112kCyeSH+g0=; b=Q2uoou5YfLgWg53f+R4hgwo/UtAn9UISJRTXSJ3f/2/N9jeEYKbnPYQZWIrpysS5d4iYtQ rhnK/OBpXBhPamhqDFJfMjbaaGMH0AaXrX4s1p1KahvEm9m6Frz0lU9idxysLhmpCfWO2l CPNlt6kW5iP2KT2QnR3NWVMHPNKbo5w= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-441-yHPOU5puOF2oYbWkFxMvBQ-1; Wed, 13 Nov 2024 03:04:14 -0500 X-MC-Unique: yHPOU5puOF2oYbWkFxMvBQ-1 X-Mimecast-MFC-AGG-ID: yHPOU5puOF2oYbWkFxMvBQ Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 311941956057 for ; Wed, 13 Nov 2024 08:04:13 +0000 (UTC) Received: from lenovo-t14s.redhat.com (unknown [10.39.192.187]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 4F78819560A3; Wed, 13 Nov 2024 08:04:12 +0000 (UTC) From: Laurent Vivier To: passt-dev@passt.top Subject: [PATCH v11 00/10] Add vhost-user support to passt. (part 3) Date: Wed, 13 Nov 2024 09:03:59 +0100 Message-ID: <20241113080411.476646-1-lvivier@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: y28mnLaxv_j5hY3BPyTpyemyuuhrYpkh--hHl-D37vM_1731485053 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID-Hash: HAOMKDMMVEPSLAVKIIJNCINFRMMDC7BP X-Message-ID-Hash: HAOMKDMMVEPSLAVKIIJNCINFRMMDC7BP X-MailFrom: lvivier@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: This series of patches adds vhost-user support to passt=0D and then allows passt to connect to QEMU network backend using=0D virtqueue rather than a socket.=0D =0D With QEMU, rather than using to connect:=0D =0D -netdev stream,id=3Ds,server=3Doff,addr.type=3Dunix,addr.path=3D/tmp/pass= t_1.socket=0D =0D we will use:=0D =0D -chardev socket,id=3Dchr0,path=3D/tmp/passt_1.socket=0D -netdev vhost-user,id=3Dnetdev0,chardev=3Dchr0=0D -device virtio-net,netdev=3Dnetdev0=0D -object memory-backend-memfd,id=3Dmemfd0,share=3Don,size=3D$RAMSIZE=0D -numa node,memdev=3Dmemfd0=0D =0D The memory backend is needed to share data between passt and QEMU.=0D =0D Performance comparison between "-netdev stream" and "-netdev vhost-user":= =0D =0D $ iperf3 -c localhost -p 10001 -t 60 -6 -u -b 50G=0D =0D socket:=0D [ 5] 0.00-60.05 sec 95.6 GBytes 13.7 Gbits/sec 0.017 ms 6998988/101= 32413 (69%) receiver=0D vhost-user:=0D [ 5] 0.00-60.04 sec 237 GBytes 33.9 Gbits/sec 0.006 ms 53673/78137= 70 (0.69%) receiver=0D =0D $ iperf3 -c localhost -p 10001 -t 60 -4 -u -b 50G=0D =0D socket:=0D [ 5] 0.00-60.05 sec 98.9 GBytes 14.1 Gbits/sec 0.018 ms 6260735/950= 1832 (66%) receiver=0D vhost-user:=0D [ 5] 0.00-60.05 sec 235 GBytes 33.7 Gbits/sec 0.008 ms 37581/77526= 99 (0.48%) receiver=0D =0D $ iperf3 -c localhost -p 10001 -t 60 -6=0D =0D socket:=0D [ 5] 0.00-60.00 sec 17.3 GBytes 2.48 Gbits/sec 0 sende= r=0D [ 5] 0.00-60.06 sec 17.3 GBytes 2.48 Gbits/sec recei= ver=0D vhost-user:=0D [ 5] 0.00-60.00 sec 191 GBytes 27.4 Gbits/sec 0 sende= r=0D [ 5] 0.00-60.05 sec 191 GBytes 27.3 Gbits/sec recei= ver=0D =0D $ iperf3 -c localhost -p 10001 -t 60 -4=0D =0D socket:=0D [ 5] 0.00-60.00 sec 15.6 GBytes 2.24 Gbits/sec 0 sende= r=0D [ 5] 0.00-60.06 sec 15.6 GBytes 2.24 Gbits/sec recei= ver=0D vhost-user:=0D [ 5] 0.00-60.00 sec 189 GBytes 27.1 Gbits/sec 0 sende= r=0D [ 5] 0.00-60.04 sec 189 GBytes 27.0 Gbits/sec recei= ver=0D =0D v11:=0D - rebase=0D - address comments from David on v10=0D =0D v10:=0D - rebase v9 on top of my changes=0D - remove last 4 patches from v9 as=0D 'tcp: Pass TCP header and payload separately to tcp_fill_headers[46]()'= =0D introduces a regression in "make check" for me.=0D - addressed comments from David=0D - I tried to cleanup iov management, but I was not able to remove the=0D update of the first iov to point to the header or to the data=0D - upd_vu_hdrlen()/tcp_vu_hdrlen() includes now the size of the=0D virtio-net header=0D - I didn't address comments from Stefano.=0D - I didn't fix the bug with seek_offset_cap=0D =0D v9: [David Gibson]=0D - Rebased on current main=0D - Conflicts with v4/v6 buffer merge addressed=0D - Conflicts with TCP options construction rework addressed=0D - Added several cleanup patches on top=0D - Added a number of IOV and buffer cleanups on top=0D - The aim is that these should allow more sharing of logic between=0D the vhost-user and non-vhost-user pathes, although they've only=0D minimally accomplished that so far.=0D v8:=0D - remove iov_size() from vu_collect_one_frame()=0D - move vu_packet_check_range() to vu_common.c=0D - fix UDP when dlen is 0.=0D =0D v7:=0D - rebase=0D - use vu_collect_one_frame() to do vu_collect() (collect multiple frame)= =0D - add vhost-user tests from Stefano=0D =0D v6:=0D - rebase=0D - extract 3 patches from "vhost-user: add vhost-user":=0D passt: rename tap_sock_init() to tap_backend_init()=0D tcp: Export headers functions=0D udp: Prepare udp.c to be shared with vhost-user=0D - introduce new functions vu_collect_one_frame(),=0D vu_collect(), vu_set_vnethdr(), vu_flush(), vu_send_single()=0D to be called from tcp_vu.c, udp_vu.c and ICMP/DHCP where vhost-user=0D code was duplicated.=0D =0D v5:=0D - rebase on top of 2024_09_06.6b38f07=0D - rework udp_vu.c as ref.udp.v6 has been removed and we need to=0D know if we receive IPv4 or IPv6 frame when we prepare the=0D guest buffers for recvmsg()=0D - remove vnet->hdrlen as the size is always the same with virtio-net v1= =0D - address comments from David and Stefano=0D =0D v4:=0D - rebase on top of 2024_08_21.1d6142f=0D (rebasing on top of 620e19a1b48a ("udp: Merge udp[46]_mh_recv arrays")= =0D introduces a regression in the measure of the latency with UDP=0D because I think I don't replace correctly ref.udp.v6 that is removed= =0D by this commit)=0D - Addressed most of the comments from David and Stefano=0D (I didn't want to postpone this version to next week,=0D so I'll address the remaining comments in the next version).=0D =0D v3:=0D - rebase on top of flow table=0D - update tcp_vu.c to look like udp_vu.c (recv()/prepare()/send_frame())= =0D - address comments from Stefano and David on version 2=0D =0D v2:=0D - remove PATCH 4=0D - rewrite PATCH 2 and 3 to follow passt coding style=0D - move some code from PATCH 3 to PATCH 4 (previously PATCH 5)=0D - partially addressed David's comment on PATCH 5=0D =0D David Gibson (2):=0D tcp_vu: Share more header construction between IPv4 and IPv6 paths=0D tcp: Move tcp_l2_buf_fill_headers() to tcp_buf.c=0D =0D Laurent Vivier (7):=0D packet: replace struct desc by struct iovec=0D vhost-user: introduce virtio API=0D vhost-user: introduce vhost-user API=0D udp: Prepare udp.c to be shared with vhost-user=0D tcp: Export headers functions=0D passt: rename tap_sock_init() to tap_backend_init()=0D vhost-user: add vhost-user=0D =0D Stefano Brivio (1):=0D test: Add tests for passt in vhost-user mode=0D =0D Makefile | 9 +-=0D conf.c | 21 +-=0D epoll_type.h | 4 +=0D iov.c | 1 -=0D isolation.c | 17 +-=0D packet.c | 91 ++--=0D packet.h | 22 +-=0D passt.1 | 10 +-=0D passt.c | 11 +-=0D passt.h | 7 +=0D pcap.c | 1 -=0D tap.c | 129 ++++--=0D tap.h | 7 +-=0D tcp.c | 76 +---=0D tcp_buf.c | 39 +-=0D tcp_internal.h | 19 +-=0D tcp_vu.c | 494 +++++++++++++++++++++=0D tcp_vu.h | 12 +=0D test/lib/perf_report | 15 +=0D test/lib/setup | 77 +++-=0D test/lib/setup_ugly | 2 +-=0D test/passt_vu | 1 +=0D test/passt_vu_in_ns | 1 +=0D test/perf/passt_vu_tcp | 211 +++++++++=0D test/perf/passt_vu_udp | 159 +++++++=0D test/run | 25 ++=0D test/two_guests_vu | 1 +=0D udp.c | 85 ++--=0D udp_internal.h | 34 ++=0D udp_vu.c | 336 ++++++++++++++=0D udp_vu.h | 13 +=0D util.h | 9 +=0D vhost_user.c | 981 +++++++++++++++++++++++++++++++++++++++++=0D vhost_user.h | 206 +++++++++=0D virtio.c | 660 +++++++++++++++++++++++++++=0D virtio.h | 184 ++++++++=0D vu_common.c | 285 ++++++++++++=0D vu_common.h | 60 +++=0D 38 files changed, 4113 insertions(+), 202 deletions(-)=0D create mode 100644 tcp_vu.c=0D create mode 100644 tcp_vu.h=0D create mode 120000 test/passt_vu=0D create mode 120000 test/passt_vu_in_ns=0D create mode 100644 test/perf/passt_vu_tcp=0D create mode 100644 test/perf/passt_vu_udp=0D create mode 120000 test/two_guests_vu=0D create mode 100644 udp_internal.h=0D create mode 100644 udp_vu.c=0D create mode 100644 udp_vu.h=0D create mode 100644 vhost_user.c=0D create mode 100644 vhost_user.h=0D create mode 100644 virtio.c=0D create mode 100644 virtio.h=0D create mode 100644 vu_common.c=0D create mode 100644 vu_common.h=0D =0D --=20=0D 2.47.0=0D =0D