Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: keith.busch@intel.com (Keith Busch)
Subject: [PATCH 4/4] nvme-pci: implement host memory buffer support
Date: Mon, 22 May 2017 03:22:30 -0400	[thread overview]
Message-ID: <20170522072229.GI7850@localhost.localdomain> (raw)
In-Reply-To: <20170520131357.15929-5-hch@lst.de>

On Sat, May 20, 2017@03:13:57PM +0200, Christoph Hellwig wrote:
> +	for (size = 0; size < preferred; size += chunk_size) {
> +		u32 len = min_t(u64, chunk_size, preferred - size);
> +		dma_addr_t dma_addr;
> +
> +		bufs[i] = dma_alloc_attrs(dev->dev, len, &dma_addr, GFP_KERNEL,
> +				DMA_ATTR_NO_KERNEL_MAPPING | DMA_ATTR_NO_WARN);
> +		if (!bufs[i])
> +			break;
> +
> +		descs[i].addr = cpu_to_le64(dma_addr);
> +		descs[i].size = cpu_to_le32(len / dev->ctrl.page_size);
> +		i++;
> +	}
> +
> +	if (!size || (min && size < min)) {
> +		dev_warn(dev->ctrl.device,
> +			"failed to allocate host memory buffer.\n");
> +		goto out_free_bufs;
> +	}
> +
> +	dev_info(dev->ctrl.device,
> +		"allocated %lld MiB host memory buffer.\n", size / 1024 / 1024);
> +	dev->nr_host_mem_descs = i;
> +	dev->host_mem_size = size;
> +	dev->host_mem_descs = descs;
> +	dev->host_mem_desc_bufs = bufs;
> +	return 0;
> +
> +out_free_bufs:
> +	while (--i >= 0) {
> +		struct nvme_host_mem_buf_desc *desc = &dev->host_mem_descs[i];

I think you want to use the local desc's variable since
dev->host_mem_descs isn't set if you goto this out_free_bufs label.

  reply	other threads:[~2017-05-22  7:22 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-20 13:13 host memory buffer support Christoph Hellwig
2017-05-20 13:13 ` [PATCH 1/4] nvme.h: add struct nvme_host_mem_buf_desc and HMB flags Christoph Hellwig
2017-05-30 14:31   ` Sagi Grimberg
2017-05-20 13:13 ` [PATCH 2/4] nvme.h: add dword 12 - 15 fields to struct nvme_features Christoph Hellwig
2017-05-30 14:31   ` Sagi Grimberg
2017-05-20 13:13 ` [PATCH 3/4] nvme: save hmpre and hmmin in struct nvme_ctrl Christoph Hellwig
2017-05-30 14:31   ` Sagi Grimberg
2017-05-20 13:13 ` [PATCH 4/4] nvme-pci: implement host memory buffer support Christoph Hellwig
2017-05-22  7:22   ` Keith Busch [this message]
2017-05-22 12:48     ` Christoph Hellwig
2017-05-30 14:35   ` Sagi Grimberg
2017-05-30 21:39   ` Max Gurtovoy
2017-06-01  7:18     ` Christoph Hellwig
2017-06-01  9:19       ` Max Gurtovoy
  -- strict thread matches above, loose matches on Subject: below --
2017-06-01 11:27 host memory buffer support V2 Christoph Hellwig
2017-06-01 11:27 ` [PATCH 4/4] nvme-pci: implement host memory buffer support Christoph Hellwig
2017-06-01 12:58   ` Keith Busch
2017-06-01 14:56   ` Max Gurtovoy
2017-06-02  7:52   ` Johannes Thumshirn

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=20170522072229.GI7850@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