* [PATCH] NVMe: Memory barrier before queue_count is incremented
@ 2015-05-27 18:26 Jon Derrick
2015-05-28 22:32 ` Keith Busch
2015-06-03 16:26 ` Jon Derrick
0 siblings, 2 replies; 4+ messages in thread
From: Jon Derrick @ 2015-05-27 18:26 UTC (permalink / raw)
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] NVMe: Memory barrier before queue_count is incremented
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
1 sibling, 1 reply; 4+ messages in thread
From: Keith Busch @ 2015-05-28 22:32 UTC (permalink / raw)
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
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] NVMe: Memory barrier before queue_count is incremented
2015-05-28 22:32 ` Keith Busch
@ 2015-06-05 16:34 ` Jens Axboe
0 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2015-06-05 16:34 UTC (permalink / raw)
On 05/28/2015 04:32 PM, Keith Busch wrote:
> 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>
Ditto, merged.
--
Jens Axboe
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] NVMe: Memory barrier before queue_count is incremented
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-03 16:26 ` Jon Derrick
1 sibling, 0 replies; 4+ messages in thread
From: Jon Derrick @ 2015-06-03 16:26 UTC (permalink / raw)
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
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-06-05 16:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox