From: Klaus Jensen Date: Wed, 15 Feb 2023 20:08:21 +0000 (+0100) Subject: hw/nvme: add noop cq polling X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Fiothread;p=qemu-nvme.git hw/nvme: add noop cq polling 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 [k.jensen: split from previous patch] Signed-off-by: Klaus Jensen --- diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index 47f3e0c6bc..4d5179fe5d 100644 --- a/hw/nvme/ctrl.c +++ b/hw/nvme/ctrl.c @@ -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); }