All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kuniyuki Iwashima <kuniyu@google.com>
To: Alexander Lobakin <aleksander.lobakin@intel.com>,
	Tony Nguyen <anthony.l.nguyen@intel.com>,
	 Przemek Kitszel <przemyslaw.kitszel@intel.com>
Cc: Kuniyuki Iwashima <kuniyu@google.com>,
	Kuniyuki Iwashima <kuni1840@gmail.com>,
	intel-wired-lan@lists.osuosl.org
Subject: [PATCH v1 iwl-next 0/5] idpf: Avoid IOVA exhaustion under DMA-FQ IOMMU.
Date: Wed,  2 Dec 2026 15:57:18 +0900	[thread overview]
Message-ID: <20261202065737.207610-1-kuniyu@google.com> (raw)

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


             reply	other threads:[~2026-12-02  6:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02  6:57 Kuniyuki Iwashima [this message]
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  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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261202065737.207610-1-kuniyu@google.com \
    --to=kuniyu@google.com \
    --cc=aleksander.lobakin@intel.com \
    --cc=anthony.l.nguyen@intel.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=kuni1840@gmail.com \
    --cc=przemyslaw.kitszel@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.