Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

IB/core: Drop WARN_ON() from ib_umem_find_best_pgsz()

The WARN_ON() issued as part of ib_umem_find_best_pgsz() blocked cases
when only page sizes larger than PAGE_SIZE were set, drop it to enable
those cases.

In addition, there is no need to have a specific check for zero
pgsz_bitmap, the function will do its job and return 0 at the end if
nothing match will be found.

Link: https://lore.kernel.org/r/20210304130501.1102577-2-leon@kernel.org
Signed-off-by: Yishai Hadas <yishaih@nvidia.com>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>

authored by

Yishai Hadas and committed by
Jason Gunthorpe
3f32dc0f 6fe6e568

-4
-4
drivers/infiniband/core/umem.c
··· 100 100 */ 101 101 pgsz_bitmap &= GENMASK(BITS_PER_LONG - 1, PAGE_SHIFT); 102 102 103 - /* At minimum, drivers must support PAGE_SIZE or smaller */ 104 - if (WARN_ON(!(pgsz_bitmap & GENMASK(PAGE_SHIFT, 0)))) 105 - return 0; 106 - 107 103 umem->iova = va = virt; 108 104 /* The best result is the smallest page size that results in the minimum 109 105 * number of required pages. Compute the largest page size that could