Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp834839pxb; Wed, 13 Jan 2021 17:50:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJwUEDkNS1oe948uz25YQ6PXfUQbTBpsJ5lGBfNa2x9kiipVKzLVuLxOXITzmotVK466JYSM X-Received: by 2002:aa7:dd4b:: with SMTP id o11mr3970927edw.303.1610589038522; Wed, 13 Jan 2021 17:50:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610589038; cv=none; d=google.com; s=arc-20160816; b=n3kQse6/TvZhEe7ZgnCm55DX97OL3TN/PIFl3VUxFtx/6FJ4CcQqZdSaQJRY9rydLT zOyVCTqdtiiNaj8Hv5R1EDDJzy5Hhe8Y0hSe4QRaCVawgIKvLXav/3pClMXX/KVgZpM4 S6b760+3u5n8SfiRgU66OUluBwkpSvz+EABjRfA7EUNwsbh5fq/QHtAJwh9lkV+i8/VT YkCN0rp8j+Rb39OlvzeIGoyCgaCVp+RuN0S6P3XDG7cHqZrxrjec9BYmbvOD9O5PPSF5 vsq6mfZS0cRm9zyc1a6KZhLzmGmrFPe2ekHwAbElLqGzYmc6sSk4pPqwj7NvM5BQXiDJ 5YHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=vZV+6JNZ9AMFDA8LKCfNVRXM0e5aK8AvdT2wlgQnc3k=; b=jqFCto026Gvhe0rZzuJzXsk2zAtBT6mUrVPaShyO7dQfBybq9EGxhDZbraFkhjwT9P CFRzj8APb8WMfbEU03rtX0NPcwgloh+cV6rGjEgPjceUaB5dd0IM4FZ6v45U4BsRgBrZ AJm6LYxQHaZiQQaxo63XcDnQN4jFxN1wfWz+h7rM9eN0eAZixvRiqlNjausTBBjZn+Yx A4pvgX7MOEwDuA9yAIrGOwPlL6EMTYX7zRCX1Yk9BQo+pz1hvdzwvE+ljciKlW25Bxop X98AqkOfr1DDEbPApJbwjk0N3gVFKvZ5D4rt/BiqUxkwUgipxe0qGPZDzPC1mWAR8V3U zFGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="q0/tymPT"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gb26si1358516ejc.384.2021.01.13.17.50.09; Wed, 13 Jan 2021 17:50:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="q0/tymPT"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726143AbhANAj6 (ORCPT + 99 others); Wed, 13 Jan 2021 19:39:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729903AbhANAe4 (ORCPT ); Wed, 13 Jan 2021 19:34:56 -0500 Received: from mail-ot1-x330.google.com (mail-ot1-x330.google.com [IPv6:2607:f8b0:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3870CC061575; Wed, 13 Jan 2021 16:09:53 -0800 (PST) Received: by mail-ot1-x330.google.com with SMTP id d20so3691290otl.3; Wed, 13 Jan 2021 16:09:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=vZV+6JNZ9AMFDA8LKCfNVRXM0e5aK8AvdT2wlgQnc3k=; b=q0/tymPT6nywwo4ZK4mafniJnz7/UEhMIXp0D0wJkWPM3A82Hakn9jFHlPW2DTNSAX WRa9mg6tdeTc+Vp6hau//5KLiH0ebjVMEvX0tyHYHYAw5mFcsLHpvd3ha/zrqywuRVzW GkgKIvXq6xqZQmtvBJZXh6WnMcCc/lJa4gToEWDucKRtd8AaC4HRfVymjwNLPO887q/D uX3iFplDliuZYDKGPMHzYb2DPbC2ra9Re/uIxeCPgpqDcAmADBB8r+KWouwaPf6QQHZz pLxQ74S53dwq7DWs+yIUNZzur7xwap6iSBCno9xHhunIfSg+LsyGFn+1V83h+Tz6Zent /7oQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=vZV+6JNZ9AMFDA8LKCfNVRXM0e5aK8AvdT2wlgQnc3k=; b=fQ+o18jDLdRJvm5qonO2xYH9Xl+Cz3wUwjNF78i5dRENWlTqTZN0fwpxo6DD3R7Em7 jLIWAZVx9RSVwhOkdmSCqELFj7220LVTNhxXzI9pezaeUR42Eqrd1MzR022wT3d0Pb2b d6B+gSvLTzZHS2LgG109UrCxEOs5Lb/0udwCgUGrKMbIu/9tSwp3mjaTws9+6apM9aC3 NZFRTpuWlmcu5BbdpA9wp6h/ewGd33lvaSaX4ljiQu9x1Wx3l+MgHuNBQBoAkBBdtdkd vgoEeG0nVZW7f9xBRt6HsqpulADLKfjzNjF0ZZxHYCSGr7babDQJBLxmV85UJgFne07L 1rNg== X-Gm-Message-State: AOAM530JcYZhvp6vEH1/W2+zPjR62SxAZTzXYU1xy7uxvip61NMdcaYv BEYNFBpWYUDFYCi7NoSrfS8= X-Received: by 2002:a9d:d31:: with SMTP id 46mr2808936oti.1.1610582992623; Wed, 13 Jan 2021 16:09:52 -0800 (PST) Received: from localhost.localdomain (99-6-134-177.lightspeed.snmtca.sbcglobal.net. [99.6.134.177]) by smtp.gmail.com with ESMTPSA id p18sm756575ood.48.2021.01.13.16.09.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jan 2021 16:09:52 -0800 (PST) Date: Wed, 13 Jan 2021 16:09:49 -0800 From: Enke Chen To: Yuchung Cheng Cc: Eric Dumazet , "David S. Miller" , Alexey Kuznetsov , Hideaki YOSHIFUJI , Jakub Kicinski , netdev , LKML , Jonathan Maxwell , William McCall Subject: Re: [PATCH] tcp: fix TCP_USER_TIMEOUT with zero window Message-ID: <20210114000949.GC3738@localhost.localdomain> References: <20210113201201.GC2274@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Yes, I am convinced :-) Thanks to Eric, Neal and Yuchung for their help. -- Enke On Wed, Jan 13, 2021 at 01:20:55PM -0800, Yuchung Cheng wrote: > On Wed, Jan 13, 2021 at 12:49 PM Eric Dumazet wrote: > > > > On Wed, Jan 13, 2021 at 9:12 PM Enke Chen wrote: > > > > > > From: Enke Chen > > > > > > The TCP session does not terminate with TCP_USER_TIMEOUT when data > > > remain untransmitted due to zero window. > > > > > > The number of unanswered zero-window probes (tcp_probes_out) is > > > reset to zero with incoming acks irrespective of the window size, > > > as described in tcp_probe_timer(): > > > > > > RFC 1122 4.2.2.17 requires the sender to stay open indefinitely > > > as long as the receiver continues to respond probes. We support > > > this by default and reset icsk_probes_out with incoming ACKs. > > > > > > This counter, however, is the wrong one to be used in calculating the > > > duration that the window remains closed and data remain untransmitted. > > > Thanks to Jonathan Maxwell for diagnosing the > > > actual issue. > > > > > > In this patch a separate counter is introduced to track the number of > > > zero-window probes that are not answered with any non-zero window ack. > > > This new counter is used in determining when to abort the session with > > > TCP_USER_TIMEOUT. > > > > > > > I think one possible issue would be that local congestion (full qdisc) > > would abort early, > > because tcp_model_timeout() assumes linear backoff. > Yes exactly. if ZWPs are dropped due to local congestion, the > model_timeout computes incorrectly. Therefore having a starting > timestamp is the surest way b/c it does not assume any specific > backoff behavior. > > > > > Neal or Yuchung can further comment on that, it is late for me in France. > > > > packetdrill test would be : > > > > 0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3 > > +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0 > > +0 bind(3, ..., ...) = 0 > > +0 listen(3, 1) = 0 > > > > > > +0 < S 0:0(0) win 0 > > +0 > S. 0:0(0) ack 1 > > > > +.1 < . 1:1(0) ack 1 win 65530 > > +0 accept(3, ..., ...) = 4 > > > > +0 setsockopt(4, SOL_TCP, TCP_USER_TIMEOUT, [3000], 4) = 0 > > +0 write(4, ..., 24) = 24 > > +0 > P. 1:25(24) ack 1 > > +.1 < . 1:1(0) ack 25 win 65530 > > +0 %{ assert tcpi_probes == 0, tcpi_probes; \ > > assert tcpi_backoff == 0, tcpi_backoff }% > > > > // install a qdisc dropping all packets > > +0 `tc qdisc delete dev tun0 root 2>/dev/null ; tc qdisc add dev > > tun0 root pfifo limit 0` > > +0 write(4, ..., 24) = 24 > > // When qdisc is congested we retry every 500ms therefore in theory > > // we'd retry 6 times before hitting 3s timeout. However, since we > > // estimate the elapsed time based on exp backoff of actual RTO (300ms), > > // we'd bail earlier with only 3 probes. > > +2.1 write(4, ..., 24) = -1 > > +0 %{ assert tcpi_probes == 3, tcpi_probes; \ > > assert tcpi_backoff == 0, tcpi_backoff }% > > +0 close(4) = 0 > >