[tcpm] Re: CWND increase in disordered state in Linux?

Ingemar Johansson S <ingemar.s.johansson@ericsson.com> Tue, 03 September 2024 18:38 UTC

Return-Path: <ingemar.s.johansson@ericsson.com>
X-Original-To: tcpm@ietfa.amsl.com
Delivered-To: tcpm@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 3C3FBC180B6F for <tcpm@ietfa.amsl.com>; Tue, 3 Sep 2024 11:38:55 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.755
X-Spam-Level:
X-Spam-Status: No, score=-1.755 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.148, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, GB_ABOUTYOU=0.5, HTML_MESSAGE=0.001, RCVD_IN_MSPIKE_H2=-0.001, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, URIBL_BLOCKED=0.001, URIBL_DBL_BLOCKED_OPENDNS=0.001, URIBL_ZEN_BLOCKED_OPENDNS=0.001] autolearn=no autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=ericsson.com
Received: from mail.ietf.org ([50.223.129.194]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id cgIOdD8pOtSG for <tcpm@ietfa.amsl.com>; Tue, 3 Sep 2024 11:38:51 -0700 (PDT)
Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2051.outbound.protection.outlook.com [40.107.20.51]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id DABCFC1DFD2D for <tcpm@ietf.org>; Tue, 3 Sep 2024 11:38:50 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=gx7HfcsTnmZR2x1+Sz/nJDEMPRQ8yRzBMx9kEVHk2YfaLt3smq4Huo1dVbeT0Br93iSC3ABd1kwXUhsDacRR23PwkyBdd1OBCT+xO+nAFy6g5GBHvc/gXG7Ewn5FDDZZelvJZXMfuQ6ZUwW4zJpztS5s7MkevPS8W6VkB4ZQ1oAEtBmzd34o3wsBlrnB4UFcCmqKeKDRpoDAYDyZYPnqSOHsuqSsBhIJNbfZr3jPYJ5XX/EOCSUSJgkWNe1d3928I+hIHahimS5GLA1FKd0fFEqPzVZWZMIgr3B9WoGyVj5nNrMif3+lGGKf98A2nKOf7IEuzLWH5vnyuH+0za0Pbw==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=t9+XwKKVjCh+VSHX+tDsGHHQm9LbLEFduga09H6+bJo=; b=FCb2BVmU7pdqh0DwlnpvyuFlh5pOSo6+puDOxQYQXXIHJz0Qxksm27WSu+TPctmYTXryULhOUFmA+UqYgtc8k464iNCT3nQ5PKDAd+PbgeM/qtFHhxrXSAiaTUiJEhT5uXrzOydPhob7zPVCEAaEPd4UZwGql/BZp+qMOlm1Uv7iMnLd+PcFRlRvoemvp40uvzWfWiouUqcF90nQ2UHdnlzOwmARyD2nspDLqQ0TPY6nvogGFIDEB/0pRPO0Z/zpZ3qLX57QJ29lxugKIzndU3Iil+OK1KwmkNu719LKdLY68lo/a41FHan3KYUDyuZdgHi1VTzF/JUeDaPqLMEJEw==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=ericsson.com; dmarc=pass action=none header.from=ericsson.com; dkim=pass header.d=ericsson.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericsson.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=t9+XwKKVjCh+VSHX+tDsGHHQm9LbLEFduga09H6+bJo=; b=PHr9l91wMJAFGcScn3RXNZtY+GFGk+aio4+PQgVXHMZdybhfZoOYCYd91UUlCRk2+yOVV08qPDwZNNXhcDO58J3iMEIAn8fis+/wIhifVYyrZq19P700mBRC+Zv/SfkZQFtsvwqG5dOFGkDkmmfkfrDyNJvs6rXVxyVkRR0wWag0tHWI8DLsl8LLxIxht507JEVsqLtsHRC6rA3eSNyzGVL1n0ucS6GPLfa0g3itgpovMyU2ZA7ormQUi3IHAh5Wo7S8GkViOfYm7/tLKLDh7+butLfqYBJQfxiYy0lrBXz7/LH3eGnmy7EDS5VZ9Sq2JgSFdYL4ikyFdeZa8iVshA==
Received: from AM8PR07MB8137.eurprd07.prod.outlook.com (2603:10a6:20b:36c::18) by AM8PR07MB7588.eurprd07.prod.outlook.com (2603:10a6:20b:24b::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.27; Tue, 3 Sep 2024 18:38:48 +0000
Received: from AM8PR07MB8137.eurprd07.prod.outlook.com ([fe80::9e03:ac31:a53:8b04]) by AM8PR07MB8137.eurprd07.prod.outlook.com ([fe80::9e03:ac31:a53:8b04%4]) with mapi id 15.20.7918.024; Tue, 3 Sep 2024 18:38:48 +0000
From: Ingemar Johansson S <ingemar.s.johansson@ericsson.com>
To: Neal Cardwell <ncardwell@google.com>, Yuchung Cheng <ycheng@google.com>
Thread-Topic: CWND increase in disordered state in Linux?
Thread-Index: Adr95iSQMFrOQBHATa+k9g+RIMSCqgANcu+AAATGzpA=
Date: Tue, 03 Sep 2024 18:38:48 +0000
Message-ID: <AM8PR07MB81379953CC4CCDE2D7E3BEFCC2932@AM8PR07MB8137.eurprd07.prod.outlook.com>
References: <AM8PR07MB81375A216023B9AC11EA6F3DC2932@AM8PR07MB8137.eurprd07.prod.outlook.com> <CADVnQymBZnijVoWX7_4fyYJXkf5Gs5-HXaF_4-7Xh2ROHisJ9Q@mail.gmail.com>
In-Reply-To: <CADVnQymBZnijVoWX7_4fyYJXkf5Gs5-HXaF_4-7Xh2ROHisJ9Q@mail.gmail.com>
Accept-Language: sv-SE, en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=ericsson.com;
x-ms-publictraffictype: Email
x-ms-traffictypediagnostic: AM8PR07MB8137:EE_|AM8PR07MB7588:EE_
x-ms-office365-filtering-correlation-id: 65140901-d637-498e-0e11-08dccc47a621
x-ms-exchange-senderadcheck: 1
x-ms-exchange-antispam-relay: 0
x-microsoft-antispam: BCL:0;ARA:13230040|366016|376014|1800799024|38070700018;
x-microsoft-antispam-message-info: Z3psGDlxjPdnMJ6OCroIHFwGWGe0JDBuCb33klbl8TFzt36eShGl/WLWOibQLIgWq7e80c08+GhF7GZMbBNff8KspmA+NFILTSWHBxp3DsIUueDOsOivqoOCOICWrKh+PedHnpTCI/cHcXBKX8pWd3RaCTmiabA6Km3jZKlMPnENfuTXG7+gsdRL/i1zMf+TmoH4RVQJ1EqoT41X3KHskkJvuhMtx0KBth+296Tre1JAQh/Xtc8QrfHQWckI32JxHx7LJB5RUwStUlE+DEsyJGFftVIUkW/ogQArTzwnDM6SH2V2p55wS1HRsfCJLDMbQb40KSGUGqiXT1vTrU9H7bBiUFviMxVthdLnf89SPuTu55uI9Ha6AsHFvhkMbYiZsUM+mU1E+iY8DT8wxMddPouRwy9DBd7IJmxoCB/a82dp6lqZeEiNtXYtyRz7MSGb3Kegr2jmJOCJA1k/Aq25xxZK2KrPmNYK4rJMMEe7WLQK20XsvQLlcstxQHemiJmjkQxHWtIvYYOMfIjr6lI1WkrUAZ+s+9yJAWuYKv+I9Ak8ccQIGpDqZ6V/9t2FKheEyYMIRRl5ePjtyhpsTgfyIl6uFOIaCLtj3lYGvvFgohmllW7WajUKZN9affP/dONrWfmG2/O3HyvJPpM4oBCmE8fpNdgBlANDky4AP7+FfTJHndfZFV1Wcwqme+3tji3I26TATkl9ywDkMgthE6OboPgoelJhxqc7U42A5S2m9x3RHKsEqnuj2wPRbg9kR3ZuSbeq98O8WOyFpi06Eud9uAcMQJKF+SJ4rWbI5mg9V1eJdwiYff1/xA7mfnvLJMS455VqGphHVwXoEBYxB0NI3wSXOAt2dzB4F5ivOK9G4VEVGoI0S8swPXjZJK9e6pulULGZaV05QfWR64PSqiKDJjSYSxY9OLpELtak2hGpIoNEZUAJ+iPwaKzA0hr3SR8s8eiPO8alPXtrTB11SqaBV5Ikza+Cc95Czx+37qmkP+Q/FoyyUhzVPjmb/cWz2aiEoAK25o2DDHjiOImgRxM3th3uVLE9D4c7OyqA3nPr4sxDlho4wMhoIBvvYBloEV0SgVN8Ldg46gK1rZOzWGM9qKaGe+5GwAgBRrKHDc3hwalYpNTJV9QIMRnOwsKrmnbxx84RQihGV4PPyU11+jKh/V3G40+MSZZJKsnio+NYcutbcwz91wk2iAtAlvi8DYWJoCGJQQC9RorjWiG9DvhNMimLr6yzmeuqzAHC6AJLKFoIBar6cPJezKM+Wtw7emVMSjqXp1cPwaq/uSLfRz7zTmB0tYNZVSRCGrE+wxptu4CY1duVd790OO/xfZDzlfNZ9BSS9G8mZftQ7Ta8696BWUQVZGTAkXFuNpnyqtLe+/g=
x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM8PR07MB8137.eurprd07.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(376014)(1800799024)(38070700018);DIR:OUT;SFP:1101;
x-ms-exchange-antispam-messagedata-chunkcount: 1
x-ms-exchange-antispam-messagedata-0: bbsSILK9rvyYBYcUDCpeHt/RcV0oQm/zJGn3AN/4glu3nzhCwqeA50R5Rqwxa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vRZXVn375l5p6QkH3HrKwOQ1VA5TU96mRCgaXVGY2YBYxQN8E/cq5FPGxrBxOUrpStwIH5oDjjjG3GrlFXtvqJatDADw4fqNMzkBIz1IfdMUHRx/MlURh+BBurDGTm+wEZ4bZfoXeFVf+At8fn/2d/Z5m1S1qW1eGLZTWxV/r8VZeEEP6iqc6va2eZsnZGoF4YkOprRQuErkzaQdoA59v84CPiQEWf+x1dAk9Y/OqVsDcNFp/TgnwVzVsnUW1H8++OYjSDvaJljRCG+NEfNPAMX59AUI/nyCvN+HVu4r/X6xauuF/BcbVPdE7Q1tmaNUeuU5fzS4Kq+28nYkcCjUUS/a95v1DQdQ2c5PnTiNOGLuhVB+rlxS+Gp04KxdtAZsoPQuvHEvcYatGIeS+q9W/GZAoo7xWeIy/OV+82w0PTXJKoiZPSOA4UEMD+i+sFFcAJ2XsCA0oOGv7ttJTvL/C3svzypL1Q==
Content-Type: multipart/alternative; boundary="_000_AM8PR07MB81379953CC4CCDE2D7E3BEFCC2932AM8PR07MB8137eurp_"
MIME-Version: 1.0
X-OriginatorOrg: ericsson.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-AuthSource: AM8PR07MB8137.eurprd07.prod.outlook.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 65140901-d637-498e-0e11-08dccc47a621
X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Sep 2024 18:38:48.1663 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 92e84ceb-fbfd-47ab-be52-080c6b87953f
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: nHMQzSo6/9DNO4zabcwpsAAJGhwZaxszYmc2gL4o9FKGdpWt4LVLtHTFhDgy4uOkhN1bJmft9IrLKy6PbHadkpnQ6ihSEVVdyEFXi2yGbLvDvjCLCeNiZeAr9bXPovJk
X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR07MB7588
Message-ID-Hash: FU33LKQBFZRFRBA2XJWC2VISXW5HNH3W
X-Message-ID-Hash: FU33LKQBFZRFRBA2XJWC2VISXW5HNH3W
X-MailFrom: ingemar.s.johansson@ericsson.com
X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-tcpm.ietf.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header
CC: "tcpm@ietf.org" <tcpm@ietf.org>
X-Mailman-Version: 3.3.9rc4
Precedence: list
Subject: [tcpm] Re: CWND increase in disordered state in Linux?
List-Id: TCP Maintenance and Minor Extensions Working Group <tcpm.ietf.org>
Archived-At: <https://mailarchive.ietf.org/arch/msg/tcpm/3RQCTlu8-Y9ADv9hoDDa65PDFac>
List-Archive: <https://mailarchive.ietf.org/arch/browse/tcpm>
List-Help: <mailto:tcpm-request@ietf.org?subject=help>
List-Owner: <mailto:tcpm-owner@ietf.org>
List-Post: <mailto:tcpm@ietf.org>
List-Subscribe: <mailto:tcpm-join@ietf.org>
List-Unsubscribe: <mailto:tcpm-leave@ietf.org>

Hi Neal

And thanks for the fast response. Now I know the expected behavior and as you say, it is pretty hard to get CWND and ssthresh == 7 if the CWND grows up to 12 MSS during the disordered state.
RFC3042 is pretty clear that CWND should not be modified during disorered state but the text in tcp_may_raise_cwnd() made me think that it is perhaps allowed after all. Now I understand things better.

More inline, marked [IJ]

/Ingemar

From: Neal Cardwell <ncardwell@google.com>
Sent: Tuesday, 3 September 2024 18:12
To: Ingemar Johansson S <ingemar.s.johansson@ericsson.com>; Yuchung Cheng <ycheng@google.com>
Cc: tcpm@ietf.org
Subject: Re: CWND increase in disordered state in Linux?

On Tue, Sep 3, 2024 at 5:47 AM Ingemar Johansson S <ingemar.s.johansson@ericsson.com<mailto:ingemar.s.johansson@ericsson.com>> wrote:
Hi

Hi, Ingemar!

Hope you are fine

Yes! Hope you are fine as well. :-)

I'm cc-ing +Yuchung Cheng<mailto:ycheng@google.com> explicitly on this thread, since he is the author of the tcp_may_raise_cwnd() code that Linux TCP has been using for about 11 years now, and he may want to add more comments or context.

I am working on improving the TCP stack in our 5G system simulator to pass all relevant packetdrill tests.
One thing that I I try to figure out is the behavior in CA_Disordered state. One such example is the prr-ss-10pkt-lost-1.pkt test.
What I see in the current implementation is that cwnd increases from 10 to 12 when it is in disordered state.
When it gets into CA_Recovery however the ssthresh should be set to 7 but it is set to 8 because int(12*0.7) = 8. So I guess ssthresh should be set based on cwnd from when the state was last in CA_Open ?.

I'm surprised you are seeing cwnd increases from 10 to 12 when the connection is in Disorder state in that prr-ss-10pkt-lost-1.pkt test. The Linux TCP logic should not increase cwnd when receiving the SACKs in that test case (see below for the rationale). The test implicitly asserts that the cwnd increase upon receiving SACKs does not happen, since it explicitly asserts that cwnd and ssthresh are both set to 7. And AFAIK that test passes on upstream kernels and the kernels we use. So I'm surprised you see a cwnd of 8 rather than 7.

Are you using this version of the test: https://github.com/google/packetdrill/blob/master/gtests/net/tcp/fast_recovery/prr-ss-10pkt-lost-1.pkt ?

To help understand the discrepancy, can you please share:


  1.  the exact version of the packetdrill script you are using (either with a git SHA1, a github URL, or attaching the script) and
[IJ] The scripts are from the github repos you linked to


  1.  the exact Linux kernel version you are testing (with a tag name or SHA1)?
[IJ] 5.3, in fact it is a port of the Linux TCP stack to out Java based 5G system simulator, in the process I have made some errors and the packet drill scripts have been very helpful to identify those errors.

What confuses me is that RFC3042 says that CWND should not be modified when in disordered state, however the explanation text in tcp_may_raise_cwnd() seem to indicate that CWND can increase as long as new data is SACKed, right?.

The Linux TCP code intentionally does not exactly follow RFC3042 to the letter, when it comes to the limited transmit behavior. This is for good reason, based on decades of real-world experience.
[IJ] OK, good to know

The rationale for the Linux TCP tcp_may_raise_cwnd() logic is largely explained in Yuchung's commit messages from the 2013 code for this function:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0f7cc9a3c2bd8
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=16edfe7ee02dd

The full current tcp_may_raise_cwnd() logic can be browsed here:
  https://elixir.bootlin.com/linux/v6.10/source/net/ipv4/tcp_input.c#L3544

I will try to summarize the rationale by paraphrasing Yuchung's commit  messages:

Currently the Linux TCP stack detects reordering and avoids spurious retransmissions quite effectively; since roughly 2018 this is by using RACK-TLP: https://datatracker.ietf.org/doc/html/rfc8985

However, around 2013, before RACK-TLP, and when the Linux TCP code was largely following the cwnd-increase dictates in RFC3042,and before Yuchung's commits noted above, the throughput was suboptimal for connections experiencing high reordering.This was because cwnd was increased only if the data was delivered in order. i.e., FLAG_DATA_ACKED was set in tcp_ack(). The more packets were reordered, the worse the throughput was, because with high reordering only a small fraction of ACKs advanced SND.UNA and allowed cwnd to increase.

Therefore, Yuchung's commits noted above changed the logic so that:

(A) when the measured degree of reordering is high (above the default dupthresh of 3 packets), cwnd increases whenever data is delivered (FLAG_FORWARD_PROGRESS is set) regardless of its ordering (regardless of whether packets are marked as delivered via cumulative ACKs that advance SND.UNA  or via SACKed out-of-order data)

(B) in the common case where reordering is low, the code conservatively follows the cwnd increase conditions in RFC3042 and increases cwnd only on ordered deliveries (cumulative ACKs that advance SND.UNA).

The performance difference Yuchung found in testing his changes was quite large: using netperf on a qdisc setup of 20Mbps bandwidth and random RTT from 45ms to 55ms (for reordering effect, Yuchung found his  changes increased TCP throughput by 20 - 25%, allowing TCP CUBIC to reach a throughput near the bottleneck link bandwidth.
Ingemar, because the test you mention above, prr-ss-10pkt-lost-1.pkt, does not have reordering, the logic should be using the (B) path above, which matches RFC3042 behavior. So I'm surprised you are seeing the cwnd increase based on SACKs arriving in Disorder for that test. So I'd be curious to hear more details about your test and kernel to understand why your tests are not seeing the normal Linux TCP behavior.
[IJ] Thanks for the explanation, it is very helpful. Now I just need to debug my code to see where it goes wrong.

best regards,
neal



/Ingemar
PS: CC:ed the tcpm group in case this topic is of more general interest