From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 3EE015A0082 for ; Thu, 5 Jan 2023 06:45:48 +0100 (CET) Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4Nnb6Z1bCLz4xyY; Thu, 5 Jan 2023 16:45:42 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=201602; t=1672897542; bh=NiYGIp7sgnoATDds5Mu1sqrzRlkUQ4938zIXpJPN1IY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=e1qVRcJiqnhk4IXpWP1JCinuZo7frqxeezAukvoOH3ZZ4bdFnWNwqbPvuT6SJa2Tb +ZP6oBBBlBuDbnK5EVoLX0Sm47VYKRksbuqJjyo1F0FcHYJzGFkhuI64+ViM4LXpnf VPoLF4g4Jhrao2jtzPGgFOHaXcfoOaz0QWh6O80g= Date: Thu, 5 Jan 2023 15:57:21 +1100 From: David Gibson To: Stefano Brivio Subject: Re: [PATCH v2 18/18] tap: Improve handling of partial frame sends Message-ID: References: <20221209054228.4085990-1-david@gibson.dropbear.id.au> <20221209054228.4085990-19-david@gibson.dropbear.id.au> <20230104184533.0f9ea7b4@elisabeth> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="UzbwJGyuYV5qfvPV" Content-Disposition: inline In-Reply-To: <20230104184533.0f9ea7b4@elisabeth> Message-ID-Hash: DMO5MRVVXHW7ZLOYCBW2SWZ2IXGOKQ76 X-Message-ID-Hash: DMO5MRVVXHW7ZLOYCBW2SWZ2IXGOKQ76 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.3 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: --UzbwJGyuYV5qfvPV Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jan 04, 2023 at 06:45:33PM +0100, Stefano Brivio wrote: > On Fri, 9 Dec 2022 16:42:28 +1100 > David Gibson wrote: >=20 > > In passt mode, when writing frames to the qemu socket, we might get a s= hort > > send. If we ignored this and carried on, the qemu socket would get out= of > > sync, because the bytes we actually sent wouldn't correspond to the le= ngth > > header we already sent. tap_send_frames_passt() handles that by doing a > > a blocking send to complete the message, but it has a few flaws: > > * We only attempt to resend once: although it's unlikely in practice, > > nothing prevents the blocking send() from also being short > > * We print a debug error if send() returns non-zero.. but send() retur= ns > > the number of bytes sent, so we actually want it to return the length > > of the remaining data. > >=20 > > Correct those flaws and also be a bit more thorough about reporting > > problems here. > >=20 > > Signed-off-by: David Gibson > > --- > > tap.c | 51 ++++++++++++++++++++++++++++++++++++++------------- > > 1 file changed, 38 insertions(+), 13 deletions(-) > >=20 > > diff --git a/tap.c b/tap.c > > index 5ec6b70..4fb27ca 100644 > > --- a/tap.c > > +++ b/tap.c > > @@ -326,13 +326,39 @@ static void tap_send_frames_pasta(struct ctx *c, > > } > > } > > =20 > > +/** > > + * tap_send_remainder() - Send remainder of a partiall sent frame >=20 > s/partiall/partially/ Fixed. > > + * @c: Execution context > > + * @iov: Partially sent buffer > > + * @offset: Number of bytes already sent from @iov > > + * > > + * #syscalls:passt sendto >=20 > We should probably drop this, it's actually send(2) on armv6/armv7 and > ppc64le, sendto(2) otherwise -- initially I sprinkled those annotations > all over the place to show where specific calls were issued (and make > it easier to drop them from the filter if calls disappeared) but I > think it's not really practical for send(3). Heh, right. Done. --=20 David Gibson | 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 --UzbwJGyuYV5qfvPV Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEoULxWu4/Ws0dB+XtgypY4gEwYSIFAmO2WKoACgkQgypY4gEw YSIspw/8CznXK4Ns8rYMqzgR56cbhPBCrkVbjaO4dUTfvINREUyi8UEAeqBpou+j BhEQOqNStmf6M89fvcvoSfMTc76VZtFdAnTZLtWdPF/YGtvRzgcmZ8IV9BgNKaZ/ hmTloNbPPXPVeskTuTRC3u2ENK9eu1yd7O58rld0lyKzUVP/7CQ6937d1/OvfsZO /mBUc7+TVp2DEXd5o6KCRAZ5XwyKMUxSmQdjvb2OXpKx2Of0qIBSqUYt2j/H3s1Q oJqGb+W6uMTsm2nvyTjoYO76tjXi+Y9r0bk8V+KVncBY3EWbU2LQDI1/H/q5+ly1 kv+WUUxOUlAdBtCb2N09lH/0yyPmI8GJsa5kUbAwkUAaawccF18Jb1dE5iV7sO/m ytntqWeCV6NJymBT5eFViAN+xDHwkoLbnEPiWodWKwKospPn+fgre5S+nKdv9b0h oBJKbZKbxLKU9So/5tAeraJPXNRKC9yTz6qm0vKouabY96n6tkFDQICWthGNZtGy GwHWmjUCKWHce/qcRpdE//ECd8VwvbsMSzKVK5xeZ0069COXHrcsFJsfB4PB2+1q GWtQrsajzLn9vZufWLlTTabJz8mF/wFneQaEAEkQg3RT+fGUBgeuNUSSRH/8Bf1T Uu44aEcwt5NVMoHdxqj8Yt4nVpQ04hFC0u0xPTDwJSSM1In/tUE= =1NRW -----END PGP SIGNATURE----- --UzbwJGyuYV5qfvPV--