From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AD59C1C6FE1; Thu, 6 Mar 2025 10:12:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741255962; cv=none; b=UcBxoW6vC3zw239THG7zalOb8ieLUAv7/zh9tGS6oGu69++uZKc1bKlFTOXGFwhuDiddQrT8xAzkhwywVxtoE19MbJ95xwess9/uIw0ELsiobkPP06tooPTnB7EMb7j8qOlAzfa6J3RnxyGrE0xB51v/NZNNyOtPhfWLxx3QViE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741255962; c=relaxed/simple; bh=EEyYORts2CMueLDR9VZbU5UMnAqVG45Sr/bOW0NMhmA=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=o/JObz46ZM6s3EPQufcSBx04fRUj0QabwstVrxIG9hwCipLKurMvV+3qZ/QquANG7BpGG7FA5GqElfhu638yjhHIJj8IU1lGRuLGawOc87NRdi+efaaJB7kmceWRpzW8EP0poMHqu34+/A6fEVR5/NKlsnY4lbTS/EYHteuZz1c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=L4TZxPxm; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="L4TZxPxm" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0608C4CEE0; Thu, 6 Mar 2025 10:12:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1741255962; bh=EEyYORts2CMueLDR9VZbU5UMnAqVG45Sr/bOW0NMhmA=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=L4TZxPxmtq0jcpy7Sb1fJTA5fgxlkRosdts8TFcF5tYqHJPWgp5YbKYnTpqhzZ5w4 7SI4a2byI9ua5WQL9pOIG8yjzjKhm+WayFhI3UoId2cRPI4QPI60rvS+cm18+tBkNH e357EZYrTtR4wSTJWtGdWcYvfxzqhtzlG2SWDrGcEPYq+9+aWFC9Oa3OB++DZydayp jtmaQr49l+dMShIJ1qvcspH4slr7w05up649FWpz3Ukiy1Ci7DaJxwQe4BFDrPd2oB 0bGwDvP1OEouIjwJyZjWgbUZrhNlp2urdiqqiFY3r98J+d1v6RUBlza0ijx+SG8isQ 9Wt1+u/NIJnXA== Message-ID: Date: Thu, 6 Mar 2025 11:12:36 +0100 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Beta Subject: Re: [PATCH net-next] tcp: clamp window like before the cleanup Content-Language: en-GB To: Eric Dumazet Cc: Jason Xing , mptcp@lists.linux.dev, Neal Cardwell , Kuniyuki Iwashima , "David S. Miller" , David Ahern , Jakub Kicinski , Paolo Abeni , Simon Horman , netdev@vger.kernel.org, linux-kernel@vger.kernel.org References: <20250305-net-next-fix-tcp-win-clamp-v1-1-12afb705d34e@kernel.org> <281edb3a-4679-4c75-9192-a5f0ef6952ea@kernel.org> From: Matthieu Baerts Autocrypt: addr=matttbe@kernel.org; keydata= xsFNBFXj+ekBEADxVr99p2guPcqHFeI/JcFxls6KibzyZD5TQTyfuYlzEp7C7A9swoK5iCvf YBNdx5Xl74NLSgx6y/1NiMQGuKeu+2BmtnkiGxBNanfXcnl4L4Lzz+iXBvvbtCbynnnqDDqU c7SPFMpMesgpcu1xFt0F6bcxE+0ojRtSCZ5HDElKlHJNYtD1uwY4UYVGWU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D+vnIW5mbAAiojt3Mb 6p0WJS3QzbObzHNgAp3zy/L4lXwc6WW5vnpWAzqXFHP8D9PTpqvBALbXqL06smP47JqbyQxj Xf7D2rrPeIqbYmVY9da1KzMOVf3gReazYa89zZSdVkMojfWsbq05zwYU+SCWS3NiyF6QghbW voxbFwX1i/0xRwJiX9NNbRj1huVKQuS4W7rbWA87TrVQPXUAdkyd7FRYICNW+0gddysIwPoa KrLfx3Ba6Rpx0JznbrVOtXlihjl4KV8mtOPjYDY9u+8x412xXnlGl6AC4HLu2F3ECkamY4G6 UxejX+E6vW6Xe4n7H+rEX5UFgPRdYkS1TA/X3nMen9bouxNsvIJv7C6adZmMHqu/2azX7S7I vrxxySzOw9GxjoVTuzWMKWpDGP8n71IFeOot8JuPZtJ8omz+DZel+WCNZMVdVNLPOd5frqOv mpz0VhFAlNTjU1Vy0CnuxX3AM51J8dpdNyG0S8rADh6C8AKCDOfUstpq28/6oTaQv7QZdge0 JY6dglzGKnCi/zsmp2+1w559frz4+IC7j/igvJGX4KDDKUs0mlld8J2u2sBXv7CGxdzQoHaz lzVbFe7fduHbABmYz9cefQpO7wDE/Q== Organization: NGI0 Core In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 06/03/2025 11:02, Eric Dumazet wrote: > On Thu, Mar 6, 2025 at 10:55 AM Matthieu Baerts wrote: >> >> Hi Eric, >> >> On 06/03/2025 10:45, Eric Dumazet wrote: >>> On Thu, Mar 6, 2025 at 6:22 AM Jason Xing wrote: >>>> >>>> On Wed, Mar 5, 2025 at 10:49 PM Matthieu Baerts (NGI0) >>>> wrote: >>>>> >>>>> A recent cleanup changed the behaviour of tcp_set_window_clamp(). This >>>>> looks unintentional, and affects MPTCP selftests, e.g. some tests >>>>> re-establishing a connection after a disconnect are now unstable. >>>>> >>>>> Before the cleanup, this operation was done: >>>>> >>>>> new_rcv_ssthresh = min(tp->rcv_wnd, new_window_clamp); >>>>> tp->rcv_ssthresh = max(new_rcv_ssthresh, tp->rcv_ssthresh); >>>>> >>>>> The cleanup used the 'clamp' macro which takes 3 arguments -- value, >>>>> lowest, and highest -- and returns a value between the lowest and the >>>>> highest allowable values. This then assumes ... >>>>> >>>>> lowest (rcv_ssthresh) <= highest (rcv_wnd) >>>>> >>>>> ... which doesn't seem to be always the case here according to the MPTCP >>>>> selftests, even when running them without MPTCP, but only TCP. >>>>> >>>>> For example, when we have ... >>>>> >>>>> rcv_wnd < rcv_ssthresh < new_rcv_ssthresh >>>>> >>>>> ... before the cleanup, the rcv_ssthresh was not changed, while after >>>>> the cleanup, it is lowered down to rcv_wnd (highest). >>>>> >>>>> During a simple test with TCP, here are the values I observed: >>>>> >>>>> new_window_clamp (val) rcv_ssthresh (lo) rcv_wnd (hi) >>>>> 117760 (out) 65495 < 65536 >>>>> 128512 (out) 109595 > 80256 => lo > hi >>>>> 1184975 (out) 328987 < 329088 >>>>> >>>>> 113664 (out) 65483 < 65536 >>>>> 117760 (out) 110968 < 110976 >>>>> 129024 (out) 116527 > 109696 => lo > hi >>>>> >>>>> Here, we can see that it is not that rare to have rcv_ssthresh (lo) >>>>> higher than rcv_wnd (hi), so having a different behaviour when the >>>>> clamp() macro is used, even without MPTCP. >>>>> >>>>> Note: new_window_clamp is always out of range (rcv_ssthresh < rcv_wnd) >>>>> here, which seems to be generally the case in my tests with small >>>>> connections. >>>>> >>>>> I then suggests reverting this part, not to change the behaviour. >>>>> >>>>> Fixes: 863a952eb79a ("tcp: tcp_set_window_clamp() cleanup") >>>>> Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/551 >>>>> Signed-off-by: Matthieu Baerts (NGI0) >>>> >>>> Tested-by: Jason Xing >>>> >>>> Thanks for catching this. I should have done more tests :( >>>> >>>> Now I use netperf with TCP_CRR to test loopback and easily see the >>>> case where tp->rcv_ssthresh is larger than tp->rcv_wnd, which means >>>> tp->rcv_wnd is not the upper bound as you said. >>>> >>>> Thanks, >>>> Jason >>>> >>> >>> Patch looks fine to me but all our tests are passing with the current kernel, >>> and I was not able to trigger the condition. >> >> Thank you for having looked at this patch! >> >> >>> Can you share what precise test you did ? >> >> To be able to get a situation where "rcv_ssthresh > rcv_wnd", I simply >> executed MPTCP Connect selftest. You can also force creating TCP only >> connections with '-tt', e.g. >> >> ./mptcp_connect.sh -tt > > I was asking Jason about TCP tests. He mentioned TCP_CRR Oops, I'm sorry, I didn't look at the "To:" field. > I made several of them, with temporary debug in the kernel that did > not show the issue. > > > I am wondering if this could hide an issue in MPTCP ? Indeed, I was wondering the same thing. I didn't see anything obvious when looking at this issue. The behaviours around the window clamping, with MPTCP single flow, and "plain" TCP were quite similar I think. Cheers, Matt -- Sponsored by the NGI0 Core fund.