All of lore.kernel.org
 help / color / mirror / Atom feed
From: Martin Wilck <mwilck@suse.com>
To: Hannes Reinecke <hare@suse.de>, Keith Busch <keith.busch@wdc.com>
Cc: linux-nvme@lists.infradead.org,
	John Meneghini <john.meneghini@netapp.com>,
	Sagi Grimberg <sagi@grimberg.me>,
	Chaitanya Kulkarni <Chaitanya.Kulkarni@wdc.com>,
	James Smart <james.smart@broadcom.com>
Subject: Re: [PATCH RFC] nvme/fc: sq flow control
Date: Wed, 26 Feb 2020 11:44:04 +0100	[thread overview]
Message-ID: <285681d11e1164693666eeaead4926159d89549f.camel@suse.com> (raw)
In-Reply-To: <20200225235956.28475-1-hare@suse.de>

On Wed, 2020-02-26 at 00:59 +0100, Hannes Reinecke wrote:
> As per NVMe-oF spec sq flow control is actually mandatory, and we
> should
> be implementing it to avoid the controller to return a fatal status
> error, and try to play nicely with controllers using sq flow control
> to implement QoS.
> 
> Signed-off-by: Hannes Reinecke <hare@suse.de>
> ---
>  drivers/nvme/host/fc.c | 29 ++++++++++++++++++++++++++++-
>  1 file changed, 28 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c
> index a19ddb61039d..628397bd5065 100644
> --- a/drivers/nvme/host/fc.c
> +++ b/drivers/nvme/host/fc.c
> ...
> @@ -2177,6 +2181,18 @@ nvme_fc_unmap_data(struct nvme_fc_ctrl *ctrl,
> struct request *rq,
>  	freq->sg_cnt = 0;
>  }
>  
> +static int nvme_fc_update_sq_tail(struct nvme_fc_queue *queue, int
> incr)
> +{
> +	int old_sqtl, new_sqtl;
> +
> +	do {
> +		old_sqtl = queue->sq_tail;
> +		new_sqtl = (old_sqtl + incr) % queue->ctrl-
> >ctrl.sqsize;
> +	} while (cmpxchg(&queue->sq_tail, old_sqtl, new_sqtl) !=
> +		 old_sqtl);

Shouldn't you use READ_ONCE() to update old_sqtl, or better even, use
the return value of cmpxchg()?

Regards
Martin



_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

  parent reply	other threads:[~2020-02-26 10:44 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-25 23:59 [PATCH RFC] nvme/fc: sq flow control Hannes Reinecke
2020-02-26  0:08 ` Sagi Grimberg
2020-02-26  0:14   ` Hannes Reinecke
2020-02-26  0:38     ` Sagi Grimberg
2020-02-27 11:27       ` Hannes Reinecke
2020-02-26 10:44 ` Martin Wilck [this message]
2020-02-26 15:47   ` Hannes Reinecke
2020-02-26 23:45 ` Sagi Grimberg
2020-02-27  1:46   ` James Smart
2020-02-27  3:52     ` Sagi Grimberg
2020-02-27 21:46       ` Meneghini, John
2020-02-28 16:35       ` James Smart
2020-02-28 10:39   ` Hannes Reinecke
2020-03-09 21:59 ` James Smart
2020-03-10  6:55   ` Hannes Reinecke
2020-03-10 16:44     ` James Smart

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=285681d11e1164693666eeaead4926159d89549f.camel@suse.com \
    --to=mwilck@suse.com \
    --cc=Chaitanya.Kulkarni@wdc.com \
    --cc=hare@suse.de \
    --cc=james.smart@broadcom.com \
    --cc=john.meneghini@netapp.com \
    --cc=keith.busch@wdc.com \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    /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.