From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=fail (p=quarantine dis=none) header.from=redhat.com Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by passt.top (Postfix) with ESMTPS id 51D6B5A026E for ; Fri, 04 Dec 2026 21:56:06 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1796417765; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EK3/DP9uKeHFbOzd8y1dLNk+M4QwX3u88rtobJuwNvg=; b=h88RwBzKU+wa+CyAE7gpJOKhCEJniGDzKKqXOpe+xXmCd/nviwlRyA6C8pIOZiV/47pbio dCUfLA3zOBb4AfH+lr4ulys9pTlr28QtYXhkFSQI+DQzW0Y/Jac8sJhAjlE6ptB2lDbFAE JiEVEdA24G6GTYgcsHfVg+DMkVtoWUE= X-MC-Rep: binary re single Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-507-A1Wr_i_6Pn2o4HmYHpO9lA-1; Fri, 4 Dec 2026 20:56:03 +0000 X-MC-Unique: A1Wr_i_6Pn2o4HmYHpO9lA-1 X-Mimecast-MFC-AGG-ID: A1Wr_i_6Pn2o4HmYHpO9lA_1796417762 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-4994d67d0e3so10661455e9.2 for ; Fri, 04 Dec 2026 12:56:03 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796417762; x=1797022562; h=date:content-transfer-encoding:content-type:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to:content-type; bh=EK3/DP9uKeHFbOzd8y1dLNk+M4QwX3u88rtobJuwNvg=; b=iybce4xL4InSAmeMINwfEwh4c5A+yxDLEfACriPXKLyDKMHJa+LlNWsgNawWHIAymh 4E6i9ZpMHep21CSPd/AE97ZQqoevVR4tf5moDAGp7MF4gLEU5y8eZUJhYhr4P5bNYNHk lyyTC5DBpeEsxXDSen/dVw05NDmSeHzdicGiltWTmyRruky/KvyfqW3/JPgg/JeXfD9C kR8LXLqhOjDJHUmmGfII9uqfZv7hKLipPm1JX18V2fS9MkeCAyur2SjLB0dmL+aDroD9 +XUnu4vTND5jIiP4GClf9R08qxlKvya/ajkA8JPOrEY5XB0gUystvtw9tcFntkpG38fJ 0axQ== X-Forwarded-Encrypted: i=1; AL+hErHWy+GgPbUgTh/9ohw8XPUBHJJrrbGJP70pgGDuRi/OKH61jhRUmPl/lQ4Yz8RrOB82LKPSVvD5gLw=@passt.top X-Gm-Message-State: APuU4Z8nCePYvmP0l4l6B6peOWsr+K9fxY9+a1C+e0S+RIbE9fN1haNi bV7mPHscA4cKLDSNJo/+5LLtpy7zMgnrAnm1cggI3ZlFNGMfRZ/CLAAR03ej0S0H+eQqgYTlG4O CdrwUFkvnqTWaE97K+JkirSVZrYJZHAWdEMmsJhGP3mTfJoIjPqK/9w== X-Gm-Gg: AZFdTZcNYrfB5BwFMQqV3MdTKP6TzjvHAWbzaPN1u1QMpbYtXQ7pbiHUnY38pZih7BT LlFPoY0LrTJ2nGwz35UZSTIgYoCQOzy8jINbraN5Y1V4mOKY5I5waAFxFV18BXnCuhCGmn1yVWP 2R8an9pHWUVm0vxKEldG77PlpHf2Mv7xlHfy8tu5c/WB/kB1idla4DuguXNTNJFmH0qf33k2ZP+ hueHxe2Pj+utGr30fB82/ex6H1eDBU+AQzfZmQzPUd5X1fV/Dk3DOkNriU7xaOcZHffTDd2gfPc XBcem0sHy9foPx2r3rXpID9Z1ImAC3xDLTTTynSgoeUHk4qYSjzweQ0Gl4J5r5sq1LGIdrztuj8 mBX/7rwRoopT+9rrrADDLxzYbSMkE+Ab83g3R3OFiVIX3jxSTgBcDK+ivdy4MYPIGM34= X-Received: by 2002:a05:600c:4692:b0:4bb:a5e1:7257 with SMTP id 5b1f17b1804b1-4bbeb8d0d50mr56210125e9.33.1796417761909; Fri, 04 Dec 2026 12:56:01 -0800 (PST) X-Received: by 2002:a05:600c:4692:b0:4bb:a5e1:7257 with SMTP id 5b1f17b1804b1-4bbeb8d0d50mr56209955e9.33.1796417761462; Fri, 04 Dec 2026 12:56:01 -0800 (PST) Received: from maya.myfinge.rs (ifcgrfdd.trafficplex.cloud. [2a10:fc81:a806:d6a9::1]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bbf17160desm8770525e9.2.2026.12.04.12.56.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Dec 2026 12:56:00 -0800 (PST) From: Stefano Brivio To: Jon Maloy Subject: Re: [PATCH v2] migrate, tcp: Account for bytes acknowledged before migration Message-ID: <20261204215559.4061fadf@elisabeth> In-Reply-To: References: <20261204122802.1235595-1-lvivier@redhat.com> Organization: Red Hat X-Mailer: Claws Mail 4.2.0 (GTK 3.24.49; x86_64-pc-linux-gnu) MIME-Version: 1.0 Date: Fri, 04 Dec 2026 21:56:00 +0100 (CET) X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: hBvcaMRDN6_rLzsscRPzx-lTjajxfpcxKzsWI_AHvsg_1796417762 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: BVA2L3RHIQFAX6K2AYOKUGWWJF6224V4 X-Message-ID-Hash: BVA2L3RHIQFAX6K2AYOKUGWWJF6224V4 X-MailFrom: sbrivio@redhat.com 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: Laurent Vivier , passt-dev@passt.top, David Gibson , Lynxes Exe 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: On Fri, 4 Dec 2026 14:24:21 -0500 Jon Maloy wrote: > 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. Oops, you're right. Let me just add your note on merge, at this point of the commit message, as "Jon's note". > > 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. I still think that, conceptually, it does that, even though we don't have an addition below. And if the sequence didn't wrap yet, it's also what happens in practice. But if it wrapped, the comment might be misleading, my bad for suggesting this phrasing. Let me amend that on merge to: * Replace the initial sequence number with this quantity to adjust the * acknowledgement sequence number we send to the guest, as calculated by * tcp_update_seqack_wnd(). ...does it make sense? > > + > > + 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. They all work reliably on my setup, but: - I have rather large values for /proc/sys/net/core/[rw]mem_max - regardless of how we try to keep things running here, there's this fundamental kernel issue: https://lore.kernel.org/netdev/20260518183424.3144867-1-sbrivio@redhat.com/ for which I didn't manage to get a fix accepted, yet. You might need it. Maybe it's something completely different entirely, though. It might also very well be issues in the tests, their main goal is showing regressions rather than being entirely correct or stable. > With or without updated comments: > > Reviewed-by: Jon Maloy > Tested-by: Jon Maloy Adding regardless. -- Stefano