Skip to contentSkip to conversation

RDMA/core: Add weak ordering dma attr to dma mapping

PATCH Applied Leon Romanovsky 2 participants 2 messages Feb 12, 2020 – Feb 13, 2020 InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 RDMA/core: Add weak ordering dma attr to dma mapping

From: Michael Guralnik <[email protected]>

For memory regions registered with IB_ACCESS_RELAXED_ORDERING will be dma mapped with the DMA_ATTR_WEAK_ORDERING.

This will allow reads and writes to the mapping to be weakly ordered, such change can enhance performance on some supporting architectures.

---
 drivers/infiniband/core/umem.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/infiniband/core/umem.c +7 -4
index 06b6125b5ae1..82455a1392f1 100644
@@ -197,6 +197,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;
 	struct mm_struct *mm;
 	unsigned long npages;
 	int ret;
@@ -278,10 +279,12 @@ struct ib_umem *ib_umem_get(struct ib_device *device, unsigned long addr,
 
 	sg_mark_end(sg);
 
-	umem->nmap = ib_dma_map_sg(device,
-				   umem->sg_head.sgl,
-				   umem->sg_nents,
-				   DMA_BIDIRECTIONAL);
+	if (access & IB_ACCESS_RELAXED_ORDERING)
+		dma_attr |= DMA_ATTR_WEAK_ORDERING;
+
+	umem->nmap =
+		ib_dma_map_sg_attrs(device, umem->sg_head.sgl, umem->sg_nents,
+				    DMA_BIDIRECTIONAL, dma_attr);
 
 	if (!umem->nmap) {
 		ret = -ENOMEM;
Signature · 1 line
2.24.1
#1 lore raw
Quoted 5 lines · Leon Romanovsky

From: Michael Guralnik <[email protected]>

For memory regions registered with IB_ACCESS_RELAXED_ORDERING will be dma mapped with the DMA_ATTR_WEAK_ORDERING.

Quoted 8 lines

This will allow reads and writes to the mapping to be weakly ordered, such change can enhance performance on some supporting architectures.

---
 drivers/infiniband/core/umem.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

Applied to for-next

Thanks,
Jason