RDMA: Enable operation with DMA debug enabled
Subsystems (9)
v3 cover RDMA: Enable operation with DMA debug enabled
Add a new DMA_ATTR_REQUIRE_COHERENT attribute to the DMA API to mark mappings that must run on a DMA‑coherent system. Such buffers cannot use the SWIOTLB path, may overlap with CPU caches, and do not depend on explicit cache flushing.
Mappings using this attribute are rejected on systems where cache side‑effects could lead to data corruption, and therefore do not need the cache‑overlap debugging logic. This series also includes fixes for DMA_ATTR_CPU_CACHE_CLEAN handling.
Thanks.
---
Changes in v3:
- Enriched commit messages and documentation
- Added ROB tags
- Link to v2: https://patch.msgid.link/[email protected]
Changes in v2:
- Added DMA_ATTR_REQUIRE_COHERENT attribute
- Added HMM patch which needs this attribute as well
- Renamed DMA_ATTR_CPU_CACHE_CLEAN to be DMA_ATTR_DEBUGGING_IGNORE_CACHELINES
- Link to v1: https://patch.msgid.link/[email protected]
---
Leon Romanovsky (8):
dma-debug: Allow multiple invocations of overlapping entries
dma-mapping: handle DMA_ATTR_CPU_CACHE_CLEAN in trace output
dma-mapping: Clarify valid conditions for CPU cache line overlap
dma-mapping: Introduce DMA require coherency attribute
dma-direct: prevent SWIOTLB path when DMA_ATTR_REQUIRE_COHERENT is set iommu/dma: add support for DMA_ATTR_REQUIRE_COHERENT attribute RDMA/umem: Tell DMA mapping that UMEM requires coherency mm/hmm: Indicate that HMM requires DMA coherency
Documentation/core-api/dma-attributes.rst | 38 ++++++++++++++++++++++++------- drivers/infiniband/core/umem.c | 5 ++-- drivers/iommu/dma-iommu.c | 21 +++++++++++++---- drivers/virtio/virtio_ring.c | 10 ++++---- include/linux/dma-mapping.h | 15 ++++++++---- include/trace/events/dma.h | 4 +++- kernel/dma/debug.c | 9 ++++---- kernel/dma/direct.h | 7 +++--- kernel/dma/mapping.c | 6 +++++ mm/hmm.c | 4 ++-- 10 files changed, 86 insertions(+), 33 deletions(-)
---
base-commit: 11439c4635edd669ae435eec308f4ab8a0804808
change-id: 20260305-dma-debug-overlap-21487c3fa02c
Best regards,
Signature · 1 line
Leon Romanovsky <[email protected]>
PATCH v3 1/8 dma-debug: Allow multiple invocations of overlapping entries
From: Leon Romanovsky <[email protected]>
Repeated DMA mappings with DMA_ATTR_CPU_CACHE_CLEAN trigger the following splat. This prevents using the attribute in cases where a DMA region is shared and reused more than seven times.
------------[ cut here ]------------ DMA-API: exceeded 7 overlapping mappings of cacheline 0x000000000438c440 WARNING: kernel/dma/debug.c:467 at add_dma_entry+0x219/0x280, CPU#4: ibv_rc_pingpong/1644 Modules linked in: xt_conntrack xt_MASQUERADE nf_conntrack_netlink nfnetlink iptable_nat nf_nat xt_addrtype br_netfilter rpcsec_gss_krb5 auth_rpcgss oid_registry overlay mlx5_fwctl zram zsmalloc mlx5_ib fuse rpcrdma rdma_ucm ib_uverbs ib_iser libiscsi scsi_transport_iscsi ib_umad rdma_cm ib_ipoib iw_cm ib_cm mlx5_core ib_core CPU: 4 UID: 2733 PID: 1644 Comm: ibv_rc_pingpong Not tainted 6.19.0+ #129 PREEMPT Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014 RIP: 0010:add_dma_entry+0x221/0x280 Code: c0 0f 84 f2 fe ff ff 83 e8 01 89 05 6d 99 11 01 e9 e4 fe ff ff 0f 8e 1f ff ff ff 48 8d 3d 07 ef 2d 01 be 07 00 00 00 48 89 e2 <67> 48 0f b9 3a e9 06 ff ff ff 48 c7 c7 98 05 2b 82 c6 05 72 92 28 RSP: 0018:ff1100010e657970 EFLAGS: 00010002 RAX: 0000000000000007 RBX: ff1100010234eb00 RCX: 0000000000000000 RDX: ff1100010e657970 RSI: 0000000000000007 RDI: ffffffff82678660 RBP: 000000000438c440 R08: 0000000000000228 R09: 0000000000000000 R10: 00000000000001be R11: 000000000000089d R12: 0000000000000800 R13: 00000000ffffffef R14: 0000000000000202 R15: ff1100010234eb00 FS: 00007fb15f3f6740(0000) GS:ff110008dcc19000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007fb15f32d3a0 CR3: 0000000116f59001 CR4: 0000000000373eb0 Call Trace: <TASK> debug_dma_map_sg+0x1b4/0x390 __dma_map_sg_attrs+0x6d/0x1a0 dma_map_sgtable+0x19/0x30 ib_umem_get+0x284/0x3b0 [ib_uverbs] mlx5_ib_reg_user_mr+0x68/0x2a0 [mlx5_ib] ib_uverbs_reg_mr+0x17f/0x2a0 [ib_uverbs] ib_uverbs_handler_UVERBS_METHOD_INVOKE_WRITE+0xc2/0x130 [ib_uverbs] ib_uverbs_cmd_verbs+0xa0b/0xae0 [ib_uverbs] ? ib_uverbs_handler_UVERBS_METHOD_QUERY_PORT_SPEED+0xe0/0xe0 [ib_uverbs] ? mmap_region+0x7a/0xb0 ? do_mmap+0x3b8/0x5c0 ib_uverbs_ioctl+0xa7/0x110 [ib_uverbs] __x64_sys_ioctl+0x14f/0x8b0 ? ksys_mmap_pgoff+0xc5/0x190 do_syscall_64+0x8c/0xbf0 entry_SYSCALL_64_after_hwframe+0x4b/0x53 RIP: 0033:0x7fb15f5e4eed Code: 04 25 28 00 00 00 48 89 45 c8 31 c0 48 8d 45 10 c7 45 b0 10 00 00 00 48 89 45 b8 48 8d 45 d0 48 89 45 c0 b8 10 00 00 00 0f 05 <89> c2 3d 00 f0 ff ff 77 1a 48 8b 45 c8 64 48 2b 04 25 28 00 00 00 RSP: 002b:00007ffe09a5c540 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007ffe09a5c5d0 RCX: 00007fb15f5e4eed RDX: 00007ffe09a5c5f0 RSI: 00000000c0181b01 RDI: 0000000000000003 RBP: 00007ffe09a5c590 R08: 0000000000000028 R09: 00007ffe09a5c794 R10: 0000000000000001 R11: 0000000000000246 R12: 00007ffe09a5c794 R13: 000000000000000c R14: 0000000025a49170 R15: 000000000000000c </TASK> ---[ end trace 0000000000000000 ]---
--- kernel/dma/debug.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/dma/debug.c +3 -3
@@ -453,7 +453,7 @@ static int active_cacheline_set_overlap(phys_addr_t cln, int overlap)return overlap; } -static void active_cacheline_inc_overlap (phys_addr_t cln) +static void active_cacheline_inc_overlap (phys_addr_t cln,bool is_cache_clean) {int overlap =active_cacheline_read_overlap (cln);
@@ -462,7 +462,7 @@ static void active_cacheline_inc_overlap(phys_addr_t cln)/* If we overflowed the overlap counter then we're potentially * leaking dma-mappings. */ -WARN_ONCE (overlap >ACTIVE_CACHELINE_MAX_OVERLAP , +WARN_ONCE (!is_cache_clean && overlap >ACTIVE_CACHELINE_MAX_OVERLAP ,pr_fmt ("exceeded %d overlapping mappings of cacheline %pa\n" ),ACTIVE_CACHELINE_MAX_OVERLAP , &cln); }
@@ -495,7 +495,7 @@ static int active_cacheline_insert(struct dma_debug_entry *entry,if (rc == -EEXIST ) {struct dma_debug_entry *existing; -active_cacheline_inc_overlap (cln); +active_cacheline_inc_overlap (cln, entry->is_cache_clean); existing =radix_tree_lookup (&dma_active_cacheline, cln);/* A lookup failure here after we got -EEXIST is unexpected. */ WARN_ON (!existing);
Signature · 1 line
2.53.0
PATCH v3 2/8 dma-mapping: handle DMA_ATTR_CPU_CACHE_CLEAN in trace output
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
Tracing prints decoded DMA attribute flags, but it does not yet include the recently added DMA_ATTR_CPU_CACHE_CLEAN. Add support for decoding and displaying this attribute in the trace output.
--- include/trace/events/dma.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
include/trace/events/dma.h +2 -1
@@ -32,7 +32,8 @@ TRACE_DEFINE_ENUM(DMA_NONE); { DMA_ATTR_ALLOC_SINGLE_PAGES, "ALLOC_SINGLE_PAGES" }, \ { DMA_ATTR_NO_WARN, "NO_WARN" }, \ { DMA_ATTR_PRIVILEGED, "PRIVILEGED" }, \ - { DMA_ATTR_MMIO, "MMIO" }) + { DMA_ATTR_MMIO, "MMIO" }, \ + { DMA_ATTR_CPU_CACHE_CLEAN, "CACHE_CLEAN" }) DECLARE_EVENT_CLASS(dma_map, TP_PROTO(struct device *dev, phys_addr_t phys_addr, dma_addr_t dma_addr,
Signature · 1 line
2.53.0
PATCH v3 3/8 dma-mapping: Clarify valid conditions for CPU cache line overlap
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
Rename the DMA_ATTR_CPU_CACHE_CLEAN attribute to better reflect that it is debugging aid to inform DMA core code that CPU cache line overlaps are allowed, and refine the documentation describing its use.
--- Documentation/core-api/dma-attributes.rst | 22 ++++++++++++++-------- drivers/virtio/virtio_ring.c | 10 +++++----- include/linux/dma-mapping.h | 8 ++++---- include/trace/events/dma.h | 2 +- kernel/dma/debug.c | 2 +- 5 files changed, 25 insertions(+), 19 deletions(-)
Documentation/core-api/dma-attributes.rst +14 -8
@@ -149,11 +149,17 @@ For architectures that require cache flushing for DMA coherence DMA_ATTR_MMIO will not perform any cache flushing. The address provided must never be mapped cacheable into the CPU. -DMA_ATTR_CPU_CACHE_CLEAN ------------------------- - -This attribute indicates the CPU will not dirty any cacheline overlapping this -DMA_FROM_DEVICE/DMA_BIDIRECTIONAL buffer while it is mapped. This allows -multiple small buffers to safely share a cacheline without risk of data -corruption, suppressing DMA debug warnings about overlapping mappings. -All mappings sharing a cacheline should have this attribute. +DMA_ATTR_DEBUGGING_IGNORE_CACHELINES +------------------------------------ + +This attribute indicates that CPU cache lines may overlap for buffers mapped +with DMA_FROM_DEVICE or DMA_BIDIRECTIONAL. + +Such overlap may occur when callers map multiple small buffers that reside +within the same cache line. In this case, callers must guarantee that the CPU +will not dirty these cache lines after the mappings are established. When this +condition is met, multiple buffers can safely share a cache line without risking +data corruption. + +All mappings that share a cache line must set this attribute to suppress DMA +debug warnings about overlapping mappings.
drivers/virtio/virtio_ring.c +5 -5
@@ -2912,10 +2912,10 @@ EXPORT_SYMBOL_GPL(virtqueue_add_inbuf);* @data: the token identifying the buffer. * @gfp: how to do memory allocations (if necessary). * -* Same as virtqueue_add_inbuf but passes DMA_ATTR_CPU_CACHE_CLEAN to indicate -* that the CPU will not dirty any cacheline overlapping this buffer while it -* is available, and to suppress overlapping cacheline warnings in DMA debug -* builds. +* Same as virtqueue_add_inbuf but passes DMA_ATTR_DEBUGGING_IGNORE_CACHELINES +* to indicate that the CPU will not dirty any cacheline overlapping this buffer +* while it is available, and to suppress overlapping cacheline warnings in DMA +* debug builds. * * Caller must ensure we don't call this with other virtqueue operations * at the same time (except where noted).
@@ -2928,7 +2928,7 @@ int virtqueue_add_inbuf_cache_clean(struct virtqueue *vq, gfp_t gfp) {return virtqueue_add (vq, &sg, num,0 ,1 , data,NULL , false, gfp, -DMA_ATTR_CPU_CACHE_CLEAN ); +DMA_ATTR_DEBUGGING_IGNORE_CACHELINES ); }EXPORT_SYMBOL_GPL (virtqueue_add_inbuf_cache_clean);
include/linux/dma-mapping.h +4 -4
@@ -80,11 +80,11 @@#define DMA_ATTR_MMIO (1UL << 10)/* -* DMA_ATTR_CPU_CACHE_CLEAN: Indicates the CPU will not dirty any cacheline -* overlapping this buffer while it is mapped for DMA. All mappings sharing -* a cacheline must have this attribute for this to be considered safe. +* DMA_ATTR_DEBUGGING_IGNORE_CACHELINES: Indicates the CPU cache line can be +* overlapped. All mappings sharing a cacheline must have this attribute for +* this to be considered safe. */ -#define DMA_ATTR_CPU_CACHE_CLEAN (1UL << 11) +#define DMA_ATTR_DEBUGGING_IGNORE_CACHELINES (1UL << 11)/* * A dma_addr_t can hold any valid DMA or bus address for the platform. It can
include/trace/events/dma.h +1 -1
@@ -33,7 +33,7 @@ TRACE_DEFINE_ENUM(DMA_NONE); { DMA_ATTR_NO_WARN, "NO_WARN" }, \ { DMA_ATTR_PRIVILEGED, "PRIVILEGED" }, \ { DMA_ATTR_MMIO, "MMIO" }, \ - { DMA_ATTR_CPU_CACHE_CLEAN, "CACHE_CLEAN" }) + { DMA_ATTR_DEBUGGING_IGNORE_CACHELINES, "CACHELINES_OVERLAP" }) DECLARE_EVENT_CLASS(dma_map, TP_PROTO(struct device *dev, phys_addr_t phys_addr, dma_addr_t dma_addr,
kernel/dma/debug.c +1 -1
@@ -601,7 +601,7 @@ static void add_dma_entry(struct dma_debug_entry *entry, unsigned long attrs)unsigned long flags;int rc; - entry->is_cache_clean = !!(attrs &DMA_ATTR_CPU_CACHE_CLEAN ); + entry->is_cache_clean = attrs &DMA_ATTR_DEBUGGING_IGNORE_CACHELINES ; bucket =get_hash_bucket (entry, &flags);hash_bucket_add (bucket, entry);
Signature · 1 line
2.53.0
PATCH v3 4/8 dma-mapping: Introduce DMA require coherency attribute
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
The mapping buffers which carry this attribute require DMA coherent system. This means that they can't take SWIOTLB path, can perform CPU cache overlap and doesn't perform cache flushing.
--- Documentation/core-api/dma-attributes.rst | 16 ++++++++++++++++ include/linux/dma-mapping.h | 7 +++++++ include/trace/events/dma.h | 3 ++- kernel/dma/debug.c | 3 ++- kernel/dma/mapping.c | 6 ++++++ 5 files changed, 33 insertions(+), 2 deletions(-)
Documentation/core-api/dma-attributes.rst +16 -0
@@ -163,3 +163,19 @@ data corruption. All mappings that share a cache line must set this attribute to suppress DMA debug warnings about overlapping mappings. + +DMA_ATTR_REQUIRE_COHERENT +------------------------- + +DMA mapping requests with the DMA_ATTR_REQUIRE_COHERENT fail on any +system where SWIOTLB or cache management is required. This should only +be used to support uAPI designs that require continuous HW DMA +coherence with userspace processes, for example RDMA and DRM. At a +minimum the memory being mapped must be userspace memory from +pin_user_pages() or similar. + +Drivers should consider using dma_mmap_pages() instead of this +interface when building their uAPIs, when possible. + +It must never be used in an in-kernel driver that only works with +kernal memory.
include/linux/dma-mapping.h +7 -0
@@ -86,6 +86,13 @@*/ #define DMA_ATTR_DEBUGGING_IGNORE_CACHELINES (1UL << 11) +/* +* DMA_ATTR_REQUIRE_COHERENT: Indicates that DMA coherency is required. +* All mappings that carry this attribute can't work with SWIOTLB and cache +* flushing. +*/ +#define DMA_ATTR_REQUIRE_COHERENT (1UL << 12) +/* * A dma_addr_t can hold any valid DMA or bus address for the platform. It can * be given to a device to use as a DMA source or target. It is specific to a
include/trace/events/dma.h +2 -1
@@ -33,7 +33,8 @@ TRACE_DEFINE_ENUM(DMA_NONE); { DMA_ATTR_NO_WARN, "NO_WARN" }, \ { DMA_ATTR_PRIVILEGED, "PRIVILEGED" }, \ { DMA_ATTR_MMIO, "MMIO" }, \ - { DMA_ATTR_DEBUGGING_IGNORE_CACHELINES, "CACHELINES_OVERLAP" }) + { DMA_ATTR_DEBUGGING_IGNORE_CACHELINES, "CACHELINES_OVERLAP" }, \ + { DMA_ATTR_REQUIRE_COHERENT, "REQUIRE_COHERENT" }) DECLARE_EVENT_CLASS(dma_map, TP_PROTO(struct device *dev, phys_addr_t phys_addr, dma_addr_t dma_addr,
kernel/dma/debug.c +2 -1
@@ -601,7 +601,8 @@ static void add_dma_entry(struct dma_debug_entry *entry, unsigned long attrs)unsigned long flags;int rc; - entry->is_cache_clean = attrs &DMA_ATTR_DEBUGGING_IGNORE_CACHELINES ; + entry->is_cache_clean = attrs & (DMA_ATTR_DEBUGGING_IGNORE_CACHELINES | +DMA_ATTR_REQUIRE_COHERENT ); bucket =get_hash_bucket (entry, &flags);hash_bucket_add (bucket, entry);
kernel/dma/mapping.c +6 -0
@@ -164,6 +164,9 @@ dma_addr_t dma_map_phys(struct device *dev, phys_addr_t phys, size_t size,if (WARN_ON_ONCE (!dev->dma_mask))return DMA_MAPPING_ERROR ; +if (!dev_is_dma_coherent (dev) && (attrs &DMA_ATTR_REQUIRE_COHERENT )) +return DMA_MAPPING_ERROR ; +if (dma_map_direct (dev, ops) || (!is_mmio &&arch_dma_map_phys_direct (dev, phys + size))) addr =dma_direct_map_phys (dev, phys, size, dir, attrs);
@@ -235,6 +238,9 @@ static int __dma_map_sg_attrs(struct device *dev, struct scatterlist *sg,BUG_ON (!valid_dma_direction (dir)); +if (!dev_is_dma_coherent (dev) && (attrs &DMA_ATTR_REQUIRE_COHERENT )) +return -EOPNOTSUPP ; +if (WARN_ON_ONCE (!dev->dma_mask))return 0 ;
Signature · 1 line
2.53.0
Randy Dunlap
reviewerRe: [PATCH v3 4/8] dma-mapping: Introduce DMA require coherency attribute
Quoted 14 lines · Leon Romanovsky
Documentation/core-api/dma-attributes.rst +6
-0@@ -163,3 +163,19 @@ data corruption. All mappings that share a cache line must set this attribute to suppress DMA debug warnings about overlapping mappings. + +DMA_ATTR_REQUIRE_COHERENT +------------------------- + +DMA mapping requests with the DMA_ATTR_REQUIRE_COHERENT fail on any +system where SWIOTLB or cache management is required. This should only
Documentation/core-api/dma-attributes.rst data corruption. · line 181
Quoted 10 lines
Documentation/core-api/dma-attributes.rst +10
-0+be used to support uAPI designs that require continuous HW DMA +coherence with userspace processes, for example RDMA and DRM. At a +minimum the memory being mapped must be userspace memory from +pin_user_pages() or similar. + +Drivers should consider using dma_mmap_pages() instead of this +interface when building their uAPIs, when possible. + +It must never be used in an in-kernel driver that only works with +kernal memory.
kernel
Signature · 1 line
~Randy
Re: [PATCH v3 4/8] dma-mapping: Introduce DMA require coherency attribute
Quoted 21 lines · Randy Dunlap
Quoted 18 lines · Leon Romanovsky
Documentation/core-api/dma-attributes.rst +10
-0@@ -163,3 +163,19 @@ data corruption. All mappings that share a cache line must set this attribute to suppress DMA debug warnings about overlapping mappings. + +DMA_ATTR_REQUIRE_COHERENT +------------------------- + +DMA mapping requests with the DMA_ATTR_REQUIRE_COHERENT fail on any +system where SWIOTLB or cache management is required. This should only +be used to support uAPI designs that require continuous HW DMA +coherence with userspace processes, for example RDMA and DRM. At a +minimum the memory being mapped must be userspace memory from +pin_user_pages() or similar.
Quoted 8 lines
Documentation/core-api/dma-attributes.rst data corruption. · line 181
Quoted 6 lines
Documentation/core-api/dma-attributes.rst +6
-0+ +Drivers should consider using dma_mmap_pages() instead of this +interface when building their uAPIs, when possible. + +It must never be used in an in-kernel driver that only works with +kernal memory.kernel
Thanks, let's hope that it is the only one comment :).
Quoted 4 lines
Signature · 2 lines
-- ~Randy
PATCH v3 5/8 dma-direct: prevent SWIOTLB path when DMA_ATTR_REQUIRE_COHERENT is set
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
DMA_ATTR_REQUIRE_COHERENT indicates that SWIOTLB must not be used. Ensure the SWIOTLB path is declined whenever the DMA direct path is selected.
--- kernel/dma/direct.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
kernel/dma/direct.h +4 -3
@@ -84,7 +84,7 @@ static inline dma_addr_t dma_direct_map_phys(struct device *dev,dma_addr_t dma_addr;if (is_swiotlb_force_bounce (dev)) { -if (attrs &DMA_ATTR_MMIO ) +if (attrs & (DMA_ATTR_MMIO |DMA_ATTR_REQUIRE_COHERENT ))return DMA_MAPPING_ERROR ;return swiotlb_map (dev, phys, size, dir, attrs);
@@ -98,7 +98,8 @@ static inline dma_addr_t dma_direct_map_phys(struct device *dev, dma_addr =phys_to_dma (dev, phys);if (unlikely (!dma_capable (dev, dma_addr, size, true)) ||dma_kmalloc_needs_bounce (dev, size, dir)) { -if (is_swiotlb_active (dev)) +if (is_swiotlb_active (dev) && + !(attrs &DMA_ATTR_REQUIRE_COHERENT ))return swiotlb_map (dev, phys, size, dir, attrs); goto err_overflow;
@@ -123,7 +124,7 @@ static inline void dma_direct_unmap_phys(struct device *dev, dma_addr_t addr, {phys_addr_t phys; -if (attrs &DMA_ATTR_MMIO ) +if (attrs & (DMA_ATTR_MMIO |DMA_ATTR_REQUIRE_COHERENT ))/* nothing to do: uncached and no swiotlb */ return ;
Signature · 1 line
2.53.0
PATCH v3 6/8 iommu/dma: add support for DMA_ATTR_REQUIRE_COHERENT attribute
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
Add support for the DMA_ATTR_REQUIRE_COHERENT attribute to the exported functions. This attribute indicates that the SWIOTLB path must not be used and that no sync operations should be performed.
--- drivers/iommu/dma-iommu.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-)
drivers/iommu/dma-iommu.c +17 -4
@@ -1211,7 +1211,7 @@ dma_addr_t iommu_dma_map_phys(struct device *dev, phys_addr_t phys, size_t size,*/ if (dev_use_swiotlb (dev, size, dir) &&iova_unaligned (iovad, phys, size)) { -if (attrs &DMA_ATTR_MMIO ) +if (attrs & (DMA_ATTR_MMIO |DMA_ATTR_REQUIRE_COHERENT ))return DMA_MAPPING_ERROR ; phys =iommu_dma_map_swiotlb (dev, phys, size, dir, attrs);
@@ -1223,7 +1223,8 @@ dma_addr_t iommu_dma_map_phys(struct device *dev, phys_addr_t phys, size_t size,arch_sync_dma_for_device (phys, size, dir); iova =__iommu_dma_map (dev, phys, size, prot, dma_mask); -if (iova ==DMA_MAPPING_ERROR && !(attrs &DMA_ATTR_MMIO )) +if (iova ==DMA_MAPPING_ERROR && + !(attrs & (DMA_ATTR_MMIO |DMA_ATTR_REQUIRE_COHERENT )))swiotlb_tbl_unmap_single (dev, phys, size, dir, attrs);return iova; }
@@ -1233,7 +1234,7 @@ void iommu_dma_unmap_phys(struct device *dev, dma_addr_t dma_handle, {phys_addr_t phys; -if (attrs &DMA_ATTR_MMIO ) { +if (attrs & (DMA_ATTR_MMIO |DMA_ATTR_REQUIRE_COHERENT )) {__iommu_dma_unmap (dev, dma_handle, size);return ; }
@@ -1945,9 +1946,21 @@ int dma_iova_link(struct device *dev, struct dma_iova_state *state,if (WARN_ON_ONCE (iova_start_pad && offset >0 ))return -EIO ; +/* +* DMA_IOVA_USE_SWIOTLB is set on state after some entry +* took SWIOTLB path, which we were supposed to prevent +* for DMA_ATTR_REQUIRE_COHERENT attribute. +*/ +if (WARN_ON_ONCE ((state->__size &DMA_IOVA_USE_SWIOTLB ) && + (attrs &DMA_ATTR_REQUIRE_COHERENT ))) +return -EOPNOTSUPP ; + +if (!dev_is_dma_coherent (dev) && (attrs &DMA_ATTR_REQUIRE_COHERENT )) +return -EOPNOTSUPP ; +if (dev_use_swiotlb (dev, size, dir) &&iova_unaligned (iovad, phys, size)) { -if (attrs &DMA_ATTR_MMIO ) +if (attrs & (DMA_ATTR_MMIO |DMA_ATTR_REQUIRE_COHERENT ))return -EPERM ; return iommu_dma_iova_link_swiotlb(dev, state, phys, offset,
Signature · 1 line
2.53.0
PATCH v3 7/8 RDMA/umem: Tell DMA mapping that UMEM requires coherency
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
The RDMA subsystem exposes DMA regions through the verbs interface, which assumes a coherent system. Use the DMA_ATTR_REQUIRE_COHERENCE attribute to ensure coherency and avoid taking the SWIOTLB path.
The RDMA verbs programming model resembles HMM and assumes concurrent DMA and CPU access to userspace memory. The hardware and programming model support "one-sided" operations initiated remotely without any local CPU involvement or notification. These include ATOMIC compare/swap, READ, and WRITE. A remote CPU can use these operations to traverse data structures, manipulate locks, and perform similar tasks without the host CPU’s awareness. If SWIOTLB substitutes memory or DMA is not cache coherent, these use cases break entirely.
In-kernel RDMA is fine with incoherent mappings because kernel users do not rely on one-sided operations in ways that would expose these issues.
A given region may also be exported multiple times, which can trigger warnings about cacheline overlaps. These warnings are suppressed when the new attribute is used.
infiniband rocep8s0f0: mlx5_ib_reg_user_mr:1592:(pid 5812): start 0x2b28c000, iova 0x2b28c000, length 0x1000, access_flags 0x1 infiniband rocep8s0f0: mlx5_ib_reg_user_mr:1592:(pid 5812): start 0x2b28c001, iova 0x2b28c001, length 0xfff, access_flags 0x1
------------[ cut here ]------------ DMA-API: mlx5_core 0000:08:00.0: cacheline tracking EEXIST, overlapping mappings aren't supported WARNING: kernel/dma/debug.c:620 at add_dma_entry+0x1bb/0x280, CPU#6: ibv_rc_pingpong/5812 Modules linked in: veth xt_conntrack xt_MASQUERADE nf_conntrack_netlink nfnetlink iptable_nat nf_nat xt_addrtype br_netfilter rpcsec_gss_krb5 auth_rpcgss oid_registry overlay mlx5_fwctl zram zsmalloc mlx5_ib fuse rpcrdma rdma_ucm ib_uverbs ib_iser libiscsi scsi_transport_iscsi ib_umad rdma_cm ib_ipoib iw_cm ib_cm mlx5_core ib_core CPU: 6 UID: 2733 PID: 5812 Comm: ibv_rc_pingpong Tainted: G W 6.19.0+ #129 PREEMPT Tainted: [W]=WARN Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014 RIP: 0010:add_dma_entry+0x1be/0x280 Code: 8b 7b 10 48 85 ff 0f 84 c3 00 00 00 48 8b 6f 50 48 85 ed 75 03 48 8b 2f e8 ff 8e 6a 00 48 89 c6 48 8d 3d 55 ef 2d 01 48 89 ea <67> 48 0f b9 3a 48 85 db 74 1a 48 c7 c7 b0 00 2b 82 e8 9c 25 fd ff RSP: 0018:ff11000138717978 EFLAGS: 00010286 RAX: ffffffffa02d7831 RBX: ff1100010246de00 RCX: 0000000000000000 RDX: ff110001036fac30 RSI: ffffffffa02d7831 RDI: ffffffff82678650 RBP: ff110001036fac30 R08: ff11000110dcb4a0 R09: ff11000110dcb478 R10: 0000000000000000 R11: ffffffff824b30a8 R12: 0000000000000000 R13: 00000000ffffffef R14: 0000000000000202 R15: ff1100010246de00 FS: 00007f59b411c740(0000) GS:ff110008dcc99000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007ffe538f7000 CR3: 000000010e066005 CR4: 0000000000373eb0 Call Trace: <TASK> debug_dma_map_sg+0x1b4/0x390 __dma_map_sg_attrs+0x6d/0x1a0 dma_map_sgtable+0x19/0x30 ib_umem_get+0x254/0x380 [ib_uverbs] mlx5_ib_reg_user_mr+0x68/0x2a0 [mlx5_ib] ib_uverbs_reg_mr+0x17f/0x2a0 [ib_uverbs] ib_uverbs_handler_UVERBS_METHOD_INVOKE_WRITE+0xc2/0x130 [ib_uverbs] ib_uverbs_cmd_verbs+0xa0b/0xae0 [ib_uverbs] ? ib_uverbs_handler_UVERBS_METHOD_QUERY_PORT_SPEED+0xe0/0xe0 [ib_uverbs] ? mmap_region+0x7a/0xb0 ? do_mmap+0x3b8/0x5c0 ib_uverbs_ioctl+0xa7/0x110 [ib_uverbs] __x64_sys_ioctl+0x14f/0x8b0 ? ksys_mmap_pgoff+0xc5/0x190 do_syscall_64+0x8c/0xbf0 entry_SYSCALL_64_after_hwframe+0x4b/0x53 RIP: 0033:0x7f59b430aeed Code: 04 25 28 00 00 00 48 89 45 c8 31 c0 48 8d 45 10 c7 45 b0 10 00 00 00 48 89 45 b8 48 8d 45 d0 48 89 45 c0 b8 10 00 00 00 0f 05 <89> c2 3d 00 f0 ff ff 77 1a 48 8b 45 c8 64 48 2b 04 25 28 00 00 00 RSP: 002b:00007ffe538f9430 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007ffe538f94c0 RCX: 00007f59b430aeed RDX: 00007ffe538f94e0 RSI: 00000000c0181b01 RDI: 0000000000000003 RBP: 00007ffe538f9480 R08: 0000000000000028 R09: 00007ffe538f9684 R10: 0000000000000001 R11: 0000000000000246 R12: 00007ffe538f9684 R13: 000000000000000c R14: 000000002b28d170 R15: 000000000000000c </TASK> ---[ end trace 0000000000000000 ]---
--- drivers/infiniband/core/umem.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/infiniband/core/umem.c +3 -2
@@ -55,7 +55,8 @@ static void __ib_umem_release(struct ib_device *dev, struct ib_umem *umem, int dif (dirty)ib_dma_unmap_sgtable_attrs (dev, &umem->sgt_append.sgt, -DMA_BIDIRECTIONAL ,0 ); +DMA_BIDIRECTIONAL , +DMA_ATTR_REQUIRE_COHERENT );for_each_sgtable_sg (&umem->sgt_append.sgt, sg, i) { unpin_user_page_range_dirty_lock(sg_page(sg),
@@ -169,7 +170,7 @@ struct ib_umem *ib_umem_get(struct ib_device *device, unsigned long addr,unsigned long lock_limit;unsigned long new_pinned;unsigned long cur_base; -unsigned long dma_attr =0 ; +unsigned long dma_attr =DMA_ATTR_REQUIRE_COHERENT ;struct mm_struct *mm;unsigned long npages;int pinned, ret;
Signature · 1 line
2.53.0
PATCH v3 8/8 mm/hmm: Indicate that HMM requires DMA coherency
In reply to Leon RomanovskyFrom: Leon Romanovsky <[email protected]>
HMM is fundamentally about allowing a sophisticated device to perform DMA directly to a process’s memory while the CPU accesses that same memory at the same time. It is similar to SVA but does not rely on IOMMU support. Because the entire model depends on concurrent access to shared memory, it fails as a uAPI if SWIOTLB substitutes the memory or if the CPU caches are not coherent with DMA.
Until now, there has been no reliable way to report this, and various approximations have been used:
int hmm_dma_map_alloc(struct device *dev, struct hmm_dma_map *map,
size_t nr_entries, size_t dma_entry_size)
{
<...>
/*
* The HMM API violates our normal DMA buffer ownership rules and can't
* transfer buffer ownership. The dma_addressing_limited() check is a
* best approximation to ensure no swiotlb buffering happens.
*/
dma_need_sync = !dev->dma_skip_sync;
if (dma_need_sync || dma_addressing_limited(dev))
return -EOPNOTSUPP;So let's mark mapped buffers with DMA_ATTR_REQUIRE_COHERENT attribute to prevent silent data corruption if someone tries to use hmm in a system with swiotlb or incoherent DMA
--- mm/hmm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
mm/hmm.c +2 -2
@@ -778,7 +778,7 @@ dma_addr_t hmm_dma_map_pfn(struct device *dev, struct hmm_dma_map *map,struct page *page =hmm_pfn_to_page (pfns[idx]);phys_addr_t paddr =hmm_pfn_to_phys (pfns[idx]);size_t offset = idx * map->dma_entry_size; -unsigned long attrs =0 ; +unsigned long attrs =DMA_ATTR_REQUIRE_COHERENT ;dma_addr_t dma_addr;int ret;
@@ -871,7 +871,7 @@ bool hmm_dma_unmap_pfn(struct device *dev, struct hmm_dma_map *map, size_t idx)struct dma_iova_state *state = &map->state;dma_addr_t *dma_addrs = map->dma_list;unsigned long *pfns = map->pfn_list; -unsigned long attrs =0 ; +unsigned long attrs =DMA_ATTR_REQUIRE_COHERENT ;if ((pfns[idx] & valid_dma) != valid_dma)return false;
Signature · 1 line
2.53.0
Quoted 10 lines · Leon Romanovsky
Add a new
DMA_ATTR_REQUIRE_COHERENTattribute to the DMA API to mark mappings that must run on a DMA‑coherent system. Such buffers cannot use the SWIOTLB path, may overlap with CPU caches, and do not depend on explicit cache flushing.Mappings using this attribute are rejected on systems where cache side‑effects could lead to data corruption, and therefore do not need the cache‑overlap debugging logic. This series also includes fixes for
DMA_ATTR_CPU_CACHE_CLEANhandling.
Thanks.
<...>
Quoted 11 lines
---
Leon Romanovsky (8):
dma-debug: Allow multiple invocations of overlapping entries
dma-mapping: handleDMA_ATTR_CPU_CACHE_CLEANin trace output
dma-mapping: Clarify valid conditions for CPU cache line overlap
dma-mapping: Introduce DMA require coherency attribute
dma-direct: prevent SWIOTLB path whenDMA_ATTR_REQUIRE_COHERENTis set iommu/dma: add support forDMA_ATTR_REQUIRE_COHERENTattribute RDMA/umem: Tell DMA mapping that UMEM requires coherency mm/hmm: Indicate that HMM requires DMA coherency
Quoted 11 lines
Documentation/core-api/dma-attributes.rst | 38 ++++++++++++++++++++++++------- drivers/infiniband/core/umem.c | 5 ++-- drivers/iommu/dma-iommu.c | 21 +++++++++++++---- drivers/virtio/virtio_ring.c | 10 ++++---- include/linux/dma-mapping.h | 15 ++++++++---- include/trace/events/dma.h | 4 +++- kernel/dma/debug.c | 9 ++++---- kernel/dma/direct.h | 7 +++--- kernel/dma/mapping.c | 6 +++++ mm/hmm.c | 4 ++-- 10 files changed, 86 insertions(+), 33 deletions(-)
Marek,
Despite the "RDMA ..." tag in the subject, the diffstat clearly shows that you are the appropriate person to take this patch.
Thanks.
Quoted 8 lines
---
base-commit:11439c4635edd669ae435eec308f4ab8a0804808
change-id: 20260305-dma-debug-overlap-21487c3fa02cBest regards,
Signature · 1 line
Leon Romanovsky <[email protected]>
Marek Szyprowski
maintainerHi Leon,
Quoted 35 lines · Leon Romanovsky
Quoted 10 lines · Leon Romanovsky
Add a new
DMA_ATTR_REQUIRE_COHERENTattribute to the DMA API to mark mappings that must run on a DMA‑coherent system. Such buffers cannot use the SWIOTLB path, may overlap with CPU caches, and do not depend on explicit cache flushing.Mappings using this attribute are rejected on systems where cache side‑effects could lead to data corruption, and therefore do not need the cache‑overlap debugging logic. This series also includes fixes for
DMA_ATTR_CPU_CACHE_CLEANhandling.
Thanks.<...>
Quoted 11 lines
---
Leon Romanovsky (8):
dma-debug: Allow multiple invocations of overlapping entries
dma-mapping: handleDMA_ATTR_CPU_CACHE_CLEANin trace output
dma-mapping: Clarify valid conditions for CPU cache line overlap
dma-mapping: Introduce DMA require coherency attribute
dma-direct: prevent SWIOTLB path whenDMA_ATTR_REQUIRE_COHERENTis set iommu/dma: add support forDMA_ATTR_REQUIRE_COHERENTattribute RDMA/umem: Tell DMA mapping that UMEM requires coherency mm/hmm: Indicate that HMM requires DMA coherencyQuoted 11 lines
Documentation/core-api/dma-attributes.rst | 38 ++++++++++++++++++++++++------- drivers/infiniband/core/umem.c | 5 ++-- drivers/iommu/dma-iommu.c | 21 +++++++++++++---- drivers/virtio/virtio_ring.c | 10 ++++---- include/linux/dma-mapping.h | 15 ++++++++---- include/trace/events/dma.h | 4 +++- kernel/dma/debug.c | 9 ++++---- kernel/dma/direct.h | 7 +++--- kernel/dma/mapping.c | 6 +++++ mm/hmm.c | 4 ++-- 10 files changed, 86 insertions(+), 33 deletions(-)
Quoted 4 lines
Marek,
Despite the "RDMA ..." tag in the subject, the diffstat clearly shows that you are the appropriate person to take this patch.
I plan to take the first 2 patches to the dma-mapping-fixes branch (v7.0-rc) and the next to dma-mapping-for-next. Should I also take the RDMA and HMM patches, or do You want a stable branch for merging them via respective subsystem trees?
Best regards
Signature · 2 lines
Marek Szyprowski, PhD Samsung R&D Institute Poland
Quoted 40 lines · Marek Szyprowski
Hi Leon,
Quoted 37 lines · Leon Romanovsky
Quoted 10 lines · Leon Romanovsky
Add a new
DMA_ATTR_REQUIRE_COHERENTattribute to the DMA API to mark mappings that must run on a DMA‑coherent system. Such buffers cannot use the SWIOTLB path, may overlap with CPU caches, and do not depend on explicit cache flushing.Mappings using this attribute are rejected on systems where cache side‑effects could lead to data corruption, and therefore do not need the cache‑overlap debugging logic. This series also includes fixes for
DMA_ATTR_CPU_CACHE_CLEANhandling.
Thanks.<...>
Quoted 11 lines
---
Leon Romanovsky (8):
dma-debug: Allow multiple invocations of overlapping entries
dma-mapping: handleDMA_ATTR_CPU_CACHE_CLEANin trace output
dma-mapping: Clarify valid conditions for CPU cache line overlap
dma-mapping: Introduce DMA require coherency attribute
dma-direct: prevent SWIOTLB path whenDMA_ATTR_REQUIRE_COHERENTis set iommu/dma: add support forDMA_ATTR_REQUIRE_COHERENTattribute RDMA/umem: Tell DMA mapping that UMEM requires coherency mm/hmm: Indicate that HMM requires DMA coherencyQuoted 11 lines
Documentation/core-api/dma-attributes.rst | 38 ++++++++++++++++++++++++------- drivers/infiniband/core/umem.c | 5 ++-- drivers/iommu/dma-iommu.c | 21 +++++++++++++---- drivers/virtio/virtio_ring.c | 10 ++++---- include/linux/dma-mapping.h | 15 ++++++++---- include/trace/events/dma.h | 4 +++- kernel/dma/debug.c | 9 ++++---- kernel/dma/direct.h | 7 +++--- kernel/dma/mapping.c | 6 +++++ mm/hmm.c | 4 ++-- 10 files changed, 86 insertions(+), 33 deletions(-)Marek,
Quoted 7 lines
Quoted 2 lines
Despite the "RDMA ..." tag in the subject, the diffstat clearly shows that you are the appropriate person to take this patch.
I plan to take the first 2 patches to the dma-mapping-fixes branch (v7.0-rc) and the next to dma-mapping-for-next. Should I also take the RDMA and HMM patches, or do You want a stable branch for merging them via respective subsystem trees?
I suggest taking all patches into the -fixes branch, as the "RDMA/..." patch also resolves the dmesg splat. With -fixes, there is no need to worry about a shared branch since we do not expect merge conflicts in that area.
If you still prefer to split the series between -fixes and -next, it would be better to use a shared branch in that case. There are patches on the RDMA list targeted for -next that touch ib_umem_get().
Thanks
Quoted 7 lines
Best regards
Signature · 2 lines
Marek Szyprowski, PhD Samsung R&D Institute Poland
Marek Szyprowski
maintainerHi Leon,
Quoted 45 lines · Leon Romanovsky
Quoted 36 lines · Marek Szyprowski
Quoted 35 lines · Leon Romanovsky
Quoted 10 lines · Leon Romanovsky
Add a new
DMA_ATTR_REQUIRE_COHERENTattribute to the DMA API to mark mappings that must run on a DMA‑coherent system. Such buffers cannot use the SWIOTLB path, may overlap with CPU caches, and do not depend on explicit cache flushing.Mappings using this attribute are rejected on systems where cache side‑effects could lead to data corruption, and therefore do not need the cache‑overlap debugging logic. This series also includes fixes for
DMA_ATTR_CPU_CACHE_CLEANhandling.
Thanks.<...>
Quoted 22 lines
---
Leon Romanovsky (8):
dma-debug: Allow multiple invocations of overlapping entries
dma-mapping: handleDMA_ATTR_CPU_CACHE_CLEANin trace output
dma-mapping: Clarify valid conditions for CPU cache line overlap
dma-mapping: Introduce DMA require coherency attribute
dma-direct: prevent SWIOTLB path whenDMA_ATTR_REQUIRE_COHERENTis set iommu/dma: add support forDMA_ATTR_REQUIRE_COHERENTattribute RDMA/umem: Tell DMA mapping that UMEM requires coherency mm/hmm: Indicate that HMM requires DMA coherencyDocumentation/core-api/dma-attributes.rst | 38 ++++++++++++++++++++++++------- drivers/infiniband/core/umem.c | 5 ++-- drivers/iommu/dma-iommu.c | 21 +++++++++++++---- drivers/virtio/virtio_ring.c | 10 ++++---- include/linux/dma-mapping.h | 15 ++++++++---- include/trace/events/dma.h | 4 +++- kernel/dma/debug.c | 9 ++++---- kernel/dma/direct.h | 7 +++--- kernel/dma/mapping.c | 6 +++++ mm/hmm.c | 4 ++-- 10 files changed, 86 insertions(+), 33 deletions(-)Quoted 8 lines
Quoted 4 lines
Marek,
Despite the "RDMA ..." tag in the subject, the diffstat clearly shows that you are the appropriate person to take this patch.
I plan to take the first 2 patches to the dma-mapping-fixes branch (v7.0-rc) and the next to dma-mapping-for-next. Should I also take the RDMA and HMM patches, or do You want a stable branch for merging them via respective subsystem trees?
Quoted 7 lines
I suggest taking all patches into the -fixes branch, as the "RDMA/..." patch also resolves the dmesg splat. With -fixes, there is no need to worry about a shared branch since we do not expect merge conflicts in that area.
If you still prefer to split the series between -fixes and -next, it would be better to use a shared branch in that case. There are patches on the RDMA list targeted for -next that touch
ib_umem_get().
Okay, I will merge all patches to the -fixes branch then.
Best regards
Signature · 2 lines
Marek Szyprowski, PhD Samsung R&D Institute Poland
Quoted 5 lines · Leon Romanovsky
Add a new
DMA_ATTR_REQUIRE_COHERENTattribute to the DMA API to mark mappings that must run on a DMA‑coherent system. Such buffers cannot use the SWIOTLB path, may overlap with CPU caches, and do not depend on explicit cache flushing.
Quoted 7 lines
Mappings using this attribute are rejected on systems where cache side‑effects could lead to data corruption, and therefore do not need the cache‑overlap debugging logic. This series also includes fixes for
DMA_ATTR_CPU_CACHE_CLEANhandling.
Thanks.Signed-off-by Leon Romanovsky <[email protected]>
Applied to dma-mapping-fixes. Thanks!
Quoted 34 lines
---
Changes in v3:
- Enriched commit messages and documentation
- Added ROB tags
- Link to v2: https://protect2.fireeye.com/v1/url?k=9c1ba148-fd90b40f-9c1a2a07-000babff99aa-86ebd022a97425b3&q=1&e=3c8e10cc-4c34-4bf6-aa9d-c339877d6a27&u=https%3A%2F%2Fpatch.msgid.link%2F20260311-dma-debug-overlap-v2-0-e00bc2ca346d%40nvidia.comChanges in v2:
- AddedDMA_ATTR_REQUIRE_COHERENTattribute
- Added HMM patch which needs this attribute as well
- RenamedDMA_ATTR_CPU_CACHE_CLEANto beDMA_ATTR_DEBUGGING_IGNORE_CACHELINES
- Link to v1: https://protect2.fireeye.com/v1/url?k=cc0590de-ad8e8599-cc041b91-000babff99aa-07e4da206b7e0d97&q=1&e=3c8e10cc-4c34-4bf6-aa9d-c339877d6a27&u=https%3A%2F%2Fpatch.msgid.link%2F20260307-dma-debug-overlap-v1-0-c034c38872af%40nvidia.com---
Leon Romanovsky (8):
dma-debug: Allow multiple invocations of overlapping entries
dma-mapping: handleDMA_ATTR_CPU_CACHE_CLEANin trace output
dma-mapping: Clarify valid conditions for CPU cache line overlap
dma-mapping: Introduce DMA require coherency attribute
dma-direct: prevent SWIOTLB path whenDMA_ATTR_REQUIRE_COHERENTis set iommu/dma: add support forDMA_ATTR_REQUIRE_COHERENTattribute RDMA/umem: Tell DMA mapping that UMEM requires coherency mm/hmm: Indicate that HMM requires DMA coherencyDocumentation/core-api/dma-attributes.rst | 38 ++++++++++++++++++++++++------- drivers/infiniband/core/umem.c | 5 ++-- drivers/iommu/dma-iommu.c | 21 +++++++++++++---- drivers/virtio/virtio_ring.c | 10 ++++---- include/linux/dma-mapping.h | 15 ++++++++---- include/trace/events/dma.h | 4 +++- kernel/dma/debug.c | 9 ++++---- kernel/dma/direct.h | 7 +++--- kernel/dma/mapping.c | 6 +++++ mm/hmm.c | 4 ++-- 10 files changed, 86 insertions(+), 33 deletions(-)
Quoted 9 lines
---
base-commit:11439c4635edd669ae435eec308f4ab8a0804808
change-id: 20260305-dma-debug-overlap-21487c3fa02cBest regards,
--
Leon Romanovsky <[email protected]>
Best regards
Signature · 2 lines
Marek Szyprowski, PhD Samsung R&D Institute Poland