public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: Stefano Brivio <sbrivio@redhat.com>
To: Laurent Vivier <lvivier@redhat.com>
Cc: passt-dev@passt.top, Jon Maloy <jmaloy@redhat.com>,
	David GIbson <david@gibson.dropbear.id.au>
Subject: Re: [PATCH v4 00/10] vhost-user: Preparatory series for multiple iovec entries per virtqueue element
Date: Wed, 20 May 2026 22:53:43 +0200 (CEST)	[thread overview]
Message-ID: <20260520225340.54490a21@elisabeth> (raw)
In-Reply-To: <20260520181852.1f0119ff@elisabeth>

On Wed, 20 May 2026 18:18:52 +0200
Stefano Brivio <sbrivio@redhat.com> wrote:

> On Wed, 20 May 2026 18:07:08 +0200
> Stefano Brivio <sbrivio@redhat.com> wrote:
> 
> > On Wed, 20 May 2026 17:34:45 +0200
> > Stefano Brivio <sbrivio@redhat.com> wrote:
> >   
> > > On Wed, 13 May 2026 13:52:08 +0200
> > > Laurent Vivier <lvivier@redhat.com> wrote:
> > >     
> > > > Currently, the vhost-user path assumes each virtqueue element contains
> > > > exactly one iovec entry covering the entire frame.  This assumption
> > > > breaks as some virtio-net drivers (notably iPXE) provide descriptors where the
> > > > vnet header and the frame payload are in separate buffers, resulting in
> > > > two iovec entries per virtqueue element.
> > > > 
> > > > This series refactors the vhost-user data path so that frame lengths,
> > > > header sizes, and padding are tracked and passed explicitly rather than
> > > > being derived from iovec sizes.  This decoupling is a prerequisite for
> > > > correctly handling padding of multi-buffer frames.      
> > > 
> > > Sorry to bring (likely) bad news, but this series seems to introduce a
> > > regression: I got the migration/rampstream_in tests fail twice in a
> > > row, which I've never saw happening (I think I saw a single failure a
> > > long time ago when the machine had a high CPU load, but nothing else).
> > > 
> > > I'm currently bisecting and the bisect seems to point towards the end
> > > of the series (probably 10/10), but I haven't finished yet. I'll keep
> > > you posted. I haven't spotted anything that might cause issues there.    
> > 
> > Yeah, that's the one :(
> > 
> > $ git bisect bad
> > db798fc60f4c5869cb53168354e068fb4dabd91a is the first bad commit
> > commit db798fc60f4c5869cb53168354e068fb4dabd91a
> > Author: Laurent Vivier <lvivier@redhat.com>
> > Date:   Wed May 13 13:52:18 2026 +0200
> > 
> >     vhost-user: Centralise Ethernet frame padding in vu_collect() and vu_pad()
> > 
> > The "TCP/IPv4: sequence check, ramps, inbound" test in rampstream_in
> > gets stuck, once the source is done with the migration, and passt on the
> > destination just printed:
> > 
> > Accepted TCP_REPAIR helper, PID 13
> > accepted connection from PID 16
> > 
> > I'll get captures and logs next. It seems to fail most of the times,
> > I had two failures in a row again.  
> 
> Log from passt --debug attached. Likely highlight:
> 
> ---
> 13.2853: ================ Vhost user message ================
> 13.2853: Request: VHOST_USER_SET_VRING_ADDR (9)
> 13.2853: Flags:   0x1
> 13.2853: Size:    40
> 13.2853: vhost_vring_addr:
> 13.2853:     index:  0
> 13.2853:     flags:  0
> 13.2853:     desc_user_addr:   0x00007f0943f41000
> 13.2853:     used_user_addr:   0x00007f0943f42240
> 13.2854:     avail_user_addr:  0x00007f0943f42000
> 13.2854:     log_guest_addr:   0x000000001ff43240
> 13.2854: Setting virtq addresses:
> 13.2854:     vring_desc  at 0x7f2e2e2ca000
> 13.2854:     vring_used  at 0x7f2e2e2cb240
> 13.2854:     vring_avail at 0x7f2e2e2cb000
> 13.2854: Last avail index != used index: 2163 != 1936
> 13.2854: Got packet, but RX virtqueue not usable yet
> ---
> 
> pcap file of that passt instance empty, it didn't have a chance to
> send/receive packets yet.

...but I bisected 10/10 itself, and realised that reverting the
iov_truncate() -> iov_skip_bytes() conversion in tcp_vu_sock_recv()
like this:

---
diff --git a/tcp_vu.c b/tcp_vu.c
index f6ac76e..ccc031e 100644
--- a/tcp_vu.c
+++ b/tcp_vu.c
@@ -249,11 +249,7 @@ static ssize_t tcp_vu_sock_recv(const struct ctx
*c, struct vu_virtq *vq, if (!peek_offset_cap)
 		ret -= already_sent;
 
-	i = iov_skip_bytes(&iov_vu[DISCARD_IOV_NUM], iov_used,
-			   MAX(hdrlen + ret, VNET_HLEN + ETH_ZLEN),
-			   NULL);
-	if ((size_t)i < iov_used)
-		i++;
+	i = iov_truncate(&iov_vu[DISCARD_IOV_NUM], iov_used, ret);
 
 	/* adjust head count */
 	while (*head_cnt > 0 && head[*head_cnt - 1] >= i)
---

hides / fixes the issue.

I'm testing things on a kernel without SO_PEEK_OFF support for TCP, but
it doesn't seem to matter ('ret' at this point is the same before and
after your patch).

I don't see what's wrong with your change though. It's not even about
replacing 'ret' with the padded version, because I can also reproduce
the issue with:

	i = iov_skip_bytes(&iov_vu[DISCARD_IOV_NUM], iov_used, ret,
			   NULL);

For convenience, this is how I'm selecting the test without bothering
about variables in run():

---
diff --git a/test/run b/test/run
index f858e55..25d7002 100755
--- a/test/run
+++ b/test/run
@@ -71,6 +71,7 @@ run() {
 	perf_init
 	[ ${CI} -eq 1 ]   && video_start ci
 
+dont() {
 	exeter smoke/smoke.sh
 	exeter build/build.py
 	exeter build/static_checkers.sh
@@ -162,6 +163,10 @@ run() {
 	setup migrate
 	test migrate/iperf3_many_out6
 	teardown migrate
+}
+	VHOST_USER=1
+	VALGRIND=0
+
 	setup migrate
 	test migrate/rampstream_in
 	teardown migrate
---

-- 
Stefano


      reply	other threads:[~2026-05-20 20:53 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-13 11:52 Laurent Vivier
2026-05-13 11:52 ` [PATCH v4 01/10] iov: Introduce iov_memset() Laurent Vivier
2026-05-13 11:52 ` [PATCH v4 02/10] iov: Add iov_memcpy() to copy data between iovec arrays Laurent Vivier
2026-05-13 11:52 ` [PATCH v4 03/10] vu_common: Move vnethdr setup into vu_flush() Laurent Vivier
2026-05-13 11:52 ` [PATCH v4 04/10] udp_vu: Move virtqueue management from udp_vu_sock_recv() to its caller Laurent Vivier
2026-05-13 11:52 ` [PATCH v4 05/10] udp_vu: Pass iov explicitly to helpers instead of using file-scoped array Laurent Vivier
2026-05-13 11:52 ` [PATCH v4 06/10] checksum: Pass explicit L4 length to checksum functions Laurent Vivier
2026-05-13 11:52 ` [PATCH v4 07/10] pcap: Pass explicit L2 length to pcap_iov() Laurent Vivier
2026-05-13 11:52 ` [PATCH v4 08/10] vu_common: Pass explicit frame length to vu_flush() Laurent Vivier
2026-05-13 11:52 ` [PATCH v4 09/10] tcp: Pass explicit data length to tcp_fill_headers() Laurent Vivier
2026-05-13 11:52 ` [PATCH v4 10/10] vhost-user: Centralise Ethernet frame padding in vu_collect() and vu_pad() Laurent Vivier
2026-05-14  1:24   ` David Gibson
2026-05-20  0:52 ` [PATCH v4 00/10] vhost-user: Preparatory series for multiple iovec entries per virtqueue element Stefano Brivio
2026-05-20 15:34 ` Stefano Brivio
2026-05-20 16:07   ` Stefano Brivio
2026-05-20 16:18     ` Stefano Brivio
2026-05-20 20:53       ` Stefano Brivio [this message]

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=20260520225340.54490a21@elisabeth \
    --to=sbrivio@redhat.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=jmaloy@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).