Patch "RDMA/efa: Use ib_umem_num_dma_pages()" has been added to the 5.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    RDMA/efa: Use ib_umem_num_dma_pages()

to the 5.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     rdma-efa-use-ib_umem_num_dma_pages.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 39a52745de943c72c9ce7488cef9e3cafe962d31
Author: Jason Gunthorpe <jgg@xxxxxxxxxx>
Date:   Fri Sep 4 19:41:48 2020 -0300

    RDMA/efa: Use ib_umem_num_dma_pages()
    
    [ Upstream commit 1f9b6827c85f9d9786f31a1434a16c917aae23b2 ]
    
    If ib_umem_find_best_pgsz() returns > PAGE_SIZE then the equation here is
    not correct. 'start' should be 'virt'. Change it to use the core code for
    page_num and the canonical calculation of page_shift.
    
    Fixes: 40ddb3f02083 ("RDMA/efa: Use API to get contiguous memory blocks aligned to device supported page size")
    Link: https://lore.kernel.org/r/7-v2-270386b7e60b+28f4-umem_1_jgg@xxxxxxxxxx
    Tested-by: Gal Pressman <galpress@xxxxxxxxxx>
    Acked-by: Gal Pressman <galpress@xxxxxxxxxx>
    Signed-off-by: Jason Gunthorpe <jgg@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/infiniband/hw/efa/efa_verbs.c b/drivers/infiniband/hw/efa/efa_verbs.c
index 4edae89e8e3ca..4a8830d3a9599 100644
--- a/drivers/infiniband/hw/efa/efa_verbs.c
+++ b/drivers/infiniband/hw/efa/efa_verbs.c
@@ -4,6 +4,7 @@
  */
 
 #include <linux/vmalloc.h>
+#include <linux/log2.h>
 
 #include <rdma/ib_addr.h>
 #include <rdma/ib_umem.h>
@@ -1446,9 +1447,8 @@ struct ib_mr *efa_reg_mr(struct ib_pd *ibpd, u64 start, u64 length,
 		goto err_unmap;
 	}
 
-	params.page_shift = __ffs(pg_sz);
-	params.page_num = DIV_ROUND_UP(length + (start & (pg_sz - 1)),
-				       pg_sz);
+	params.page_shift = order_base_2(pg_sz);
+	params.page_num = ib_umem_num_dma_blocks(mr->umem, pg_sz);
 
 	ibdev_dbg(&dev->ibdev,
 		  "start %#llx length %#llx params.page_shift %u params.page_num %u\n",



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux