All of lore.kernel.org
 help / color / mirror / Atom feed
From: hch@infradead.org (Christoph Hellwig)
Subject: [PATCH 4/4] nvme-pci: implement host memory buffer support
Date: Thu, 1 Jun 2017 00:18:20 -0700	[thread overview]
Message-ID: <20170601071820.GA20089@infradead.org> (raw)
In-Reply-To: <1ac2afb3-7003-037e-5a2c-3a74798c1755@mellanox.com>

> > +static void nvme_setup_host_mem(struct nvme_dev *dev)
> > +{
> > +	u64 max = (u64)max_host_mem_size_mb * 1024 * 1024;
> > +	u64 preferred = (u64)dev->ctrl.hmpre * 4096;
> > +	u64 min = (u64)dev->ctrl.hmmin * 4096;
> > +	u32 enable_bits = NVME_HOST_MEM_ENABLE;
> > +
> > +	preferred = min(preferred, max);
> > +	if (min > max) {
> 
> Should it be:
> if (min > preferred) ?

No.  max is the maxium value the kernel allows a device to take.
If the minimum required value is bigger than that we have to
fail, it has nothing to do with the preferred value.

> > +		dev_warn(dev->ctrl.device,
> > +			"min host memory (%lld MiB) above limit (%d MiB).\n",
> > +			preferred / 1024 / 1024, max_host_mem_size_mb);
> 
> here we can:
> preferred ==> min
> max_host_mem_size_mb ==> preferred / 1024 / 1024 ?
> 
> other option is change the warning print from "preferred" to "min" since
> we assume that dev->ctrl.hmpre >= dev->ctrl.hmmin.

The first one should indeed be min, but I think that's the only change
we need.

  reply	other threads:[~2017-06-01  7:18 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
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 [this message]
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=20170601071820.GA20089@infradead.org \
    --to=hch@infradead.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.