All of lore.kernel.org
 help / color / mirror / Atom feed
From: jonathan.derrick@intel.com (Jon Derrick)
Subject: [PATCH] NVMe: Memory barrier before queue_count is incremented
Date: Wed, 3 Jun 2015 10:26:08 -0600	[thread overview]
Message-ID: <20150603162608.GA1453@localhost.localdomain> (raw)
In-Reply-To: <1432751183-20199-1-git-send-email-jonathan.derrick@intel.com>

Ping?

On Wed, May 27, 2015@12:26:23PM -0600, Jon Derrick wrote:
> Protects against reordering and/or preempting which would allow the
> kthread to access the queue descriptor before it is set up
> 
> 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
> 

      parent reply	other threads:[~2015-06-03 16:26 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
2015-06-05 16:34   ` Jens Axboe
2015-06-03 16:26 ` Jon Derrick [this message]

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=20150603162608.GA1453@localhost.localdomain \
    --to=jonathan.derrick@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.