]> www.infradead.org Git - qemu-nvme.git/commitdiff
hw/nvme: add noop cq polling iothread
authorKlaus Jensen <k.jensen@samsung.com>
Wed, 15 Feb 2023 20:08:21 +0000 (21:08 +0100)
committerKlaus Jensen <k.jensen@samsung.com>
Thu, 8 Jun 2023 19:15:39 +0000 (21:15 +0200)
Add noop polling. The io_poll function always returns false, since there
is nothing obvious to do. We could use this to suppress cq doorbells,
but the benefit is not clear.

For some reason this improves IOPS. Why?

Signed-off-by: Jinhao Fan <fanjinhao21s@ict.ac.cn>
[k.jensen: split from previous patch]
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
hw/nvme/ctrl.c

index 47f3e0c6bc5ea820b5893c9159bb30a49ae77fdf..4d5179fe5dd3626fcdf89fc72bc8dab913a2ac8d 100644 (file)
@@ -4827,6 +4827,16 @@ static void nvme_cq_notifier(EventNotifier *e)
     nvme_cq_kick(cq, start_sqs);
 }
 
+static bool nvme_cq_notifier_aio_poll(void *opaque)
+{
+    return false;
+}
+
+static void nvme_cq_notifier_aio_poll_ready(EventNotifier *n)
+{
+    ;
+}
+
 static int nvme_init_cq_ioeventfd(NvmeCQueue *cq)
 {
     NvmeCtrl *n = cq->ctrl;
@@ -4839,8 +4849,9 @@ static int nvme_init_cq_ioeventfd(NvmeCQueue *cq)
     }
 
     if (cq->cqid) {
-        aio_set_event_notifier(n->ctx, &cq->notifier, nvme_cq_notifier, NULL,
-                               NULL);
+        aio_set_event_notifier(n->ctx, &cq->notifier, nvme_cq_notifier,
+                               nvme_cq_notifier_aio_poll,
+                               nvme_cq_notifier_aio_poll_ready);
     } else {
         event_notifier_set_handler(&cq->notifier, nvme_cq_notifier);
     }