Re: [PATCH v2 07/17] RDMA/efa: Use ib_umem_num_dma_pages()

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

 



On 05/09/2020 1:41, Jason Gunthorpe wrote:
> 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.

Should I submit a fix for stable changing start to virt?

> Fixes: 40ddb3f02083 ("RDMA/efa: Use API to get contiguous memory blocks aligned to device supported page size")
> Signed-off-by: Jason Gunthorpe <jgg@xxxxxxxxxx>
> ---
>  drivers/infiniband/hw/efa/efa_verbs.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/infiniband/hw/efa/efa_verbs.c b/drivers/infiniband/hw/efa/efa_verbs.c
> index d85c63a5021a70..72da0faa7ebf97 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>
> @@ -1538,9 +1539,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);

Not related to this patch, but indeed looks better :).

> +	params.page_num = ib_umem_num_dma_blocks(mr->umem, pg_sz);

Thanks,
Tested-by: Gal Pressman <galpress@xxxxxxxxxx>
Acked-by: Gal Pressman <galpress@xxxxxxxxxx>



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux