Patch "RDMA/umem: Prevent small pages from being returned by ib_umem_find_best_pgsz()" 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/umem: Prevent small pages from being returned by ib_umem_find_best_pgsz()

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-umem-prevent-small-pages-from-being-returned-by.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 b5dbaaadac9789c8bf9d1856400892ca0b15d90b
Author: Jason Gunthorpe <jgg@xxxxxxxxxx>
Date:   Fri Sep 4 19:41:43 2020 -0300

    RDMA/umem: Prevent small pages from being returned by ib_umem_find_best_pgsz()
    
    [ Upstream commit 10c75ccb54e4fe548cb16d7ed426d7d709e6ae76 ]
    
    rdma_for_each_block() makes assumptions about how the SGL is constructed
    that don't work if the block size is below the page size used to to build
    the SGL.
    
    The rules for umem SGL construction require that the SG's all be PAGE_SIZE
    aligned and we don't encode the actual byte offset of the VA range inside
    the SGL using offset and length. So rdma_for_each_block() has no idea
    where the actual starting/ending point is to compute the first/last block
    boundary if the starting address should be within a SGL.
    
    Fixing the SGL construction turns out to be really hard, and will be the
    subject of other patches. For now block smaller pages.
    
    Fixes: 4a35339958f1 ("RDMA/umem: Add API to find best driver supported page size in an MR")
    Link: https://lore.kernel.org/r/2-v2-270386b7e60b+28f4-umem_1_jgg@xxxxxxxxxx
    Reviewed-by: Leon Romanovsky <leonro@xxxxxxxxxx>
    Reviewed-by: Shiraz Saleem <shiraz.saleem@xxxxxxxxx>
    Signed-off-by: Jason Gunthorpe <jgg@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c
index 9be8f6c622db0..650f71dd4ab93 100644
--- a/drivers/infiniband/core/umem.c
+++ b/drivers/infiniband/core/umem.c
@@ -151,6 +151,12 @@ unsigned long ib_umem_find_best_pgsz(struct ib_umem *umem,
 	dma_addr_t mask;
 	int i;
 
+	/* rdma_for_each_block() has a bug if the page size is smaller than the
+	 * page size used to build the umem. For now prevent smaller page sizes
+	 * from being returned.
+	 */
+	pgsz_bitmap &= GENMASK(BITS_PER_LONG - 1, PAGE_SHIFT);
+
 	/* At minimum, drivers must support PAGE_SIZE or smaller */
 	if (WARN_ON(!(pgsz_bitmap & GENMASK(PAGE_SHIFT, 0))))
 		return 0;



[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