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=cY5pBv6o; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 312855A0262 for ; Thu, 21 May 2026 04:29:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202602; t=1779330549; bh=Gj/k7KdBkuEwDQgIH8mJ5Ibl1vDbTiwxaDv1RLzseAE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=cY5pBv6o1vvJRlhHpneqyPmeAX8MioR4+3cwRZhaepP/WuU2Vdt4sJDs/jRvWxC49 YPUIzdwWw/2eq6gDHZLuvlkHwQkgj7fw5CR2/7KGHn5xRsCw8GtZaHvd6XEFrgPhHX WGSfIu+3wcHvbXRctp/3reaztVT5r+MUo/QNlfOJ9ePx+NF8T3r9MRZ0nRQM1RNkmK fY/zrCi2uW9mHyf8Ejne4zfTw6z6Y/FUrYo/vw/ubqBc1jRQnJozNN9n3BsuNqZhqE Q9s5kQREy6RI7Vqurn9o+6qa7pXap8TQeoSef+OYEiaKyveFevcs5Rx70wWzsi5ZGf wm7biNPhuCw9Q== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4gLXR95mzLz4wLN; Thu, 21 May 2026 12:29:09 +1000 (AEST) Date: Thu, 21 May 2026 10:43:37 +1000 From: David Gibson To: Stefano Brivio Subject: Re: [PATCH 1/6] tcp_splice: Improve error reporting Message-ID: References: <20260520130851.436931-1-david@gibson.dropbear.id.au> <20260520130851.436931-2-david@gibson.dropbear.id.au> <20260520163133.5b27d27c@elisabeth> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="CmXb+uY5+P3XR0La" Content-Disposition: inline In-Reply-To: <20260520163133.5b27d27c@elisabeth> Message-ID-Hash: OT3AKYPVVN34JC7BY4XDN5QC7G4GJTRG X-Message-ID-Hash: OT3AKYPVVN34JC7BY4XDN5QC7G4GJTRG 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, Paul Holzinger , Anshu Kumari 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: --CmXb+uY5+P3XR0La Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, May 20, 2026 at 04:31:34PM +0200, Stefano Brivio wrote: > On Wed, 20 May 2026 23:08:46 +1000 > David Gibson wrote: >=20 > > A number of things can, at least theoretically, go wrong when forwarding > > data across a spliced connection. We generally handle this by resetting > > the connection on both sides. However, in many cases we don't log any > > message about why the connection was reset, which can make it hard to > > debug why this is happening. > >=20 > > Add a bunch of debug and error logging to make this easier to figure ou= t. > >=20 > > Signed-off-by: David Gibson > > --- > > tcp_splice.c | 31 +++++++++++++++++++++++-------- > > 1 file changed, 23 insertions(+), 8 deletions(-) > >=20 > > diff --git a/tcp_splice.c b/tcp_splice.c > > index 42ee8abc..1359d6b8 100644 > > --- a/tcp_splice.c > > +++ b/tcp_splice.c > > @@ -502,15 +502,18 @@ void tcp_splice_sock_handler(struct ctx *c, union= epoll_ref ref, > > if (rc) > > flow_perror(conn, "Error retrieving SO_ERROR"); > > else > > - flow_trace(conn, "Error event on socket: %s", > > - strerror_(err)); > > - > > + flow_dbg(conn, "Error event on %s socket: %s", > > + pif_name(conn->f.pif[evsidei]), > > + strerror_(err)); > > goto reset; > > } > > =20 > > if (conn->events =3D=3D SPLICE_CONNECT) { > > - if (!(events & EPOLLOUT)) > > + if (!(events & EPOLLOUT)) { > > + flow_err(conn, "Unexpected events 0x%x during connect", > > + events); >=20 > Shouldn't all the flow_err() and flow_perror() calls here be > ratelimited, that is, eventually calling the err_ratelimit() function > Anshu introduced recently? I did think about that, I concluded it wasn't necessary here because it indicates that something has gone unexpectedly wrong at the kernel level, it's not guest triggerable. I can put in ratelimits if you still think they're necessary. > We don't have helpers ready for flow_err() and flow_perror(), I was > about to post a patch that would go before this series but I'm not sure > if there's a specific reason to avoid those. >=20 > > goto reset; > > + } > > if (tcp_splice_connect_finish(c, conn)) > > goto reset; > > } > > @@ -545,8 +548,11 @@ retry: > > SPLICE_F_MOVE | SPLICE_F_NONBLOCK); > > while (readlen < 0 && errno =3D=3D EINTR); > > =20 > > - if (readlen < 0 && errno !=3D EAGAIN) > > + if (readlen < 0 && errno !=3D EAGAIN) { > > + flow_perror(conn, "Splicing from %s socket", > > + pif_name(conn->f.pif[fromsidei])); > > goto reset; > > + } > > =20 > > flow_trace(conn, "%zi from read-side call", readlen); > > =20 > > @@ -569,8 +575,11 @@ retry: > > SPLICE_F_MOVE | more | SPLICE_F_NONBLOCK); > > while (written < 0 && errno =3D=3D EINTR); > > =20 > > - if (written < 0 && errno !=3D EAGAIN) > > + if (written < 0 && errno !=3D EAGAIN) { > > + flow_perror(conn, "Splicing to %s socket", > > + pif_name(conn->f.pif[!fromsidei])); > > goto reset; > > + } > > =20 > > flow_trace(conn, "%zi from write-side call (passed %zi)", > > written, c->tcp.pipe_size); > > @@ -627,8 +636,11 @@ retry: > > flow_foreach_sidei(sidei) { > > if ((conn->events & FIN_RCVD(sidei)) && > > !(conn->events & FIN_SENT(!sidei))) { > > - if (shutdown(conn->s[!sidei], SHUT_WR) < 0) > > + if (shutdown(conn->s[!sidei], SHUT_WR) < 0) { > > + flow_perror(conn, "shutdown() on %s", > > + pif_name(conn->f.pif[!sidei])); > > goto reset; > > + } > > conn_event(conn, FIN_SENT(!sidei)); > > } > > } > > @@ -647,8 +659,11 @@ retry: > > goto swap; > > } > > =20 > > - if (events & EPOLLHUP) > > + if (events & EPOLLHUP) { > > + flow_dbg(conn, "Hangup from %s socket", > > + pif_name(conn->f.pif[evsidei])); Except for this one, which is debug level for that reason. > > goto reset; > > + } > > =20 > > return; > > =20 >=20 > --=20 > Stefano >=20 --=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 --CmXb+uY5+P3XR0La Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmoOVSwACgkQzQJF27ox 2GcP8g//XdSmisEiHJf8KF1Th9Gs9v8/eG799om8q2yxvwAFz311B9YOObbE07nA Hipm+fr35tBpey+XpAWu2dy3k1Hf3UH/M1p0MKApjq0RUxDtSePAcI9so9/iaze3 7lZPy0504StN1kJHh63lWFnx8UZyq9Me5ifSc7mw2TZ5daDJsCJ+JEMy1Pmzg+g3 ag6emX80r4tTCS7wMqJkjn1yeW3qIPe9mh0CaLwDECEeuwpA1jj0fb3PGT87uUra egkG0qepCjLnzVnlEVRsLMxEgQSpzUrw5JHyRcZsMBh2aUFfSSBaX5RlT4rk4+Wv ARsLVPb/cqsXnjnWxZ0C3B+FAB7zijm2OL7+OvPmhlJjTpCjWAQ+0fpGbmJhrIrL QLT37AW/m6ChzQDtNXKJW7YVW90hw5yrW1rq2oordqFNmahK2UB6vy5J7Qry0Dls zf4idqRHkc0c0/fmT1AyQvkh2ClYNL7mkihMGnqqXzdtwMnimswGvCnS8R6gH8ry 9scB4qW1yi/rTA7hRcdckjzWLui1XQ8q9C3zf4QvdIxb7Byi2gJesrHauMYiKTcF A2e05OXHLao+yNBicbq1Af0u4W90nJgRgeCiNkK+jg2lFS/yTzH9/bSCiAuBs4ZE buG9C2R/hJLdl3UCZxSiLXMqkS33qFANH6WREjH3h5S53XQ2eP8= =tL6W -----END PGP SIGNATURE----- --CmXb+uY5+P3XR0La--