public inbox for linux-nvme@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH 1/3] nvme-pci: ensure we're polling a polled queue
@ 2026-02-10 19:37 Keith Busch
  2026-02-10 19:37 ` [PATCH 2/3] nvme-pci: cap queue creation to used queues Keith Busch
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Keith Busch @ 2026-02-10 19:37 UTC (permalink / raw)
  To: linux-nvme, hch; +Cc: Keith Busch

From: Keith Busch <kbusch@kernel.org>

A user can change the polled queue count at run time. There's a brief
window during a reset where a hipri task may try to poll that queue
before the block layer has updated the queue maps, which would race with
the now irq driven queue, which can cause double completions.

Signed-off-by: Keith Busch <kbusch@kernel.org>
---
 drivers/nvme/host/pci.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 80df992d1ae82..5a3e27305176f 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -1496,7 +1496,8 @@ static int nvme_poll(struct blk_mq_hw_ctx *hctx, struct io_comp_batch *iob)
 	struct nvme_queue *nvmeq = hctx->driver_data;
 	bool found;
 
-	if (!nvme_cqe_pending(nvmeq))
+	if (!test_bit(NVMEQ_POLLED, &nvmeq->flags) ||
+	    !nvme_cqe_pending(nvmeq))
 		return 0;
 
 	spin_lock(&nvmeq->cq_poll_lock);
-- 
2.47.3



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

end of thread, other threads:[~2026-02-12 14:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-10 19:37 [PATCH 1/3] nvme-pci: ensure we're polling a polled queue Keith Busch
2026-02-10 19:37 ` [PATCH 2/3] nvme-pci: cap queue creation to used queues Keith Busch
2026-02-11 15:56   ` Christoph Hellwig
2026-02-12 14:57   ` Kanchan Joshi
2026-02-10 19:37 ` [PATCH 3/3] nvme-pci: do not try to add queue maps at runtime Keith Busch
2026-02-11 15:58   ` Christoph Hellwig
2026-02-11 15:56 ` [PATCH 1/3] nvme-pci: ensure we're polling a polled queue Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox