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=202510 header.b=Zb8oZGxA; dkim-atps=neutral Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 5D6D55A061B for ; Thu, 23 Oct 2025 03:42:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202510; t=1761183731; bh=ma48KBA9vStf31wAZbMJIV07oZZBErNbsPkANiMVP+8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Zb8oZGxAPW/hYz9wpEl1+hrqKoyH6DwUL4LH/X2dEPcy+BB/4u1aj9Va9IpsDNe+5 o56R0Lt4UF5XDiCQefdeAsEmq2PtBS6ZSC1hCSqi5iK9NAlEsI9Va4ZcIkpNob1YYu bGX+Q6vt4tz+jFvJjgfzF8DmedLEDVYh2QIpL1WMquNzvqtd01Rcr0gDtXuvrAC3Aw Eo0TAWiQP+Tsby+72GFN8X6EG4Tw0LsYKmMAkvTtnqrz2Bhno8vaXhLtb3thSSB8JC EZ+p36zAZHX0Vj6t8RSqG6Pngn0N1nhbNH2pJyWyE7oC2/BGmB56CJMLcD15FYXupx Le4xFtJpj/f0Q== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4csTKv1jJbz4wM4; Thu, 23 Oct 2025 12:42:11 +1100 (AEDT) Date: Thu, 23 Oct 2025 12:39:21 +1100 From: David Gibson To: Laurent Vivier Subject: Re: [PATCH v5 4/7] tcp, flow: Replace per-connection in_epoll flag with an epollid in flow_common Message-ID: References: <20251021210116.314674-1-lvivier@redhat.com> <20251021210116.314674-5-lvivier@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="dOlWelvxbZdi8r9J" Content-Disposition: inline In-Reply-To: <20251021210116.314674-5-lvivier@redhat.com> Message-ID-Hash: QOER63NC2JH734FQ6AHVTU5NCA3V5NUL X-Message-ID-Hash: QOER63NC2JH734FQ6AHVTU5NCA3V5NUL 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: passt-dev@passt.top 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: --dOlWelvxbZdi8r9J Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Oct 21, 2025 at 11:01:13PM +0200, Laurent Vivier wrote: > The in_epoll boolean flag in tcp_tap_conn and tcp_splice_conn only tracked > whether a connection was registered with epoll, not which epoll instance. > This limited flexibility for future multi-epoll support. >=20 > Replace the boolean with an epollid field in flow_common that identifies > which epoll instance the flow is registered with. > Use FLOW_EPOLLID_INVALID to indicate when a flow is not registered with > any epoll instance. An epoll_id_to_fd[] mapping table translates > epoll ids to their corresponding epoll file descriptors. >=20 > Add helper functions: > - flow_in_epoll() to check if a flow is registered with epoll > - flow_epollfd() to retrieve the epoll fd for a flow's thread > - flow_epollid_register() to register an epoll fd with an epollid > - flow_epollid_set() to set the epollid of a flow > - flow_epollid_clear() to reset the epoll id of a flow >=20 > This change also simplifies tcp_timer_ctl() and conn_flag_do() by removing > the need to pass the context 'c', since the epoll fd is now directly > accessible from the flow structure via flow_epollfd(). >=20 > Add a defensive check at the beginning of tcp_flow_repair_queue() to > avoid a false positive with "make clang-tidy": > error: The 1st argument to 'send' is < 0 but should be >=3D 0 > 3230 | ssize_t rc =3D send(conn->sock, p, MIN(len, chu= nk), 0); >=20 > Signed-off-by: Laurent Vivier Reviewed-by: David Gibson [snip] > @@ -570,7 +573,7 @@ static void tcp_timer_ctl(const struct ctx *c, struct= tcp_tap_conn *conn) > } > conn->timer =3D fd; > =20 > - if (epoll_ctl(c->epollfd, EPOLL_CTL_ADD, conn->timer, &ev)) { > + if (epoll_ctl(epollfd, EPOLL_CTL_ADD, conn->timer, &ev)) { I still think it's a bug that the timer's ref.fd field isn't the timer fd, but I recognize that fixing that is not in scope for this series. --=20 David Gibson (he or they) | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you, not the other way | around. http://www.ozlabs.org/~dgibson --dOlWelvxbZdi8r9J Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmj5h0gACgkQzQJF27ox 2Gf0RRAAh3sullTI2cewIJ8foX+/BXlKjguMfiaPR+D1rQVBGLUDngq8BU2d0/Gk zx5BuRuFWxGNZ3TeGY+5H9gohgH9KiZkDHeBRnQbWMLa3QKXWWT1lpmgdQqauW0s JiALNf/kULJYd//kqsdOZJKotWBDno1AziFr4BMhPKcB522xEAleHMXPdo3EGs8w rTZHMmrwO38pDrTaxEsqZgbuD+e1fKnKNZtQwV+uThBIfKMYVOfZKh82p8U2GIwM qm3iyvHm4uQ4zt/DpqOzaIYJxDYlUde42tbBjESQlZYCsxs8EGeewCQCvtlUdHh+ Avrkx34/MDSfPUBWMU8ZIkJ2fViLc23T42BBuZLbSRLT3nRX6VMt3MwYAFS6s/l6 8ReOkQNog+/l/o39PO/CsRaOCFpQxrTSp1yggQW/6Vde1Jyq8Kf/Ake7C0Vl5z72 mGLu93ynhDl6yt8e5hMLWmw+NkTGBkf6eCd7K3oLiUNhUmuA6Xeo7lLi60EDvZ1w VCQkNvuqMJKhVJ4wfjeEr0U6o960SpzxMbMHVSQT7KkPXZHvqT01E0jc1nwqnnfp wZABF2NcYPs6sznbmjWmGH9uG3+Tt7uokqO38UMHA1S1+mgdR2Cv00esKcPnK+Qo ldfDu1IYa1LBnSpP2drZNmR3r6042xMq0yifm/MVlcxpLGVAijM= =ndEd -----END PGP SIGNATURE----- --dOlWelvxbZdi8r9J--