From: hch@infradead.org (Christoph Hellwig)
Subject: [PATCH v2 1/4] nvmet: support fabrics sq flow control
Date: Wed, 14 Nov 2018 06:19:58 -0800 [thread overview]
Message-ID: <20181114141958.GA27204@infradead.org> (raw)
In-Reply-To: <20181003081323.7504-2-sagi@grimberg.me>
On Wed, Oct 03, 2018@01:13:19AM -0700, Sagi Grimberg wrote:
> Technical proposal 8005 "fabrics SQ flow control" introduces a mode
> where a host and controller agree to omit sq_head pointer updates
> when sending nvme completions.
>
> In case the host indicated desire to operate in this mode (connect attribute)
> the controller will return back a connect completion with sq_head value
> of 0xffff as indication that it will omit sq_head pointer updates.
>
> This mode saves us an atomic update in the I/O path.
>
> Reviewed-by: Hannes Reinecke <hare at suse.com>
> Signed-off-by: Sagi Grimberg <sagi at grimberg.me>
> ---
> drivers/nvme/target/core.c | 34 ++++++++++++++++++++-----------
> drivers/nvme/target/fabrics-cmd.c | 8 +++++++-
> drivers/nvme/target/nvmet.h | 3 ++-
> include/linux/nvme.h | 4 ++++
> 4 files changed, 35 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
> index 7084704b468d..df2af5e3e4d6 100644
> --- a/drivers/nvme/target/core.c
> +++ b/drivers/nvme/target/core.c
> @@ -503,26 +503,35 @@ struct nvmet_ns *nvmet_ns_alloc(struct nvmet_subsys *subsys, u32 nsid)
> return ns;
> }
>
> -static void __nvmet_req_complete(struct nvmet_req *req, u16 status)
> +static void nvmet_update_sq_head(struct nvmet_req *req)
> {
> u32 old_sqhd, new_sqhd;
> u16 sqhd;
>
> + if (!req->sq->sqhd_disabled) {
> + if (req->sq->size) {
This should be (!req->sq->sqhd_disabled && req->sq->size))
> + do {
> + old_sqhd = req->sq->sqhd;
> + new_sqhd = (old_sqhd + 1) % req->sq->size;
> + } while (cmpxchg(&req->sq->sqhd, old_sqhd, new_sqhd) !=
> + old_sqhd);
> + }
> }
> +
> sqhd = req->sq->sqhd & 0x0000FFFF;
> req->rsp->sq_head = cpu_to_le16(sqhd);
sq_head is a const 0xffff if flow control is disabled isn't it?
Based on that I'd just move the sqhd_disabled check in the
caller and assign the constant value there.
> @@ -173,6 +175,8 @@ static void nvmet_execute_admin_connect(struct nvmet_req *req)
> kfree(d);
> complete:
> nvmet_req_complete(req, status);
> + if (req->sq->sqhd_disabled)
> + req->sq->sqhd = 0;
Huh, why?
next prev parent reply other threads:[~2018-11-14 14:19 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-03 8:13 [PATCH v2 0/4] Support SQ flow control disabled mode (TP 8005) Sagi Grimberg
2018-10-03 8:13 ` [PATCH v2 1/4] nvmet: support fabrics sq flow control Sagi Grimberg
2018-11-14 14:19 ` Christoph Hellwig [this message]
2018-11-14 16:29 ` Sagi Grimberg
2018-10-03 8:13 ` [PATCH v2 2/4] nvmet: don't override treq upon modification Sagi Grimberg
2018-11-14 14:20 ` Christoph Hellwig
2018-11-14 16:30 ` Sagi Grimberg
2018-10-03 8:13 ` [PATCH v2 3/4] nvmet: expose support for fabrics SQ flow control disable in treq Sagi Grimberg
2018-10-03 8:13 ` [PATCH v2 4/4] nvme: disable fabrics SQ flow control when asked by the user Sagi Grimberg
2018-10-03 8:41 ` Hannes Reinecke
2018-11-14 14:21 ` Christoph Hellwig
2018-11-14 16:32 ` Sagi Grimberg
2018-10-03 8:13 ` [PATCH 5/4 nvme-cli] fabrics: support fabrics sq flow control disable Sagi Grimberg
2018-10-16 1:06 ` [PATCH v2 0/4] Support SQ flow control disabled mode (TP 8005) Sagi Grimberg
2018-10-31 5:03 ` Sagi Grimberg
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=20181114141958.GA27204@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).