Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: keith.busch@intel.com (Keith Busch)
Subject: [PATCH] nvme/pci: Fix HMB size calculation
Date: Mon, 17 Jul 2017 19:47:53 -0400	[thread overview]
Message-ID: <20170717234753.GD1496@localhost.localdomain> (raw)
In-Reply-To: <1500335139-6338-1-git-send-email-keith.busch@intel.com>

On Mon, Jul 17, 2017@07:45:39PM -0400, Keith Busch wrote:
> It's possible the preferred HMB size may not be a multiple of the
> chunk_size. This patch will set the chunk_size to the descriptor's actual
> length so the last iteration doesn't cause the total size to exceed the
> allocated HMB size.
> 
> Signed-off-by: Keith Busch <keith.busch at intel.com>

Reported-by: Dan Carpenter <dan.carpenter at oracle.com>

> ---
>  drivers/nvme/host/pci.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
> index d321597..e22ffda 100644
> --- a/drivers/nvme/host/pci.c
> +++ b/drivers/nvme/host/pci.c
> @@ -1641,6 +1641,7 @@ static int nvme_alloc_host_mem(struct nvme_dev *dev, u64 min, u64 preferred)
>  		if (!bufs[i])
>  			break;
>  
> +		chunk_size = len;
>  		descs[i].addr = cpu_to_le64(dma_addr);
>  		descs[i].size = cpu_to_le32(len / dev->ctrl.page_size);
>  		i++;
> -- 
> 2.5.5
> 

  reply	other threads:[~2017-07-17 23:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-17 23:45 [PATCH] nvme/pci: Fix HMB size calculation Keith Busch
2017-07-17 23:47 ` Keith Busch [this message]
2017-07-18 17:39 ` Christoph Hellwig
2017-07-18 18:04   ` Keith Busch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170717234753.GD1496@localhost.localdomain \
    --to=keith.busch@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox