All of lore.kernel.org
 help / color / mirror / Atom feed
From: keith.busch@intel.com (Keith Busch)
Subject: [PATCH] NVMe: Memory barrier before queue_count is incremented
Date: Thu, 28 May 2015 22:32:38 +0000 (UTC)	[thread overview]
Message-ID: <alpine.LNX.2.00.1505282232260.15930@localhost.lm.intel.com> (raw)
In-Reply-To: <1432751183-20199-1-git-send-email-jonathan.derrick@intel.com>

On Wed, 27 May 2015, Jon Derrick wrote:
> Protects against reordering and/or preempting which would allow the
> kthread to access the queue descriptor before it is set up

Looks good to me.

Acked-by: Keith Busch <keith.busch at intel.com>

> Signed-off-by: Jon Derrick <jonathan.derrick at intel.com>
> ---
> drivers/block/nvme-core.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c
> index c42bc53..2b0c817 100644
> --- a/drivers/block/nvme-core.c
> +++ b/drivers/block/nvme-core.c
> @@ -1463,9 +1463,12 @@ static struct nvme_queue *nvme_alloc_queue(struct nvme_dev *dev, int qid,
> 	nvmeq->q_db = &dev->dbs[qid * 2 * dev->db_stride];
> 	nvmeq->q_depth = depth;
> 	nvmeq->qid = qid;
> -	dev->queue_count++;
> 	dev->queues[qid] = nvmeq;
>
> +	/* make sure queue descriptor is set before queue count, for kthread */
> +	mb();
> +	dev->queue_count++;
> +
> 	return nvmeq;
>
>  free_cqdma:
> -- 
> 2.1.4
>
>

  reply	other threads:[~2015-05-28 22:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-27 18:26 [PATCH] NVMe: Memory barrier before queue_count is incremented Jon Derrick
2015-05-28 22:32 ` Keith Busch [this message]
2015-06-05 16:34   ` Jens Axboe
2015-06-03 16:26 ` Jon Derrick

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=alpine.LNX.2.00.1505282232260.15930@localhost.lm.intel.com \
    --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 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.