lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 8 Feb 2024 18:42:51 +0000
From: Long Li <longli@...rosoft.com>
To: Konstantin Taranov <kotaranov@...ux.microsoft.com>, Konstantin Taranov
	<kotaranov@...rosoft.com>, "sharmaajay@...rosoft.com"
	<sharmaajay@...rosoft.com>, "jgg@...pe.ca" <jgg@...pe.ca>, "leon@...nel.org"
	<leon@...nel.org>
CC: "linux-rdma@...r.kernel.org" <linux-rdma@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH rdma-next v1 1/1] RDMA/mana_ib: Fix bug in creation of dma
 regions

> 
>  	/* Hardware requires dma region to align to chosen page size */
> -	page_sz = ib_umem_find_best_pgsz(umem, PAGE_SZ_BM, 0);
> +	page_sz = ib_umem_find_best_pgsz(umem, PAGE_SZ_BM, virt);
>  	if (!page_sz) {
>  		ibdev_dbg(&dev->ib_dev, "failed to find page size.\n");
>  		return -ENOMEM;
>  	}

How about doing:
page_sz = ib_umem_find_best_pgsz(umem, PAGE_SZ_BM, force_zero_offset  ? 0 : virt);

Will this work? This can get rid of the following while loop.

> +
> +	if (force_zero_offset) {
> +		while (ib_umem_dma_offset(umem, page_sz) && page_sz >
> PAGE_SIZE)
> +			page_sz /= 2;
> +		if (ib_umem_dma_offset(umem, page_sz) != 0) {
> +			ibdev_dbg(&dev->ib_dev, "failed to find page size to
> force zero offset.\n");
> +			return -ENOMEM;
> +		}
> +	}
> +

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ