Skip to contentSkip to conversation

nvme: Fix spurious interrupts

PATCH Applied Keith Busch 3 participants 3 messages Nov 26, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvme: Fix spurious interrupts

The code had asserted an interrupt every time it was requested to check for new completion queue entries.This can result in spurious interrupts seen by the guest OS.

Fix this by asserting an interrupt only if there are un-acknowledged completion queue entries available.

---
 hw/block/nvme.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
hw/block/nvme.c +3 -1
index 9fbe5673cb..7c8c63e8f5 100644
@@ -272,7 +272,9 @@ static void nvme_post_cqes(void *opaque)
             sizeof(req->cqe));
         QTAILQ_INSERT_TAIL(&sq->req_list, req, entry);
     }
-    nvme_irq_assert(n, cq);
+    if (cq->tail != cq->head) {
+        nvme_irq_assert(n, cq);
+    }
 }
 
 static void nvme_enqueue_req_completion(NvmeCQueue *cq, NvmeRequest *req)
Signature · 1 line
2.14.4
Tested-by on v1 1/1
#1 lore raw
Quoted 9 lines · Keith Busch

The code had asserted an interrupt every time it was requested to check for new completion queue entries.This can result in spurious interrupts seen by the guest OS.

Fix this by asserting an interrupt only if there are un-acknowledged completion queue entries available.

Quoted 22 lines
---
 hw/block/nvme.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
hw/block/nvme.c +3 -1
index 9fbe5673cb..7c8c63e8f5 100644
@@ -272,7 +272,9 @@ static void nvme_post_cqes(void *opaque)
             sizeof(req->cqe));
         QTAILQ_INSERT_TAIL(&sq->req_list, req, entry);
     }
-    nvme_irq_assert(n, cq);
+    if (cq->tail != cq->head) {
+        nvme_irq_assert(n, cq);
+    }
 }
 
 static void nvme_enqueue_req_completion(NvmeCQueue *cq, NvmeRequest *req)
Signature · 1 line
2.14.4
Applied
#2 lore raw
In reply to Keith Busch

Am 26.11.2018 um 18:17 hat Keith Busch geschrieben:

Quoted 9 lines

The code had asserted an interrupt every time it was requested to check for new completion queue entries.This can result in spurious interrupts seen by the guest OS.

Fix this by asserting an interrupt only if there are un-acknowledged completion queue entries available.

Thanks, applied to the block branch.

Kevin