Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

RDMA/umem: Use consistent DMA attributes when unmapping entries

The DMA API expects that mapping and unmapping use the same DMA
attributes. The RDMA umem code did not meet this requirement, so fix
the mismatch.

Fixes: f03d9fadfe13 ("RDMA/core: Add weak ordering dma attr to dma mapping")
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>

authored by

Leon Romanovsky and committed by
Leon Romanovsky
179b3209 e6fd2491

+7 -7
+6 -7
drivers/infiniband/core/umem.c
··· 55 55 56 56 if (dirty) 57 57 ib_dma_unmap_sgtable_attrs(dev, &umem->sgt_append.sgt, 58 - DMA_BIDIRECTIONAL, 59 - DMA_ATTR_REQUIRE_COHERENT); 58 + DMA_BIDIRECTIONAL, umem->dma_attrs); 60 59 61 60 for_each_sgtable_sg(&umem->sgt_append.sgt, sg, i) { 62 61 unpin_user_page_range_dirty_lock(sg_page(sg), ··· 169 170 unsigned long lock_limit; 170 171 unsigned long new_pinned; 171 172 unsigned long cur_base; 172 - unsigned long dma_attr = DMA_ATTR_REQUIRE_COHERENT; 173 173 struct mm_struct *mm; 174 174 unsigned long npages; 175 175 int pinned, ret; ··· 201 203 umem->iova = addr; 202 204 umem->writable = ib_access_writable(access); 203 205 umem->owning_mm = mm = current->mm; 206 + umem->dma_attrs = DMA_ATTR_REQUIRE_COHERENT; 207 + if (access & IB_ACCESS_RELAXED_ORDERING) 208 + umem->dma_attrs |= DMA_ATTR_WEAK_ORDERING; 209 + 204 210 mmgrab(mm); 205 211 206 212 page_list = (struct page **) __get_free_page(GFP_KERNEL); ··· 257 255 } 258 256 } 259 257 260 - if (access & IB_ACCESS_RELAXED_ORDERING) 261 - dma_attr |= DMA_ATTR_WEAK_ORDERING; 262 - 263 258 ret = ib_dma_map_sgtable_attrs(device, &umem->sgt_append.sgt, 264 - DMA_BIDIRECTIONAL, dma_attr); 259 + DMA_BIDIRECTIONAL, umem->dma_attrs); 265 260 if (ret) 266 261 goto umem_release; 267 262 goto out;
+1
include/rdma/ib_umem.h
··· 18 18 u64 iova; 19 19 size_t length; 20 20 unsigned long address; 21 + unsigned long dma_attrs; 21 22 u32 writable : 1; 22 23 u32 is_odp : 1; 23 24 u32 is_dmabuf : 1;