linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] nvme-pci: Hold cq_poll_lock while completing CQEs
@ 2020-02-26 21:49 Bijan Mottahedeh
  2020-02-26 23:06 ` Sagi Grimberg
  0 siblings, 1 reply; 4+ messages in thread
From: Bijan Mottahedeh @ 2020-02-26 21:49 UTC (permalink / raw)
  To: linux-nvme

Avoid scheduling a polling thread if it has cqe's to complete, otherwise
another thread may free enough tags out of order, allowing a queue wrap.

This is an interim solution. Longer term, the two-pass completion should
be fixed.  It was done that way when submit and complete processing were
using the same spinlock, so reducing the critical section was helpful,
but that's not needed anymore.

Signed-off-by: Bijan Mottahedeh <bijan.mottahedeh@oracle.com>
---
 drivers/nvme/host/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index ace4dd9..d3f23d6 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -1078,9 +1078,9 @@ static int nvme_poll(struct blk_mq_hw_ctx *hctx)
 
 	spin_lock(&nvmeq->cq_poll_lock);
 	found = nvme_process_cq(nvmeq, &start, &end, -1);
+	nvme_complete_cqes(nvmeq, start, end);
 	spin_unlock(&nvmeq->cq_poll_lock);
 
-	nvme_complete_cqes(nvmeq, start, end);
 	return found;
 }
 
-- 
1.8.3.1


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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] nvme-pci: Hold cq_poll_lock while completing CQEs
  2020-02-26 21:49 [PATCH 1/1] nvme-pci: Hold cq_poll_lock while completing CQEs Bijan Mottahedeh
@ 2020-02-26 23:06 ` Sagi Grimberg
  2020-02-27  2:31   ` Bijan Mottahedeh
  0 siblings, 1 reply; 4+ messages in thread
From: Sagi Grimberg @ 2020-02-26 23:06 UTC (permalink / raw)
  To: Bijan Mottahedeh, linux-nvme

This needs a Fixes tag, and should probably also be
picked up for stable. Other than that, looks fine,

Reviewed-by: Sagi Grimberg <sagi@grimberg.me>

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] nvme-pci: Hold cq_poll_lock while completing CQEs
  2020-02-26 23:06 ` Sagi Grimberg
@ 2020-02-27  2:31   ` Bijan Mottahedeh
  2020-02-27  2:34     ` Jens Axboe
  0 siblings, 1 reply; 4+ messages in thread
From: Bijan Mottahedeh @ 2020-02-27  2:31 UTC (permalink / raw)
  To: Sagi Grimberg, linux-nvme

On 2/26/2020 3:06 PM, Sagi Grimberg wrote:
 > This needs a Fixes tag, and should probably also be
 > picked up for stable. Other than that, looks fine,
 >
 > Reviewed-by: Sagi Grimberg <sagi@grimberg.me>

Is this the right tag?

Fixes: dabcefab45d3 (nvme: provide optimized poll function for separate 
poll queues)

Should I send a v2?

Thanks.

--bijan

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] nvme-pci: Hold cq_poll_lock while completing CQEs
  2020-02-27  2:31   ` Bijan Mottahedeh
@ 2020-02-27  2:34     ` Jens Axboe
  0 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2020-02-27  2:34 UTC (permalink / raw)
  To: Bijan Mottahedeh, Sagi Grimberg, linux-nvme

On 2/26/20 7:31 PM, Bijan Mottahedeh wrote:
> On 2/26/2020 3:06 PM, Sagi Grimberg wrote:
>  > This needs a Fixes tag, and should probably also be
>  > picked up for stable. Other than that, looks fine,
>  >
>  > Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
> 
> Is this the right tag?
> 
> Fixes: dabcefab45d3 (nvme: provide optimized poll function for separate 
> poll queues)

Should be:

Fixes: dabcefab45d3 ("nvme: provide optimized poll function for separate poll queues")

> Should I send a v2?

I think so, always better that way.

Feel free to add my:

Reviewed-by: Jens Axboe <axboe@kernel.dk>

to it as well.

-- 
Jens Axboe


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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-02-27  2:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-26 21:49 [PATCH 1/1] nvme-pci: Hold cq_poll_lock while completing CQEs Bijan Mottahedeh
2020-02-26 23:06 ` Sagi Grimberg
2020-02-27  2:31   ` Bijan Mottahedeh
2020-02-27  2:34     ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).