public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
* [PATCH 0/8] multithreading: Prepare data structures for concurrent queue pair workers
@ 2026-06-16 17:10 Laurent Vivier
  2026-06-16 17:10 ` [PATCH 1/8] tap: Convert packet pools to per-queue-pair arrays for multiqueue Laurent Vivier
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Laurent Vivier @ 2026-06-16 17:10 UTC (permalink / raw)
  To: passt-dev; +Cc: Laurent Vivier

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


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-06-16 17:11 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-16 17:10 [PATCH 0/8] multithreading: Prepare data structures for concurrent queue pair workers Laurent Vivier
2026-06-16 17:10 ` [PATCH 1/8] tap: Convert packet pools to per-queue-pair arrays for multiqueue Laurent Vivier
2026-06-16 17:10 ` [PATCH 2/8] tap: Make L4 sequence pools per-qpair for thread safety Laurent Vivier
2026-06-16 17:10 ` [PATCH 3/8] tcp: Make static buffers stack-local " Laurent Vivier
2026-06-16 17:10 ` [PATCH 4/8] udp_vu: Make virtqueue " Laurent Vivier
2026-06-16 17:10 ` [PATCH 5/8] flow: Make flow timer per-caller " Laurent Vivier
2026-06-16 17:10 ` [PATCH 6/8] tcp: Make TCP timer state per-caller and guard global tasks Laurent Vivier
2026-06-16 17:10 ` [PATCH 7/8] tcp: Protect init socket pools with mutex for thread safety Laurent Vivier
2026-06-16 17:10 ` [PATCH 8/8] flow: Add mutex and per-qpair filtering to flow table operations Laurent Vivier

Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).