From: David Gibson <david@gibson.dropbear.id.au>
To: Stefano Brivio <sbrivio@redhat.com>
Cc: passt-dev@passt.top, Paul Holzinger <pholzing@redhat.com>,
Anshu Kumari <anskuma@redhat.com>
Subject: Re: [PATCH 1/6] tcp_splice: Improve error reporting
Date: Thu, 21 May 2026 10:43:37 +1000 [thread overview]
Message-ID: <ag5VOVp6-3jNWOMR@zatzit> (raw)
In-Reply-To: <20260520163133.5b27d27c@elisabeth>
[-- Attachment #1: Type: text/plain, Size: 4227 bytes --]
On Wed, May 20, 2026 at 04:31:34PM +0200, Stefano Brivio wrote:
> On Wed, 20 May 2026 23:08:46 +1000
> David Gibson <david@gibson.dropbear.id.au> wrote:
>
> > 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.
> >
> > Add a bunch of debug and error logging to make this easier to figure out.
> >
> > Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
> > ---
> > tcp_splice.c | 31 +++++++++++++++++++++++--------
> > 1 file changed, 23 insertions(+), 8 deletions(-)
> >
> > 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;
> > }
> >
> > if (conn->events == SPLICE_CONNECT) {
> > - if (!(events & EPOLLOUT))
> > + if (!(events & EPOLLOUT)) {
> > + flow_err(conn, "Unexpected events 0x%x during connect",
> > + events);
>
> 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.
>
> > 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 == EINTR);
> >
> > - if (readlen < 0 && errno != EAGAIN)
> > + if (readlen < 0 && errno != EAGAIN) {
> > + flow_perror(conn, "Splicing from %s socket",
> > + pif_name(conn->f.pif[fromsidei]));
> > goto reset;
> > + }
> >
> > flow_trace(conn, "%zi from read-side call", readlen);
> >
> > @@ -569,8 +575,11 @@ retry:
> > SPLICE_F_MOVE | more | SPLICE_F_NONBLOCK);
> > while (written < 0 && errno == EINTR);
> >
> > - if (written < 0 && errno != EAGAIN)
> > + if (written < 0 && errno != EAGAIN) {
> > + flow_perror(conn, "Splicing to %s socket",
> > + pif_name(conn->f.pif[!fromsidei]));
> > goto reset;
> > + }
> >
> > 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;
> > }
> >
> > - 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;
> > + }
> >
> > return;
> >
>
> --
> Stefano
>
--
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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2026-05-21 2:29 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-20 13:08 [PATCH 0/6] Fix race condition while closing spliced connections David Gibson
2026-05-20 13:08 ` [PATCH 1/6] tcp_splice: Improve error reporting David Gibson
2026-05-20 14:31 ` Stefano Brivio
2026-05-21 0:43 ` David Gibson [this message]
2026-05-21 5:08 ` Stefano Brivio
2026-05-20 13:08 ` [PATCH 2/6] tcp_splice: Avoid missing EOF recognition while forwarding David Gibson
2026-05-20 20:28 ` Stefano Brivio
2026-05-21 0:46 ` David Gibson
2026-05-20 13:08 ` [PATCH 3/6] tcp_splice: Clean up flow control path for splice forwarding David Gibson
2026-05-20 20:28 ` Stefano Brivio
2026-05-21 0:50 ` David Gibson
2026-05-20 13:08 ` [PATCH 4/6] tcp_splice: Simplify tracking of read/written bytes David Gibson
2026-05-20 20:29 ` Stefano Brivio
2026-05-21 0:54 ` David Gibson
2026-05-20 13:08 ` [PATCH 5/6] tcp_splice: Simplify EPOLLRDHUP / eof / FIN handling David Gibson
2026-05-20 20:30 ` Stefano Brivio
2026-05-21 2:03 ` David Gibson
2026-05-21 5:40 ` Stefano Brivio
2026-05-21 6:56 ` David Gibson
2026-05-21 7:15 ` Stefano Brivio
2026-05-21 13:51 ` David Gibson
2026-05-21 15:18 ` Stefano Brivio
2026-05-22 1:29 ` David Gibson
2026-05-20 13:08 ` [PATCH 6/6] tcp_splice: Simplify shutdown(2) handling David Gibson
2026-05-20 20:30 ` Stefano Brivio
2026-05-21 2:11 ` David Gibson
2026-05-21 5:40 ` Stefano Brivio
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=ag5VOVp6-3jNWOMR@zatzit \
--to=david@gibson.dropbear.id.au \
--cc=anskuma@redhat.com \
--cc=passt-dev@passt.top \
--cc=pholzing@redhat.com \
--cc=sbrivio@redhat.com \
/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).