public inbox for linux-nvme@lists.infradead.org
 help / color / mirror / Atom feed
From: Keith Busch <kbusch@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Jens Axboe <axboe@fb.com>, Sagi Grimberg <sagi@grimberg.me>,
	Hugh Dickins <hughd@google.com>,
	linux-nvme@lists.infradead.org
Subject: Re: [PATCH 3/4] nvme: store the actual queue size in ctrl->sqsize
Date: Wed, 28 Dec 2022 10:02:37 -0700	[thread overview]
Message-ID: <Y6x2rcIhPhQtYQ4p@kbusch-mbp> (raw)
In-Reply-To: <20221225103234.226794-4-hch@lst.de>

On Sun, Dec 25, 2022 at 11:32:33AM +0100, Christoph Hellwig wrote:
> Convert from the strange on the wire 0s based value to a regular size
> when reading the filed to avoid adjustments all over.

s/filed/field

> @@ -3242,7 +3242,8 @@ int nvme_init_ctrl_finish(struct nvme_ctrl *ctrl, bool was_suspended)
>  		return ret;
>  	}
>  
> -	ctrl->sqsize = min_t(u16, NVME_CAP_MQES(ctrl->cap), ctrl->sqsize);
> +	/* CAP.MQES is 0s based */
> +	ctrl->sqsize = min_t(u16, NVME_CAP_MQES(ctrl->cap) - 1, ctrl->sqsize);

Did you mean '+ 1' instead of '- 1'? The minimum MQES value per spec is
1, giving 2 slots. Subtracting 1 from that possible value would give you
sqsize 0.

But I'm confused why this is being changed. The ctrl->sqsize isn't a 0's
based value. It's normal 1-based value that tells blk-mq how many tags
to allocate.

> +static ssize_t sqsize_show(struct device *dev,
> +		struct device_attribute *attr, char *buf)
> +{
> +        struct nvme_ctrl *ctrl = dev_get_drvdata(dev);
> +
> +	/* Report the 0s based register value for historic reasons: */
> +        return sysfs_emit(buf, "%d\n", ctrl->sqsize - 1);
> +}

Weird indentation here.


  parent reply	other threads:[~2022-12-28 17:02 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-25 10:32 fix nvme sqsize on off regression Christoph Hellwig
2022-12-25 10:32 ` [PATCH 1/4] nvme: fix setting the queue depth in nvme_alloc_io_tag_set Christoph Hellwig
2022-12-25 10:51   ` Sagi Grimberg
2022-12-25 10:53     ` Sagi Grimberg
2022-12-28 16:11       ` Christoph Hellwig
2022-12-25 21:15   ` Hugh Dickins
2022-12-25 10:32 ` [PATCH 2/4] nvme-pci: update sqsize when adjusting the queue depth Christoph Hellwig
2022-12-25 11:19   ` Sagi Grimberg
2022-12-28 16:10     ` Christoph Hellwig
2022-12-29 12:07       ` Sagi Grimberg
2022-12-29 16:34         ` Keith Busch
2023-01-02  9:39           ` Sagi Grimberg
2023-01-03 16:45             ` Keith Busch
2022-12-25 21:21   ` Hugh Dickins
2022-12-25 10:32 ` [PATCH 3/4] nvme: store the actual queue size in ctrl->sqsize Christoph Hellwig
2022-12-25 11:09   ` Sagi Grimberg
2022-12-28 17:02   ` Keith Busch [this message]
2022-12-25 10:32 ` [PATCH 4/4] nvme-pci: remove the dev->q_depth field Christoph Hellwig
2022-12-25 11:19   ` Sagi Grimberg
2022-12-26 19:11 ` (subset) fix nvme sqsize on off regression Jens Axboe

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=Y6x2rcIhPhQtYQ4p@kbusch-mbp \
    --to=kbusch@kernel.org \
    --cc=axboe@fb.com \
    --cc=hch@lst.de \
    --cc=hughd@google.com \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    --cc=torvalds@linux-foundation.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox