Skip to content

Commit 4236e60

Browse files
damien-lemoalChristoph Hellwig
authored andcommitted
nvmet: pci-epf: cleanup nvmet_pci_epf_raise_irq()
There is no point in taking the controller irq_lock and calling nvmet_pci_epf_should_raise_irq() for a completion queue which does not have IRQ enabled (NVMET_PCI_EPF_Q_IRQ_ENABLED flag is not set). Move the test for the NVMET_PCI_EPF_Q_IRQ_ENABLED flag out of nvmet_pci_epf_should_raise_irq() to the top of nvmet_pci_epf_raise_irq() to return early when no IRQ should be raised. Also, use dev_err_ratelimited() to avoid a message storm under load when raising IRQs is failing. Signed-off-by: Damien Le Moal <dlemoal@kernel.org> Reviewed-by: Niklas Cassel <cassel@kernel.org> Signed-off-by: Christoph Hellwig <hch@lst.de>
1 parent 2c3a6f6 commit 4236e60

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

drivers/nvme/target/pci-epf.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -596,9 +596,6 @@ static bool nvmet_pci_epf_should_raise_irq(struct nvmet_pci_epf_ctrl *ctrl,
596596
struct nvmet_pci_epf_irq_vector *iv = cq->iv;
597597
bool ret;
598598

599-
if (!test_bit(NVMET_PCI_EPF_Q_IRQ_ENABLED, &cq->flags))
600-
return false;
601-
602599
/* IRQ coalescing for the admin queue is not allowed. */
603600
if (!cq->qid)
604601
return true;
@@ -625,7 +622,8 @@ static void nvmet_pci_epf_raise_irq(struct nvmet_pci_epf_ctrl *ctrl,
625622
struct pci_epf *epf = nvme_epf->epf;
626623
int ret = 0;
627624

628-
if (!test_bit(NVMET_PCI_EPF_Q_LIVE, &cq->flags))
625+
if (!test_bit(NVMET_PCI_EPF_Q_LIVE, &cq->flags) ||
626+
!test_bit(NVMET_PCI_EPF_Q_IRQ_ENABLED, &cq->flags))
629627
return;
630628

631629
mutex_lock(&ctrl->irq_lock);
@@ -658,7 +656,9 @@ static void nvmet_pci_epf_raise_irq(struct nvmet_pci_epf_ctrl *ctrl,
658656
}
659657

660658
if (ret)
661-
dev_err(ctrl->dev, "Failed to raise IRQ (err=%d)\n", ret);
659+
dev_err_ratelimited(ctrl->dev,
660+
"CQ[%u]: Failed to raise IRQ (err=%d)\n",
661+
cq->qid, ret);
662662

663663
unlock:
664664
mutex_unlock(&ctrl->irq_lock);

0 commit comments

Comments
 (0)