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 E0E895A026E for ; Fri, 04 Dec 2026 22:15:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1796418922; 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=cjcxMDlU0y5Y07NZYGQon4oRPOPvO7GehdwVg2pFGoU=; b=baJhWJd5H+BCQmL+0wErnbaFi9nxgtc+JBOllLd/sYQ3hFsK1wNxSkDgD8gbKx7aRCLaaW tMJrQqgyNGnCNJPuMa261xzH1SzNVQP/j7WEb7NOqWvH16HsPfVHTaEak07JmCbFI02FJW w+6yb7cxKAp2YSx16Il7gMQV2oWTtoU= X-MC-Rep: binary re single Received: from mail-dy1-f198.google.com (mail-dy1-f198.google.com [74.125.82.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-664-zCOSxlivOC65wy2WhFHs3Q-1; Fri, 4 Dec 2026 21:15:20 +0000 X-MC-Unique: zCOSxlivOC65wy2WhFHs3Q-1 X-Mimecast-MFC-AGG-ID: zCOSxlivOC65wy2WhFHs3Q_1796418920 Received: by mail-dy1-f198.google.com with SMTP id 5a478bee46e88-383ec96a7deso2463798eec.1 for ; Fri, 04 Dec 2026 13:15:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796418920; x=1797023720; 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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/wWEyqY9pZs 3w83TY9p/8AhlR1ZPimvInLIqmBOwf32q9JgLfimL9LXgeCueFLDCEw0bsaHL+iz8zIKD4G9c0u sZCAfsWx0iTFkWgZO6VdhJDol7pzgnLu1ExVvaeuo= X-Received: by 2002:a05:7301:1a83:b0:387:4916:5f2c with SMTP id 5a478bee46e88-38752153968mr2954783eec.31.1796418919508; Fri, 04 Dec 2026 13:15:19 -0800 (PST) X-Received: by 2002:a05:7301:1a83:b0:387:4916:5f2c with SMTP id 5a478bee46e88-38752153968mr2954765eec.31.1796418918810; Fri, 04 Dec 2026 13:15:18 -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 5a478bee46e88-3875222ff7fsm11319943eec.25.2026.12.04.13.15.16 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 04 Dec 2026 13:15:18 -0800 (PST) Message-ID: Date: Fri, 4 Dec 2026 16:15:14 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] migrate, tcp: Account for bytes acknowledged before migration To: Stefano Brivio References: <20261204122802.1235595-1-lvivier@redhat.com> <20261204215559.4061fadf@elisabeth> From: Jon Maloy In-Reply-To: <20261204215559.4061fadf@elisabeth> X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: RCH8PAm-IhrDguafE6D0KHUix_puV9x7ZbRf665eTE0_1796418920 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: X65FEOXMQPLL5YS4JQXQ65SL2OU7YRVT X-Message-ID-Hash: X65FEOXMQPLL5YS4JQXQ65SL2OU7YRVT 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: 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 2026-12-04 15:56, Stefano Brivio wrote: > 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? Yes. > >>> + >>> + 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. Agreed. I don't think I'll jump on this right now. /jon > >> With or without updated comments: >> >> Reviewed-by: Jon Maloy >> Tested-by: Jon Maloy > > Adding regardless. >