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=JGzKBhPN; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by passt.top (Postfix) with ESMTPS id 035A95A026E for ; Tue, 16 Jun 2026 19:10:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1781629856; 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=xwGo4KK0YXGLKjEnvqpiWpMmwEcRQW+etcR35onqG+k=; b=JGzKBhPNBGNzQnL+VbasmQ1drdp9CUlkZLMEAedPG4x3d6qeEfZePE29oXZVWrnzIIpK3b pifkNlXG1EuBVwCBvz9T7i7QKZqZkYrvlRswx0FV7/Hfd36H1iU0DvwdXbCPLPM8o7D8dS GZfn05aPOpalRcaorkFn4ZOCL7jWtIg= Received: from mx-prod-mc-01.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-168-0DTCeZqjOKWEN2OZdyCDag-1; Tue, 16 Jun 2026 13:10:55 -0400 X-MC-Unique: 0DTCeZqjOKWEN2OZdyCDag-1 X-Mimecast-MFC-AGG-ID: 0DTCeZqjOKWEN2OZdyCDag_1781629854 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6005C1955E86 for ; Tue, 16 Jun 2026 17:10:54 +0000 (UTC) Received: from lenovo-t14s.redhat.corp (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 80DEE195419F; Tue, 16 Jun 2026 17:10:53 +0000 (UTC) From: Laurent Vivier To: passt-dev@passt.top Subject: [PATCH 0/8] multithreading: Prepare data structures for concurrent queue pair workers Date: Tue, 16 Jun 2026 19:10:44 +0200 Message-ID: <20260616171052.3785909-1-lvivier@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: yrEdeTAMy25vLUm8aP9vZtgx0zElntBJ9kUhQTD33PA_1781629854 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-ID-Hash: 4AUWLHRXGUSLUP7KSIGIGPAIG7WN52I5 X-Message-ID-Hash: 4AUWLHRXGUSLUP7KSIGIGPAIG7WN52I5 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 makes the passt data structures safe for concurrent access by multiple worker threads, each handling a different queue pair. It builds on the multiqueue series which threads the queue pair parameter through the network stack. The changes fall into three categories: 1. Per-queue-pair data isolation: - Convert packet pools (pool_tap4, pool_tap6) to per-queue-pair arrays - Convert L4 sequence batching arrays (tap4_l4, tap6_l4) similarly - Move flow and TCP timer state out of global/context structures into per-caller parameters 2. Stack-local buffers: - Move static iovec and virtqueue buffers onto the stack in tcp.c, tcp_vu.c, and udp_vu.c so each thread operates on its own copy 3. Locking for remaining shared state: - pthread_mutex on pre-opened socket pools (init_sock_pool4/6) - pthread_rwlock on the flow table, hash table, and free list, with read locks for lookups and write locks for mutations - _Thread_local for flow_new_entry so each thread independently tracks its in-progress allocation - Per-qpair filtering in flow_defer_handler() so each worker only processes its own flows Global operations that don't need per-queue-pair handling (tcp_payload_flush, socket pool refills) are guarded to run only on queue pair 0. Based-on: 20260616125130.1324274-1-lvivier@redhat.com Laurent Vivier (8): tap: Convert packet pools to per-queue-pair arrays for multiqueue tap: Make L4 sequence pools per-qpair for thread safety tcp: Make static buffers stack-local for thread safety udp_vu: Make virtqueue buffers stack-local for thread safety flow: Make flow timer per-caller for thread safety tcp: Make TCP timer state per-caller and guard global tasks tcp: Protect init socket pools with mutex for thread safety flow: Add mutex and per-qpair filtering to flow table operations flow.c | 68 +++++++++++++++++++++++++------- flow.h | 2 +- flow_table.h | 2 +- passt.c | 37 +++++++++-------- tap.c | 109 +++++++++++++++++++++++++++++---------------------- tap.h | 2 +- tcp.c | 64 +++++++++++++++++++----------- tcp.h | 9 +---- tcp_vu.c | 33 ++++++++++------ udp_vu.c | 4 +- vu_common.c | 2 +- 11 files changed, 203 insertions(+), 129 deletions(-) -- 2.54.0