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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <D7A9D9EC-6182-421C-9A74-C03598483F16@cnexlabs.com>
Date:   Tue, 12 Jun 2018 14:36:42 +0000
From:   Javier Gonzalez <javier@...xlabs.com>
To:     Matias Bjørling <mb@...htnvm.io>
CC:     "Konopko, Igor J" <igor.j.konopko@...el.com>,
        Marcin Dziegielewski <marcin.dziegielewski@...el.com>,
        Hans Holmberg <hans.holmberg@...xlabs.com>,
        "linux-block@...r.kernel.org" <linux-block@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] lightnvm: pblk: limit get chk meta request size

> On 12 Jun 2018, at 03.30, Matias Bjørling <mb@...htnvm.io> wrote:
> 
> For devices that does not specify a limit on its transfer size, the
> get_chk_meta command may send down a single I/O retrieving the full
> chunk metadata table. Resulting in large 2-4MB I/O requests. Instead,
> split up the I/Os to a maximum of 256KB and issue them separately to
> improve I/O latency.
> 
> Signed-off-by: Matias Bjørling <mb@...htnvm.io>
> ---
> drivers/nvme/host/lightnvm.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/nvme/host/lightnvm.c b/drivers/nvme/host/lightnvm.c
> index b9989717418d..3b644b0e9713 100644
> --- a/drivers/nvme/host/lightnvm.c
> +++ b/drivers/nvme/host/lightnvm.c
> @@ -583,7 +583,13 @@ static int nvme_nvm_get_chk_meta(struct nvm_dev *ndev,
> 	struct ppa_addr ppa;
> 	size_t left = nchks * sizeof(struct nvme_nvm_chk_meta);
> 	size_t log_pos, offset, len;
> -	int ret, i;
> +	int ret, i, max_len;
> +
> +	/*
> +	 * limit requests to maximum 256K to avoid issuing arbitrary large
> +	 * requests when the device does not specific a maximum transfer size.
> +	 */
> +	max_len = min_t(unsigned int, ctrl->max_hw_sectors << 9, 256 * 1024);
> 
> 	/* Normalize lba address space to obtain log offset */
> 	ppa.ppa = slba;
> @@ -596,7 +602,7 @@ static int nvme_nvm_get_chk_meta(struct nvm_dev *ndev,
> 	offset = log_pos * sizeof(struct nvme_nvm_chk_meta);
> 
> 	while (left) {
> -		len = min_t(unsigned int, left, ctrl->max_hw_sectors << 9);
> +		len = min_t(unsigned int, left, max_len);
> 
> 		ret = nvme_get_log_ext(ctrl, ns, NVME_NVM_LOG_REPORT_CHUNK,
> 				dev_meta, len, offset);
> --
> 2.11.0

Looks good to me.

Reviewed-by: Javier González <javier@...xlabs.com>


Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ