From: Ming Lei <ming.lei@redhat.com>
To: linux-nvme@lists.infradead.org
Cc: Sagi Grimberg <sagi@grimberg.me>, Long Li <longli@microsoft.com>,
Ming Lei <ming.lei@redhat.com>, Jens Axboe <axboe@fb.com>,
Keith Busch <kbusch@kernel.org>, Christoph Hellwig <hch@lst.de>
Subject: [PATCH 1/2] nvme-pci: move sq/cq_poll lock initialization into nvme_init_queue
Date: Fri, 8 Nov 2019 11:55:07 +0800 [thread overview]
Message-ID: <20191108035508.26395-2-ming.lei@redhat.com> (raw)
In-Reply-To: <20191108035508.26395-1-ming.lei@redhat.com>
Prepare for adding new cq lock for improving IO performance in case
of multi-mapping queue, and the new added cq_lock can share space with
cq_poll_lock.
Move sq/cq_poll lock initialization into nvme_init_queue so that
we may initialize the added cq_lock correctly and lockdep warning
can be avoided.
This way is safe because no IO can be started until nvme_init_queue
is returned.
Cc: Keith Busch <kbusch@kernel.org>
Cc: Jens Axboe <axboe@fb.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Sagi Grimberg <sagi@grimberg.me>
Cc: Long Li <longli@microsoft.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
drivers/nvme/host/pci.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index bb88681f4dc3..5b20ab4d21d3 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -1480,8 +1480,6 @@ static int nvme_alloc_queue(struct nvme_dev *dev, int qid, int depth)
goto free_cqdma;
nvmeq->dev = dev;
- spin_lock_init(&nvmeq->sq_lock);
- spin_lock_init(&nvmeq->cq_poll_lock);
nvmeq->cq_head = 0;
nvmeq->cq_phase = 1;
nvmeq->q_db = &dev->dbs[qid * 2 * dev->db_stride];
@@ -1515,6 +1513,9 @@ static void nvme_init_queue(struct nvme_queue *nvmeq, u16 qid)
{
struct nvme_dev *dev = nvmeq->dev;
+ spin_lock_init(&nvmeq->sq_lock);
+ spin_lock_init(&nvmeq->cq_poll_lock);
+
nvmeq->sq_tail = 0;
nvmeq->last_sq_tail = 0;
nvmeq->cq_head = 0;
--
2.20.1
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
next prev parent reply other threads:[~2019-11-08 3:55 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-08 3:55 [PATCH 0/2] nvme-pci: improve IO performance via poll after batch submission Ming Lei
2019-11-08 3:55 ` Ming Lei [this message]
2019-11-08 4:12 ` [PATCH 1/2] nvme-pci: move sq/cq_poll lock initialization into nvme_init_queue Keith Busch
2019-11-08 7:09 ` Ming Lei
2019-11-08 3:55 ` [PATCH 2/2] nvme-pci: poll IO after batch submission for multi-mapping queue Ming Lei
2019-11-11 20:44 ` Christoph Hellwig
2019-11-12 0:33 ` Long Li
2019-11-12 1:35 ` Sagi Grimberg
2019-11-12 2:39 ` Ming Lei
2019-11-12 16:25 ` Hannes Reinecke
2019-11-12 16:49 ` Keith Busch
2019-11-12 17:29 ` Hannes Reinecke
2019-11-13 3:05 ` Ming Lei
2019-11-13 3:17 ` Keith Busch
2019-11-13 3:57 ` Ming Lei
2019-11-12 21:20 ` Long Li
2019-11-12 21:36 ` Keith Busch
2019-11-13 0:50 ` Long Li
2019-11-13 2:24 ` Ming Lei
2019-11-12 2:07 ` Ming Lei
2019-11-12 1:44 ` Sagi Grimberg
2019-11-12 9:56 ` Ming Lei
2019-11-12 17:35 ` Sagi Grimberg
2019-11-12 21:17 ` Long Li
2019-11-12 23:44 ` Jens Axboe
2019-11-13 2:47 ` Ming Lei
2019-11-12 18:11 ` Nadolski, Edmund
2019-11-13 13:46 ` Ming Lei
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=20191108035508.26395-2-ming.lei@redhat.com \
--to=ming.lei@redhat.com \
--cc=axboe@fb.com \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=longli@microsoft.com \
--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.