From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: passt.top; dkim=pass (2048-bit key; secure) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.a=rsa-sha256 header.s=202602 header.b=Q/3edPaE; dkim-atps=neutral Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 7E7F65A0269 for ; Thu, 12 Mar 2026 11:19:33 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202602; t=1773310768; bh=oNKJ2jmi/VmbvHOZ72/BKrojsMSLSobla+IvBMmAzdA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Q/3edPaEAoCPj109r7SC2WAYzbkFDiKnn/iqa7tl6U1tUM89GxQVlQWYYiVD13gB2 G5+SPgFqzg5WB+hdfnn9t9uOI007Q+79//Lz5l6nDKSlvooukYqud57tOhmRhzwWQr jqoryLnNYOTNM5PzjzQRetU3t1eaGkRM1FOlVNA6ufBgxPfNPPpIPsvALpVEw9YIQx AqTUQW1hu+dbkTEHV+AfG6/+AwMWxDXqIDRgx8JphHA3NEJPuwH6MEQ1wJ+LTWGYeQ 4oMb9UpfOwPkTNZw3YGr/EYRSRC2Jdk1i6DoiSuF3ZIeNLEp3yoMHdg1XPNSp8Yibt 9BKlfC9jqCAjA== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4fWkB83Hf9z4wM0; Thu, 12 Mar 2026 21:19:28 +1100 (AEDT) Date: Thu, 12 Mar 2026 20:47:51 +1100 From: David Gibson To: Laurent Vivier Subject: Re: [PATCH v2 13/13] vhost-user,udp: Use 2 iovec entries per element Message-ID: References: <20260309094744.1907754-1-lvivier@redhat.com> <20260309094744.1907754-14-lvivier@redhat.com> <43363999-76cf-4f4c-a73d-450c5906e6b9@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="P2mUo7MevN9BbnMN" Content-Disposition: inline In-Reply-To: <43363999-76cf-4f4c-a73d-450c5906e6b9@redhat.com> Message-ID-Hash: 4KRNOULV22RUXNG5ZSZUGCFJHCF6OL24 X-Message-ID-Hash: 4KRNOULV22RUXNG5ZSZUGCFJHCF6OL24 X-MailFrom: dgibson@gandalf.ozlabs.org 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: passt-dev@passt.top 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: --P2mUo7MevN9BbnMN Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Mar 12, 2026 at 09:08:33AM +0100, Laurent Vivier wrote: > On 3/12/26 05:39, David Gibson wrote: > > On Mon, Mar 09, 2026 at 10:47:44AM +0100, Laurent Vivier wrote: > > > iPXE places the vnet header in one virtqueue descriptor and the paylo= ad > > > in another. When passt maps these descriptors, it needs two iovecs per > > > virtqueue element to handle this layout. > > >=20 > > > Without this, passt crashes with: > > >=20 > > > ASSERTION FAILED in virtqueue_map_desc (virtio.c:403): num_sg < ma= x_num_sg > > >=20 > > > Signed-off-by: Laurent Vivier > > > --- > > > udp_vu.c | 8 ++++---- > > > vu_common.c | 15 +++++++++++---- > > > 2 files changed, 15 insertions(+), 8 deletions(-) > > >=20 > > > diff --git a/udp_vu.c b/udp_vu.c > > > index cb5274aa1d81..47659b0402fd 100644 > > > --- a/udp_vu.c > > > +++ b/udp_vu.c > > > @@ -34,7 +34,7 @@ > > > #include "vu_common.h" > > > static struct iovec iov_vu [VIRTQUEUE_MAX_SIZE]; > > > -static struct vu_virtq_element elem [VIRTQUEUE_MAX_SIZE]; > > > +static struct vu_virtq_element elem [VIRTQUEUE_MAX_SIZE / IOV_PER_EL= EM]; > >=20 > > The two level structure of the queues (array of elems, each pointing > > to an array of iovs) confuses me a bit. I would have thought that > > VIRTQUEUE_MAX_SIZE represented the maximum number of elements, even if > > those elements had multiple iovs. Can you enlighten me? > >=20 > In all the code until now I supposed the number of iovec is equal to the > number of element because we had only one iovec per element. >=20 > At virtio level, VIRTQUEUE_MAX_SIZE is the number of vring_desc in a > virtqueue, and a vring_desc is translated to an iovec in > virtqueue_map_desc() that are collected to an element in > vu_queue_map_desc(). So in passt, the maximum number of collected iovec w= ill > be > VIRTQUEUE_MAX_SIZE and the maximum of element is VIRTQUEUE_MAX_SIZE if we > have only one iovec per element. Ok... sorry, I'm still unclear. Is the "element" a concept that's part of the "hardware" interface? Or just part of the structure on the software side? > I'm reworking all of this to be able to have several iovec per element on > demand (in vu_queue_map_desc()). This patch and previous one will be > dropped. Ok. --=20 David Gibson (he or they) | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you, not the other way | around. http://www.ozlabs.org/~dgibson --P2mUo7MevN9BbnMN Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmmyi70ACgkQzQJF27ox 2GeZsBAApt2KElxzvimVc/nPnVYUjEWrXkGVbRx82BSp0nobgebETycEZCXPbnKy vqK1VAELxlVbC2aiATkoNaHXKNUvT/kRn3dUHDvJcpk5TmWB3lwJMy5WzK52WfNH ovdlBmZOp7jU+XaGT+RhaP1npk/wMnr6kHYquxLC0EBxCvR2eGdC91ozdaBeRciG qXwncuEJTh5DQmd9tpd16XnIjxV+CPkU5s7SeKmlENSn9jNcje8DIfc/rJQXTZOU 9nDGdo6PFGZmZq2GEOicHYZGbZ4Jn1sf6yf62n8YfHmhtr9hWFIVQWkGdSESNslh H5Mm/Pa5ypZlpL4lgvVWDrLbGbBPYvq6Hqzg7E8zXQXODjSGvxit5FCfGXrgJsZs U2+yxIlCmgKgeqG8MOW/G5XmMUOK/AExGzUtS8IHn1W0X5B9xOacy5tn2NaBc6A5 CJh+pY7j8ahdH8CQY1NCaHF3qhsYNghkBMKnrVzxlXoDEuP9/FxZW3Z1GjcaGI87 37MarilJErqnYViHMD2Rl+4mBPxg49OCQ6Vv+1CNwr/Jm6srWlN2snJsdIWFGoW6 +niLuijbIG+rw+cYPEGhlw/gihAYdvAWEVBoRAhjV3lNBO0zHOVD4/PsR50d68k9 TICv2VRFm5hkzWO73JIfwOHuoKuqHmdDJJkqRYteaqpxFj1Pnq0= =k4dJ -----END PGP SIGNATURE----- --P2mUo7MevN9BbnMN--