Intel-Wired-Lan Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 iwl-next 0/5] idpf: Avoid IOVA exhaustion under DMA-FQ IOMMU.
@ 2026-12-02  6:57 Kuniyuki Iwashima
  2026-12-02  6:57 ` [PATCH v1 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; 9+ messages in thread
From: Kuniyuki Iwashima @ 2026-12-02  6:57 UTC (permalink / raw)
  To: Alexander Lobakin, Tony Nguyen, Przemek Kitszel
  Cc: 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 unmapping Rx payload pages in idpf once
their descriptors complete:

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 fix page_pool_init() to enable dma_sync_for_cpu only
under PP_FLAG_DMA_MAP and allow libeth Rx queues to opt out of
page_pool DMA mapping.

Patch 5 opts out of page_pool DMA mapping for idpf Rx payload
queues without XDP under IOMMU_DOMAIN_DMA_FQ, tracking per-page
active descriptor counts so sub-page fragment sharing and skb
truesize are preserved while each page is unmapped as soon as its
descriptors complete.

With this series on the same 100k-flow workload, server-side Rx
drops fall from 13.8M to 84K, client retransmissions drop by 19x
(from 20.8M to 1.1M), and throughput recovers from 161 Gbps to
178 Gbps.


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.
  page_pool: Set dma_sync_for_cpu only under PP_FLAG_DMA_MAP.
  libeth: Allow opting out of page_pool DMA mapping on Rx.
  idpf: Unmap Rx payload pages under DMA-FQ IOMMU.

 drivers/net/ethernet/intel/idpf/idpf_txrx.c | 617 +++++++++++++++++---
 drivers/net/ethernet/intel/idpf/idpf_txrx.h |  30 +-
 drivers/net/ethernet/intel/libeth/rx.c      |   3 +-
 include/net/libeth/rx.h                     |   2 +
 net/core/page_pool.c                        |   2 +-
 5 files changed, 553 insertions(+), 101 deletions(-)

-- 
2.56.1.911.g883d8bcb20-goog


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

end of thread, other threads:[~2026-12-02  7:33 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-02  6:57 [PATCH v1 iwl-next 0/5] idpf: Avoid IOVA exhaustion under DMA-FQ IOMMU Kuniyuki Iwashima
2026-12-02  6:57 ` [PATCH v1 iwl-next 1/5] idpf: Reuse idpf_rx_update_bufq_desc() in idpf_rx_post_buf_desc() Kuniyuki Iwashima
2026-12-02  6:57 ` [PATCH v1 iwl-next 2/5] idpf: Use coherent DMA buffer for Rx header split without XDP Kuniyuki Iwashima
2026-12-02  7:19   ` sashiko-bot
2026-12-02  7:33     ` Kuniyuki Iwashima
2026-12-02  6:57 ` [PATCH v1 iwl-next 3/5] page_pool: Set dma_sync_for_cpu only under PP_FLAG_DMA_MAP Kuniyuki Iwashima
2026-12-02  6:57 ` [PATCH v1 iwl-next 4/5] libeth: Allow opting out of page_pool DMA mapping on Rx Kuniyuki Iwashima
2026-12-02  6:57 ` [PATCH v1 iwl-next 5/5] idpf: Unmap Rx payload pages under DMA-FQ IOMMU Kuniyuki Iwashima
2026-12-02  7:13   ` sashiko-bot

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