From: Jon Maloy <jmaloy@redhat.com>
To: Laurent Vivier <lvivier@redhat.com>, passt-dev@passt.top
Cc: David Gibson <david@gibson.dropbear.id.au>,
Lynxes Exe <lynxes.exe@gmail.com>,
Stefano Brivio <sbrivio@redhat.com>
Subject: Re: [PATCH v2] migrate, tcp: Account for bytes acknowledged before migration
Date: Fri, 4 Dec 2026 14:24:21 -0500 [thread overview]
Message-ID: <b2f72253-84a4-4d41-bbf1-4596ecd40783@redhat.com> (raw)
In-Reply-To: <20261204122802.1235595-1-lvivier@redhat.com>
On 2026-12-04 07:28, Laurent Vivier wrote:
> The repaired socket starts with tcpi_bytes_acked at zero. Even though
> seq_ack_to_tap is migrated, ACKs computed afterward from tcpi_bytes_acked
> are missing the progress made on the source.
>
> If the target uses this counter, it can send an ACK older than the last
> ACK the guest received before migration. The guest keeps retransmitting
> the first segment it is still waiting for passt to acknowledge, and
> rampstream_out can stall.
Strictly speaking, we never send an older ACK, because
tcp_update_seqack_wnd() doesn't let seq_ack_to_tap go backwards. The
ACK instead gets stuck at the migrated value until the new socket has
acknowledged as much data as the old one did, and that's what makes
the guest stall.
>
> A bug in tcp_rtt_dst_check() hid this in our tests. On a repaired
> socket, tcpi_min_rtt is ~0U until the first RTT sample. The cast to
> int turned ~0U into -1, so the target added the peer to low_rtt_dst[]
[...]
> --- a/tcp.c
> +++ b/tcp.c
> @@ -220,7 +220,7 @@
> * @seq_from_tap: next sequence for packets from tap/guest (expected)
> * @seq_ack_to_tap: last ACK number sent to tap/guest
> *
> - * @seq_init_from_tap: initial sequence number from tap/guest
> + * @seq_init_from_tap: guest sequence base for bytes acknowledged by the peer
> * @seq_init_to_tap: initial sequence number from tap/guest
> *
> * @wnd_from_tap: last window size received from tap, never scaled
> @@ -3936,6 +3936,18 @@ int tcp_flow_migrate_target_ext(struct ctx *c, struct tcp_tap_conn *conn,
> return -EINVAL;
> }
>
> + /* The target socket's tcpi_bytes_acked starts at zero after migration.
> + * Subtract the length of the current sending queue from the accepted
> + * guest sequence to recover the amount of bytes the peer had already
> + * acknowledged.
> + *
> + * Add this offset to the initial sequence number, to correctly adjust
> + * the acknowledgement sequence number we send to the guest, as
> + * calculated by tcp_update_seqack_wnd().
> + */
The code doesn't actually add anything to the initial sequence number, it
just replaces it with a sequence that already includes the offset.
> +
> + conn->seq_init_from_tap = conn->seq_from_tap - t.sndq;
> +
[...]
I tested with the migrate tests, on top of a local change dropping the
(int) cast in tcp_rtt_dst_check(), so that the bug isn't hidden.
- without your patch, migrate/rampstream_out ==> hangs
- with it, migrate/rampstream_out ==> passes
migrate/iperf3_many_out6 (host to guest part) and migrate/rampstream_in
fail here with and without your patch, also on plain master, and
migrate/iperf3_bidir6 seems to be flaky either way. That last issue
seems to come from tcp_flow_repair_queue() failing with EAGAIN on the
non-blocking target socket, for 77 of 128 flows in one run. I believe
this is because the queues don't fit in the new socket's send buffer yet.
I can look into this separately, it's not related to this patch.
With or without updated comments:
Reviewed-by: Jon Maloy <jmaloy@redhat.com>
Tested-by: Jon Maloy <jmaloy@redhat.com>
next prev parent reply other threads:[~2026-12-04 19:24 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 12:28 Laurent Vivier
2026-12-04 19:24 ` Jon Maloy [this message]
2026-12-04 20:56 ` Stefano Brivio
2026-12-04 21:15 ` Jon Maloy
2026-12-04 22:31 ` Stefano Brivio
-- strict thread matches above, loose matches on Subject: below --
2026-12-04 10:49 Laurent Vivier
2026-12-04 12:14 ` 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=b2f72253-84a4-4d41-bbf1-4596ecd40783@redhat.com \
--to=jmaloy@redhat.com \
--cc=david@gibson.dropbear.id.au \
--cc=lvivier@redhat.com \
--cc=lynxes.exe@gmail.com \
--cc=passt-dev@passt.top \
--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).