From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: passt.top; dkim=pass (2048-bit key; secure) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.a=rsa-sha256 header.s=202408 header.b=Rc/tvs+W; dkim-atps=neutral Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id E46775A004F for ; Fri, 13 Sep 2024 06:32:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202408; t=1726201936; bh=9bmzvDIe0TqDbrCfCY1r9cEErzW1eY35oRBL+yN4Us4=; h=From:To:Cc:Subject:Date:From; b=Rc/tvs+Wlnk1jTW+IT7xpPN33DFJx0uGUVenb/fdn0FKHI7BqNBnIRZ6aQ63UxOJq +Lk8pFd003tqEXMeX4JcPJ0MZOJhiXrHuzLfR51hYx7cwIwTE/Z8bhWWMBviYbXqaQ dqO1/+QO/k7EfLGnrQSAsXYFijkEXz1JuhWmXGR+v/FT15b3TBED+5WYo7J8G5BVXH 5ZWgBKmu35iZpMhznzaL5fvBDuy1SUa0B2HTiW18vyuwYtRDD5Nu6lQfEUv/zUGMMP xA4CKnbGU2/mC/Cb5Qvlo7yvTJ2aI3tuDKfW916ixQwIAF45/+VPMYgozyl9IG9C/k FrFVhdlw8X/qA== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4X4hH45Hcvz4xM4; Fri, 13 Sep 2024 14:32:16 +1000 (AEST) From: David Gibson To: passt-dev@passt.top, Stefano Brivio Subject: [PATCH v2 00/10] RFC: Clean up TCP epoll mask handling Date: Fri, 13 Sep 2024 14:32:04 +1000 Message-ID: <20240913043214.1753014-1-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.46.0 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: P5AWCDMSJS3A5JJCZ34IWRN5EX7BI6C6 X-Message-ID-Hash: P5AWCDMSJS3A5JJCZ34IWRN5EX7BI6C6 X-MailFrom: dgibson@gandalf.ozlabs.org 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 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: This is a draft series culminating in greatly simplifying the handling of the epoll event mask for TCP sockets. Doing that requires two major preliminaries: 1) We also need to alter event mask handling for the tap interface, to track and report when it's ready to accept more data. We need this to "unstick" connections where we have pending data on the socket, but weren't able to forward it because we ran out of tap interface buffer space. 2) We need to alter handling of ack sequence numbers to the tap device. Without this, the event mask changes expose a fragility where depending on the precise order things are called we could update the ack pointer without actually sending an ack to the tap interface. This is not ready to go yet. For one thing it tanks some of the throughput numbers for reasons I haven't yet diagnosed. It could also certainly do with another set of eyes looking critically over the event logic changes. In addition, the fragility of the ack-to-tap handling remains. The series fixes the specific problem, but it remains non-obviously unsafe to call tcp_update_seqack_from_tap() if a packet isn't going to be immediately and unconditionally sent to the guest. I've been trying to figure out how to make that more robust without introducing additional TCP_INFO calls, but my brain's seizing up a bit at this point. Patches 1..4/10 are preliminary cleanups which should be safe, though. Feel free to apply as many of those ones as you're happy with. David Gibson (10): tcp: Make some extra functions private tcp: Clean up tcpi_snd_wnd probing tcp: Simplify ifdef logic in tcp_update_seqack_wnd() tcp: Make tcp_update_seqack_wnd()s force_seq parameter explicitly boolean tcp: On socket EPOLLOUT, send new ACK to tap immediately tap: Re-introduce EPOLLET for tap connections tap: Keep track of whether there might be space in the tap buffers tcp: Keep track of connections blocked due to a full tap interface tcp: Move deferred handling functions later in tcp.c tcp: Simplify epoll event mask management tap.c | 58 ++++++++--- tap.h | 1 + tcp.c | 265 ++++++++++++++++++++++++++++--------------------- tcp.h | 13 +-- tcp_buf.c | 15 +-- tcp_buf.h | 6 +- tcp_conn.h | 1 + tcp_internal.h | 6 +- 8 files changed, 222 insertions(+), 143 deletions(-) -- 2.46.0