Netdev List
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: robin.murphy@arm.com, m.szyprowski@samsung.com
Cc: netdev@vger.kernel.org, iommu@lists.linux.dev, joro@8bytes.org,
	will@kernel.org, Jakub Kicinski <kuba@kernel.org>
Subject: [PATCH 00/11] dma-mapping: add dma_alloc_attrs_node() and dma_alloc_coherent_node()
Date: Fri,  6 Nov 2026 10:44:22 -0800	[thread overview]
Message-ID: <20261106184433.761422-1-kuba@kernel.org> (raw)

Hi!

On NUMA systems networking drivers want to allocate rings
and buffers close to the NAPI-handling core rather than
allocating all from where the device is connected.

Looks like we have accumulated 6 drivers which do:

       set_dev_node(dma_dev, numa_node);
       va = dma_alloc_coherent(...);
       set_dev_node(dma_dev, old_node);

Introduce dma_alloc_coherent_node() so that such racy
hacks are no longer necessary.

Note that making dma_map_ops->alloc() callbacks explicit-node-aware
is left for future work.

Stable tag on top of v7.4-rc1, so that we can also pull this into
the networking tree:

  git://git.kernel.org/pub/scm/linux/kernel/git/kuba/linux.git tags/dma_alloc_coherent_node

v1:
 - add the API first, then wire up the node in dma-direct, iommu-dma
   and CMA (Robin)
 - add dma_direct_alloc_node() and keep dma_direct_alloc() as a wrapper,
   swiotlb-xen uses it as its ->alloc (fixes the build on arm/arm64),
   arch/x86 no longer needs changes
 - docs: drop the NUMA_NO_NODE suggestion from dma-api.rst (Björn)
 - docs: document that CMA does not fall back to other nodes' areas (Björn)
 - docs: document which allocations ignore the node
 - explain the separate GPL-only export in the commit message (Marek)
rfc: https://lore.kernel.org/20261027022528.633359-1-kuba@kernel.org

Jakub Kicinski (11):
  dma-mapping: add dma_alloc_attrs_node() and dma_alloc_coherent_node()
  dma-direct: add dma_direct_alloc_node()
  iommu/dma: pass the NUMA node to iommu_dma_alloc()
  dma-contiguous: pass the NUMA node to dma_alloc_contiguous()
  eth: libwx: restore the device's NUMA node after ring allocation
  eth: libwx: use dma_alloc_coherent_node()
  eth: ixgbe: use dma_alloc_coherent_node()
  eth: xgbe: use dma_alloc_coherent_node()
  eth: fungible: use dma_alloc_coherent_node()
  eth: mlx5: use dma_alloc_coherent_node()
  eth: mlx4: use dma_alloc_coherent_node()

 Documentation/core-api/dma-api.rst            | 17 ++++++++
 include/linux/dma-direct.h                    | 11 ++++-
 include/linux/dma-map-ops.h                   |  5 ++-
 include/linux/dma-mapping.h                   | 14 +++++++
 include/linux/iommu-dma.h                     |  2 +-
 include/linux/mlx4/device.h                   |  2 +-
 include/linux/mlx5/driver.h                   |  2 -
 drivers/iommu/dma-iommu.c                     | 30 ++++++++------
 drivers/net/ethernet/amd/xgbe/xgbe-desc.c     |  6 +--
 .../net/ethernet/fungible/funcore/fun_queue.c |  8 ++--
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 20 +++-------
 drivers/net/ethernet/mellanox/mlx4/alloc.c    | 12 +++---
 drivers/net/ethernet/mellanox/mlx4/en_cq.c    |  9 +----
 .../net/ethernet/mellanox/mlx4/en_netdev.c    |  2 +-
 drivers/net/ethernet/mellanox/mlx4/en_rx.c    |  5 +--
 drivers/net/ethernet/mellanox/mlx4/en_tx.c    |  5 +--
 .../net/ethernet/mellanox/mlx5/core/alloc.c   | 24 ++---------
 .../net/ethernet/mellanox/mlx5/core/main.c    |  4 --
 drivers/net/ethernet/wangxun/libwx/wx_lib.c   | 22 ++++------
 kernel/dma/contiguous.c                       | 12 +++---
 kernel/dma/direct.c                           | 22 +++++-----
 kernel/dma/mapping.c                          | 40 +++++++++++++++++--
 kernel/dma/ops_helpers.c                      |  5 ++-
 23 files changed, 152 insertions(+), 127 deletions(-)

-- 
2.56.0


             reply	other threads:[~2026-11-06 18:44 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-06 18:44 Jakub Kicinski [this message]
2026-11-06 18:44 ` [PATCH 01/11] dma-mapping: add dma_alloc_attrs_node() and dma_alloc_coherent_node() Jakub Kicinski
2026-11-06 23:41   ` Marek Szyprowski
2026-11-06 18:44 ` [PATCH 02/11] dma-direct: add dma_direct_alloc_node() Jakub Kicinski
2026-11-06 18:44 ` [PATCH 03/11] iommu/dma: pass the NUMA node to iommu_dma_alloc() Jakub Kicinski
2026-11-06 18:44 ` [PATCH 04/11] dma-contiguous: pass the NUMA node to dma_alloc_contiguous() Jakub Kicinski
2026-11-06 18:44 ` [PATCH 05/11] eth: libwx: restore the device's NUMA node after ring allocation Jakub Kicinski
2026-11-06 18:44 ` [PATCH 06/11] eth: libwx: use dma_alloc_coherent_node() Jakub Kicinski
2026-11-06 18:44 ` [PATCH 07/11] eth: ixgbe: " Jakub Kicinski
2026-11-06 18:44 ` [PATCH 08/11] eth: xgbe: " Jakub Kicinski
2026-11-06 18:44 ` [PATCH 09/11] eth: fungible: " Jakub Kicinski
2026-11-06 18:44 ` [PATCH 10/11] eth: mlx5: " Jakub Kicinski
2026-11-06 18:44 ` [PATCH 11/11] eth: mlx4: " Jakub Kicinski

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=20261106184433.761422-1-kuba@kernel.org \
    --to=kuba@kernel.org \
    --cc=iommu@lists.linux.dev \
    --cc=joro@8bytes.org \
    --cc=m.szyprowski@samsung.com \
    --cc=netdev@vger.kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=will@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox