Skip to content

RFC dma-mapping: add dma_alloc_attrs_node() and dma_alloc_coherent_node()

Jakub Kicinski linux-iommu netdev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest11 patches 17 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/11dma-contiguous: pass the NUMA node to dma_alloc_contiguous()drivers/iommu/dma-iommu.c include/linux/dma-map-ops.h kernel/dma/contiguous.c +2 more+13 -131 reply
2/11dma-direct: pass the NUMA node to dma_direct_alloc()arch/x86/kernel/amd_gart_64.c include/linux/dma-direct.h kernel/dma/direct.c +1 more+15 -111 reply
3/11iommu/dma: pass the NUMA node to iommu_dma_alloc()drivers/iommu/dma-iommu.c include/linux/iommu-dma.h kernel/dma/mapping.c+19 -141 reply
4/11dma-mapping: add dma_alloc_attrs_node() and dma_alloc_coherent_node()Documentation/core-api/dma-api.rst include/linux/dma-mapping.h kernel/dma/mapping.c+57 -45 replies
5/11eth: libwx: restore the device's NUMA node after ring allocationdrivers/net/ethernet/wangxun/libwx/wx_lib.c+4 -60 replies
6/11eth: libwx: use dma_alloc_coherent_node()drivers/net/ethernet/wangxun/libwx/wx_lib.c+6 -100 replies
7/11eth: ixgbe: use dma_alloc_coherent_node()drivers/net/ethernet/intel/ixgbe/ixgbe_main.c+6 -148 replies
8/11eth: xgbe: use dma_alloc_coherent_node()drivers/net/ethernet/amd/xgbe/xgbe-desc.c+1 -50 replies
9/11eth: fungible: use dma_alloc_coherent_node()drivers/net/ethernet/fungible/funcore/fun_queue.c+3 -50 replies
10/11eth: mlx5: use dma_alloc_coherent_node()drivers/net/ethernet/mellanox/mlx5/core/alloc.c drivers/net/ethernet/mellanox/mlx5/core/main.c include/linux/mlx5/driver.h+3 -270 replies
11/11eth: mlx4: use dma_alloc_coherent_node()drivers/net/ethernet/mellanox/mlx4/alloc.c drivers/net/ethernet/mellanox/mlx4/en_cq.c drivers/net/ethernet/mellanox/mlx4/en_netdev.c +3 more+14 -210 replies

Reviews trailers per patch

3 of 11 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchBjörn TöpelMarek Szyprowski
SeriesR-b
1/11A-b
2/11A-b
3/11A-b
4/11
5/11
6/11
7/11
8/11
9/11
10/11
11/11

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [RFC 00/11] dma-mapping: add dma_alloc_attrs_node() and dma_alloc_coherent_node()

Hi!

I want to add NUMA-awareness to a networking driver (bnxt) and I run into the inexistence of dma_alloc_coherent_node().

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);

IMHO this looks like an ugly hack. Can we add an API with the Node ID explicitly passed in?

In the unlikely case anyone feels the urgent need to merge this please pull (so that we can also pull this into net-next):

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

Jakub Kicinski (11):
dma-contiguous: pass the NUMA node to dma_alloc_contiguous()
dma-direct: pass the NUMA node to dma_direct_alloc() iommu/dma: pass the NUMA node to iommu_dma_alloc()
dma-mapping: add dma_alloc_attrs_node() and dma_alloc_coherent_node()
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            | 15 ++++++++
 include/linux/dma-direct.h                    |  2 +-
 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 --
 arch/x86/kernel/amd_gart_64.c                 |  3 +-
 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                           | 20 ++++++-----
 kernel/dma/mapping.c                          | 34 ++++++++++++++++---
 kernel/dma/ops_helpers.c                      |  5 +--
 24 files changed, 137 insertions(+), 126 deletions(-)
Signature · 1 line
2.56.0