A following patch processes interrupt-driven completion queues from
IRQ_POLL_SOFTIRQ. Ensure every task-context user disables bottom halves
while holding cq_poll_lock so the softirq cannot interrupt the local
owner.

This includes explicit blk-mq polling. Those queues do not use irq_poll,
but all cq_poll_lock instances share one lockdep class because they are
initialized at the same call site. Keep that class consistently
softirq-safe rather than reclassifying reused queue objects across reset.

Assisted-by: LLM
Signed-off-by: Naman Jain <[email protected]>
---
 drivers/nvme/host/pci.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index dbcfc7ddb78aa..bd4a6461b620f 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -1673,9 +1673,9 @@ static void nvme_poll_irqdisable(struct nvme_queue *nvmeq)
 
        irq = pci_irq_vector(pdev, nvmeq->cq_vector);
        disable_irq(irq);
-       spin_lock(&nvmeq->cq_poll_lock);
+       spin_lock_bh(&nvmeq->cq_poll_lock);
        nvme_poll_cq(nvmeq, NULL);
-       spin_unlock(&nvmeq->cq_poll_lock);
+       spin_unlock_bh(&nvmeq->cq_poll_lock);
        enable_irq(irq);
 }
 
@@ -1688,9 +1688,9 @@ static int nvme_poll(struct blk_mq_hw_ctx *hctx, struct 
io_comp_batch *iob)
            !nvme_cqe_pending(nvmeq))
                return 0;
 
-       spin_lock(&nvmeq->cq_poll_lock);
+       spin_lock_bh(&nvmeq->cq_poll_lock);
        found = nvme_poll_cq(nvmeq, iob);
-       spin_unlock(&nvmeq->cq_poll_lock);
+       spin_unlock_bh(&nvmeq->cq_poll_lock);
 
        return found;
 }
@@ -2086,9 +2086,9 @@ static void nvme_reap_pending_cqes(struct nvme_dev *dev)
        int i;
 
        for (i = dev->ctrl.queue_count - 1; i > 0; i--) {
-               spin_lock(&dev->queues[i].cq_poll_lock);
+               spin_lock_bh(&dev->queues[i].cq_poll_lock);
                nvme_poll_cq(&dev->queues[i], NULL);
-               spin_unlock(&dev->queues[i].cq_poll_lock);
+               spin_unlock_bh(&dev->queues[i].cq_poll_lock);
        }
 }
 

Reply via email to