From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: passt.top; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Xy6DbadH; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by passt.top (Postfix) with ESMTPS id 7F8425A026F for ; Fri, 03 Oct 2025 17:27:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1759505242; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vuycFv/aTYIBIkmQpNu6GpPE6ddOYXUxw0Rt4OOS5wg=; b=Xy6DbadHpUpQXYlrK2iZKriN1b/GVmbmqHnQK6EIlrFUYSvWW8YJ4+LjUmGZH+Peoo6XNh CEEKC1SnOIcmeuxc5zlxoM/vK7z9l204oedn7+HzXBnQfF64nzM49meDDJSkUK7FrTs21x bWP7D0seHTnrbByi6uLQvKf7rmmQqy8= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-639-0wGlHEBZPFCYM1YbqyM3vQ-1; Fri, 03 Oct 2025 11:27:20 -0400 X-MC-Unique: 0wGlHEBZPFCYM1YbqyM3vQ-1 X-Mimecast-MFC-AGG-ID: 0wGlHEBZPFCYM1YbqyM3vQ_1759505240 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 21C1B1956050 for ; Fri, 3 Oct 2025 15:27:20 +0000 (UTC) Received: from lenovo-t14s.redhat.com (unknown [10.45.224.166]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 0DB9D19560B1; Fri, 3 Oct 2025 15:27:18 +0000 (UTC) From: Laurent Vivier To: passt-dev@passt.top Subject: [PATCH 0/5] Refactor epoll handling in preparation for multithreading Date: Fri, 3 Oct 2025 17:27:12 +0200 Message-ID: <20251003152717.2437765-1-lvivier@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: _KOgD8qVAWzduKuNzkbcZaYwxJA4RaUgEJCy2u-bBbQ_1759505240 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID-Hash: SYLWF4GXH4MCH3GLT7I77SGKEKZ5JRM7 X-Message-ID-Hash: SYLWF4GXH4MCH3GLT7I77SGKEKZ5JRM7 X-MailFrom: lvivier@redhat.com 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: Laurent Vivier 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 series refactors how epoll file descriptors are managed throughout=0D the codebase in preparation for introducing multithreading support.=0D Currently, passt uses a single global epollfd accessed through the=0D context structure. With multithreading, each thread will have its own=0D epollfd managing its subset of flows.=0D =0D The key changes are:=0D =0D 1. Simplify epoll_del() to take the epollfd directly rather than=0D extracting it from the context structure, reducing tight coupling.=0D =0D 2. Move epoll registration out of the socket creation function=0D (sock_l4_sa()) into protocol-specific code, giving callers explicit=0D control over which epoll instance manages each socket.=0D =0D 3. Replace the boolean in_epoll flag in TCP connection structures with=0D an epollfd field in flow_common. This serves dual purposes: tracking=0D whether a flow is registered (zero =3D not registered) and which epoll= =0D instance owns it (non-zero =3D specific epollfd).=0D =0D 4. Apply this pattern consistently across all protocol handlers (TCP,=0D ICMP, UDP), storing the managing epollfd in each flow's common=0D structure.=0D =0D These changes make the epoll ownership model explicit in the flow=0D tracking system, allowing flows to be managed by different epoll=0D instances - a prerequisite for the per-thread epollfd design in the=0D upcoming multithreading work.=0D =0D Laurent Vivier (5):=0D util: Simplify epoll_del() interface to take epollfd directly=0D util: Move epoll registration out of sock_l4_sa()=0D tcp, flow: Replace per-connection in_epoll flag with epollfd in=0D flow_common=0D icmp: Use epollfd from flow_common structure=0D udp: Use epollfd from flow_common structure=0D =0D flow.c | 12 +++++-------=0D flow.h | 4 +++-=0D icmp.c | 23 ++++++++++++++++++-----=0D pif.c | 34 ++++++++++++++++++++++++++++------=0D tap.c | 2 +-=0D tcp.c | 36 ++++++++++++++++++------------------=0D tcp_conn.h | 8 +-------=0D tcp_splice.c | 23 +++++++++++------------=0D udp_flow.c | 23 ++++++++++++++++++++---=0D util.c | 21 ++++-----------------=0D util.h | 4 ++--=0D vhost_user.c | 6 +++---=0D 12 files changed, 114 insertions(+), 82 deletions(-)=0D =0D --=20=0D 2.50.1=0D =0D