Intel-Wired-Lan Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 iwl-next 0/5] idpf: Avoid IOVA exhaustion under DMA-FQ IOMMU.
@ 2026-12-05 12:52 Kuniyuki Iwashima
  2026-12-05 12:52 ` [PATCH v2 iwl-next 1/5] idpf: Reuse idpf_rx_update_bufq_desc() in idpf_rx_post_buf_desc() Kuniyuki Iwashima
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Kuniyuki Iwashima @ 2026-12-05 12:52 UTC (permalink / raw)
  To: Alexander Lobakin, Tony Nguyen, Przemek Kitszel,
	Jesper Dangaard Brouer, Ilias Apalodimas
  Cc: Brian Vazquez, David Decotigny, Li Li, Kuniyuki Iwashima,
	Kuniyuki Iwashima, intel-wired-lan

Under an IOMMU DMA-FQ domain, page_pool keeps Rx pages DMA-mapped
until they are returned to the pool.

With many concurrent TCP flows, packets waiting in receive and
out-of-order queues during retransmissions pin thousands to
millions of payload pages in sockets, exhausting the 32-bit IOVA
space and causing alloc_iova() contention and Rx drops.

When running tcp_stream with 100000 flows,

  # tcp_stream -6 --suicide-length=2000 --min-rto=5 --num-threads=256 \
    --test-length=30 --num-flows=100000 --num-ports=20 -B 65536

on the server side, Rx payload pages pinned in socket queues saturate
the 32-bit IOVA window, causing every subsequent DMA mapping (including
Tx in idpf_tx_splitq_frame()) to contend on alloc_iova(), and perf
shows heavy contention with 13.8M dropped packets:

    21.62%  switchto-defaul  [kernel.kallsyms]   [k] queued_spin_lock_slowpath
            |
            ---queued_spin_lock_slowpath
               _raw_spin_lock_irqsave
               alloc_iova
               alloc_iova_fast
               iommu_dma_alloc_iova
               __iommu_dma_map
               __iommu_dma_map_phys
               iommu_dma_map_phys
               dma_map_phys
               idpf_tx_splitq_frame
               dev_hard_start_xmit
               sch_direct_xmit
               __qdisc_run

  # ethtool -S eth1 | grep -E 'ingress_drop3|rx-hsplit'
     rx-hsplit: 92006
     rx-hsplit_hbo: 393
     ingress_drop3.packets: 488310980   # before neper
     ingress_drop3.bytes: 1989178010650

     rx-hsplit: 27779097
     rx-hsplit_hbo: 611
     ingress_drop3.packets: 502138587   # after neper
     ingress_drop3.bytes: 2046991419840

  # dmesg
  [ 1291.279869] idpf 0000:01:00.0: Using 56-bit DMA addresses

On the client side, we can see many retransmissions, and the
throughput is 161 Gbps w/ 200G NIC.

  remote_throughput=161031856462

  TcpInSegs                       19235891           0.0
  TcpOutSegs                      225122216          0.0
  TcpRetransSegs                  20767366           0.0

This series fixes the issue by using a coherent DMA buffer for
fixed-size Rx headers and allowing page_pool pages to be unmapped
early in idpf once active DMA mappings exceed a per-queue threshold:

Patch 1 refactors idpf_rx_post_buf_desc() to reuse
idpf_rx_update_bufq_desc() ahead of the DMA changes.

Patch 2 allocates a coherent DMA buffer array per buffer queue
for Rx header split when an IOMMU DMA domain is active on a
DMA-coherent device without XDP, copying headers into napi_alloc_skb()
to avoid header page pinning and per-packet IOMMU mapping churn.

Patches 3-4 annotate concurrent accesses around pp_magic and add
opt-in page_pool early DMA unmapping (page_pool_enable_dma_unmap(),
page_pool_dma_mapped_pages(), and page_pool_dma_unmap_netmem()).

Patch 5 enables early DMA unmapping for idpf Rx payload queues
without XDP on DMA-coherent devices under IOMMU_DOMAIN_DMA_FQ.
Normal page_pool DMA caching is kept while active mappings remain
at or below a per-queue threshold (splitting a 2G IOVA budget
across all vports), and pages above the threshold are unmapped once
their descriptors complete.

With this series on the same 100k-flow workload, server-side Rx
drops fall from 13.8M to ~460K (steady state), client retransmissions
drop by ~8x (from 20.8M to ~2.5M), throughput recovers from 161 Gbps
to 177 Gbps mean with zero 56-bit DMA fallback, and single-flow
same-CPU tcp_stream (1 queue) shows no regression (97.35 Gbps vs
97.35 Gbps baseline, compared to 68.49 Gbps / -29.6% with v1).

Note: Two pre-existing Rx header split overflow fixes (in
idpf_rx_hsplit_wa() and idpf_rx_rsc()) are sent separately to
iwl-net:

  https://lore.kernel.org/intel-wired-lan/20261205124319.2264197-1-kuniyu@google.com/


Changes:
  v2:
    * Replace v1's unconditional DMA unmapping (page_pool
      dma_sync_for_cpu and libeth fq.no_dma_map patches, which
      regressed single-flow throughput by ~30%) with opt-in
      page_pool early DMA unmapping (patches 3-4) and
      threshold-based unmapping in idpf (patch 5)
    * Coalesce contiguous payload frags and count dropped EOP
      frames against NAPI budget in idpf_rx_splitq_clean_skb()
      (patch 2)

  v1: https://lore.kernel.org/intel-wired-lan/20261202065737.207610-1-kuniyu@google.com/


Kuniyuki Iwashima (5):
  idpf: Reuse idpf_rx_update_bufq_desc() in idpf_rx_post_buf_desc().
  idpf: Use coherent DMA buffer for Rx header split without XDP.
  netmem: Annotate data-races around pp_magic.
  page_pool: Allow drivers to unmap DMA before returning pages.
  idpf: Unmap Rx payload pages above mapped threshold under DMA-FQ
    IOMMU.

 drivers/net/ethernet/intel/idpf/idpf_txrx.c | 569 +++++++++++++++++---
 drivers/net/ethernet/intel/idpf/idpf_txrx.h |  29 +-
 include/linux/mm.h                          |   4 +-
 include/net/page_pool/helpers.h             |  26 +
 include/net/page_pool/types.h               |  16 +
 net/core/netmem_priv.h                      |   8 +-
 net/core/page_pool.c                        | 107 +++-
 7 files changed, 651 insertions(+), 108 deletions(-)

-- 
2.56.1.915.g69d5ec7298-goog


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

end of thread, other threads:[~2026-12-05 13:16 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-05 12:52 [PATCH v2 iwl-next 0/5] idpf: Avoid IOVA exhaustion under DMA-FQ IOMMU Kuniyuki Iwashima
2026-12-05 12:52 ` [PATCH v2 iwl-next 1/5] idpf: Reuse idpf_rx_update_bufq_desc() in idpf_rx_post_buf_desc() Kuniyuki Iwashima
2026-12-05 12:52 ` [PATCH v2 iwl-next 2/5] idpf: Use coherent DMA buffer for Rx header split without XDP Kuniyuki Iwashima
2026-12-05 12:52 ` [PATCH v2 iwl-next 3/5] netmem: Annotate data-races around pp_magic Kuniyuki Iwashima
2026-12-05 12:52 ` [PATCH v2 iwl-next 4/5] page_pool: Allow drivers to unmap DMA before returning pages Kuniyuki Iwashima
2026-12-05 13:15   ` sashiko-bot
2026-12-05 12:52 ` [PATCH v2 iwl-next 5/5] idpf: Unmap Rx payload pages above mapped threshold under DMA-FQ IOMMU Kuniyuki Iwashima
2026-12-05 13:16   ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox