lkml.org 
[lkml]   [2020]   [Feb]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH AUTOSEL 5.5 118/542] RDMA/umem: Fix ib_umem_find_best_pgsz()
    Date
    From: Artemy Kovalyov <artemyko@mellanox.com>

    [ Upstream commit 36798d5ae1af62e830c5e045b2e41ce038690c61 ]

    Except for the last entry, the ending iova alignment sets the maximum
    possible page size as the low bits of the iova must be zero when starting
    the next chunk.

    Fixes: 4a35339958f1 ("RDMA/umem: Add API to find best driver supported page size in an MR")
    Link: https://lore.kernel.org/r/20200128135612.174820-1-leon@kernel.org
    Signed-off-by: Artemy Kovalyov <artemyko@mellanox.com>
    Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
    Tested-by: Gal Pressman <galpress@amazon.com>
    Reviewed-by: Jason Gunthorpe <jgg@mellanox.com>
    Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    drivers/infiniband/core/umem.c | 9 ++++++---
    1 file changed, 6 insertions(+), 3 deletions(-)

    diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c
    index 7a3b99597eada..40cadb889114f 100644
    --- a/drivers/infiniband/core/umem.c
    +++ b/drivers/infiniband/core/umem.c
    @@ -166,10 +166,13 @@ unsigned long ib_umem_find_best_pgsz(struct ib_umem *umem,
    * for any address.
    */
    mask |= (sg_dma_address(sg) + pgoff) ^ va;
    - if (i && i != (umem->nmap - 1))
    - /* restrict by length as well for interior SGEs */
    - mask |= sg_dma_len(sg);
    va += sg_dma_len(sg) - pgoff;
    + /* Except for the last entry, the ending iova alignment sets
    + * the maximum possible page size as the low bits of the iova
    + * must be zero when starting the next chunk.
    + */
    + if (i != (umem->nmap - 1))
    + mask |= va;
    pgoff = 0;
    }
    best_pg_bit = rdma_find_pg_bit(mask, pgsz_bitmap);
    --
    2.20.1
    \
     
     \ /
      Last update: 2020-02-14 19:17    [W:2.358 / U:1.356 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site