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.133.124]) by passt.top (Postfix) with ESMTPS id C45ED5A026E for ; Fri, 04 Dec 2026 20:24:30 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1796412269; 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=AniwI5rc70G1kVLIzpGOyscCaOZU1BQHT5OoFTqHSGw=; b=EzZCnfGhDBO7qGiM+Yt/ibtqzz6ifsYhElEoAPZGAxzcdtSo5d2uqd0uGOIGzjB+R3ggmv Q7OsxmJsOK2apLBJe1dq16HkHURKvghwARmxA8utERxD5Eal1N7FemHRlP7WI/spUYQCHK /tpSHNs1BR38K3t2WM2QMTegiol0Mto= X-MC-Rep: binary re single Received: from mail-pg1-f200.google.com (mail-pg1-f200.google.com [209.85.215.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-682-rQpd4UraM9GulrU_oHJSqQ-1; Fri, 4 Dec 2026 19:24:28 +0000 X-MC-Unique: rQpd4UraM9GulrU_oHJSqQ-1 X-Mimecast-MFC-AGG-ID: rQpd4UraM9GulrU_oHJSqQ_1796412267 Received: by mail-pg1-f200.google.com with SMTP id 41be03b00d2f7-cc73895c7d5so1494623a12.1 for ; Fri, 04 Dec 2026 11:24:28 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796412267; x=1797017067; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply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XRg1zR4N0w331oeYo 1uSHfghrAz5C7HFN4dOtVYjDK6KMJMygHcpufOtqMvAkhvT+YIzLPucC/zTwhV2GkggN9zDo5Q3 +zA0B9OtI0gqNXahs0+9pCdSxkrco7UydvGTZwK+k= X-Received: by 2002:a05:6a00:bc04:b0:8a0:1435:fda0 with SMTP id d2e1a72fcca58-8de2e6cae92mr3256380b3a.51.1796412266971; Fri, 04 Dec 2026 11:24:26 -0800 (PST) X-Received: by 2002:a05:6a00:bc04:b0:8a0:1435:fda0 with SMTP id d2e1a72fcca58-8de2e6cae92mr3256359b3a.51.1796412266494; Fri, 04 Dec 2026 11:24:26 -0800 (PST) Received: from [192.168.2.15] (lnsm6-montreal02-142-122-43-105.internet.virginmobile.ca. [142.122.43.105]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-8de1348cc32sm2196700b3a.46.2026.12.04.11.24.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 04 Dec 2026 11:24:26 -0800 (PST) Message-ID: Date: Fri, 4 Dec 2026 14:24:21 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] migrate, tcp: Account for bytes acknowledged before migration To: Laurent Vivier , passt-dev@passt.top References: <20261204122802.1235595-1-lvivier@redhat.com> From: Jon Maloy In-Reply-To: <20261204122802.1235595-1-lvivier@redhat.com> X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: PzdqL68y4NEVWkn4BwZuUQuj_uq19WcdP6Q4jNtLgOQ_1796412267 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Message-ID-Hash: YVVFMIXUWHI6YBONRBCV3UJ5HQYDOP3I X-Message-ID-Hash: YVVFMIXUWHI6YBONRBCV3UJ5HQYDOP3I X-MailFrom: jmaloy@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: David Gibson , Lynxes Exe , Stefano Brivio 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 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 Tested-by: Jon Maloy