🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #15295

Re: [PATCH 00/11] dma-mapping: add dma_alloc_attrs_node() and dma_alloc_coherent_node()

#15295
From: Robin Murphy
Date: Thu, 12 Nov 2026 16:51
80 lines
11708 bytes
On 2026-11-06 6:44 pm, Jakub Kicinski wrote:
> 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()

The API side of things looks OK to me. For the DMA patches at least,

Reviewed-by: Robin Murphy <robin.murphy@arm.com>

>    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(-)
> 
Technical Details
Message-ID: <43de98e8-a67d-495a-9315-478acfa18d99@arm.com>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-362026-linux-kernel-netdev=dewy.ru
References: <20261106184433.761422-1-kuba@kernel.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-362026-linux-kernel-netdev=dewy.ru
From: robin.murphy@arm.com (Robin Murphy)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH 00/11] dma-mapping: add dma_alloc_attrs_node() and
 dma_alloc_coherent_node()
Date: Thu, 12 Nov 2026 16:51:23 +0000
Organization: Usenet Network
Message-ID: <43de98e8-a67d-495a-9315-478acfa18d99@arm.com>
References: <20261106184433.761422-1-kuba@kernel.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1129489"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:NvKX86qeTZ/jXyYvHEeVUjpA2ZY= sha256:lonD5utaxgVYeumn7qv3VvE9hbXK04YQOdnU/Favdhs=
	sha1:z8pwp3+O/+nXD0bwjCuSoTprVHM= sha256:E+AMWqvmE4Eq3rZlW9U7Dw6ZSXE27kP+opB25m5YTpQ=
Content-Language: en-GB
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id DD9991142FD; Thu, 12 Nov 2026 19:57:33 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -2.851
X-Spam-Status: No, score=-2.851 tagged_above=-9999 required=6.31
	tests=[DKIM_INVALID=0.1, DKIM_SIGNED=0.1,
	HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1,
	RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001]
	autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=neutral
	reason="invalid (public key: DNS error: query timed out)"
	header.d=arm.com
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id 7SyvHZCfpVjh;
	Thu, 12 Nov 2026 19:57:22 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-362026-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=arm.com
X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
	by mail.dewy.ru (Postfix) with ESMTPS id 417C61142F8; Thu, 12 Nov 2026 19:57:06 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sto.lore.kernel.org (Postfix) with ESMTP id A1CB2640B4B; Thu, 12 Nov 2026 16:51:30 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1794502288;
	b=hbBeRzK8cQW+8JtBN8X4U8+5J10bcQodZNwaGGN0j6B8nVUp1L7Aif8eoEkkD2iJHCJO
	 O13ncbsnWCdJPj/TkPVXZH7Lbrtwlj+lQIHYRcZ6zUU4MH7cDARh88vSaf0KfTcnEIFfF
	 tNbxtGW1MyLRbZFE1T/+lUeWntgfUCPy8r3Km4/IYcijfqnIUeX2vNDiEzZutGF5MMuZw
	 vJCLSFCU2Dwq7k4GGZS5+D89Pq9S3ZULbeu8s2ljaqSUg9oYgLMImMIC0FJRXKEr445qN
	 ZLgSCxffyVaEXRkDN3T4hqN48gFTzyz8Mz+gquaP3D71vcvrWAdIEwqUiFWau+gxuCA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794502288;
	h=X-Original-To:Received:DMARC-Filter:Received:Received:DKIM-Signature:
	 Message-ID:Date:X-Mailing-List:List-Id:List-Post:List-Help:
	 List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 User-Agent:Subject:To:Cc:References:From:Content-Language:In-Reply-To:
	 Content-Type:Content-Transfer-Encoding;
	bh=YSV4wnE5JrNZpfy9DXizyOVofgXc49f/P/CmYGZXquc=;
	b=rRvCvAw76knWScNGUOCnOU20U7irE4lKtJcWObtk4nHtkwusLfom07LkDjZTVoiMcv0/
	 hp5RY0qRAQUqqZpADiFiiP6wse25WSJPNZht0M94oYj1I5p4oZ8N4lM0Csa4CMUbG9Srg
	 XBn6llovKVfmAfEj1M5Q4HjSAZMDyBd4+j2GUX5ZeD+XxJAMmFyXAMCCkDAkbGm+eNO7a
	 QNxMytKTSFPiAq/OFe3tCQJrJkgdHeydkNdOMhD14VMVx4UUW4lKozqh0OHDa6fOEDWXY
	 v9Xoj7VkWM/kn+a0lw96V9km69yH7Y+kltC1kWAzuneWudmJarjMU6eooMpBIKjZ9AA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=foss header.b=lYu5Ew+C;
	dmarc=pass header.from=arm.com;
	spf=pass smtp.mailfrom=arm.com;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 850F6606A335;
	Thu, 12 Nov 2026 16:51:28 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=foss header.b=lYu5Ew+C
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=217.140.110.172
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1794502287;
	b=UgJ2zIZn1C/ahmKl2HU4QCzdIsEnPqW0BFcp+XtQHYXzg9whOr9MEUPVuHF6QCs8sz5W
	 J0ffdfSMC9N6CEAEVMMezU6ekVPLH75+eQmy6mTrDziadXwIEiG+wbQjwY0cVePRfU1Rm
	 WM6SIJ+0OcCp0HCKu2nLnezculS9iroUTFtrY9Bk9xvHG08JATKCNjtw8w97xFXZRmHpa
	 c/9F6YaVXEsj7wiwgDgpUBx6TP8uTHZCoajIDAJB4npYg2UKkwkFfm9zZ6njeXhCOSXoi
	 xtzQvrY3xaPCUzY+ZACJxKGChVnVzlRjuzUC4StEwwQYvIXBDF1MPbzhFox8bdZgWKQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794502287;
	h=DMARC-Filter:Received:Received:DKIM-Signature:Message-ID:Date:
	 MIME-Version:User-Agent:Subject:To:Cc:References:From:
	 Content-Language:In-Reply-To:Content-Type:Content-Transfer-Encoding;
	bh=YSV4wnE5JrNZpfy9DXizyOVofgXc49f/P/CmYGZXquc=;
	b=gI95kkyJqj4XXyGCtus/S61fkWfyFKp8bn6RIeAmrDlFunOO0fVvQkylEDp4cm9F8t6h
	 gbR6YqquMgPIhSXsTodiNnt2Flf4rupnitvN7CGGQ/suEa6tlPylHE90V5fP0e6nfxrlQ
	 utkOQk0mwDKU2VxMgUwO9vqtgbsTD9pZwsL9U7yrFA5cYqnxvtptkAk2v4HXqfg4odmNu
	 aYWluqAkA19ZbWkkN88FljMFKl3WoFtdNUmuqYVIv8yc0pSY7sbnhwAGGx14vGstCdYO+
	 /wUfoC0+WVOCOOs5I6rvEBE9c1altajswH3JvY1rNFhhpx2N4A+TEJiN5xGnLlq6OEg==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=arm.com;
	spf=pass smtp.mailfrom=arm.com;
	dkim=pass header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=foss header.b=lYu5Ew+C;
	arc=none smtp.remote-ip=217.140.110.172
X-Received: from foss.arm.com (foss.arm.com [217.140.110.172])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 1B33A606A323
	for <netdev@vger.kernel.org>; Thu, 12 Nov 2026 16:51:26 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 1B33A606A323
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com
X-Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14])
	by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 47485165C;
	Thu, 12 Nov 2026 08:51:23 -0800 (PST)
X-Received: from [10.57.89.53] (unknown [10.57.89.53])
	by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 537BC3F673;
	Thu, 12 Nov 2026 08:51:25 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss;
	t=1794502286; bh=gziiyQK1BxD/KktmJz3UhiBC7eUPuphRzNgyTLRGPU0=;
	h=Date:Subject:To:Cc:References:From:In-Reply-To:From;
	b=lYu5Ew+C7yrCa7RiggELSeaEVOzRU7KJiR4EJu/2oEpURAFtwE8k67E7Izln+GUfX
	 kfxIZHPbjrHc+L9EPzlccgoH6aIkZj9yt8ONOULn5aeisq6g+1hcsKoEubUszevAlR
	 GEyEiV2XFTVYzg5ptf6a6caWz04aM7qR/SD8rT0o=
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-User-Agent: Mozilla Thunderbird
X-Cc: netdev@vger.kernel.org, iommu@lists.linux.dev, joro@8bytes.org,
 will@kernel.org
X-In-Reply-To: <20261106184433.761422-1-kuba@kernel.org>