From e7c2cbc1d9e1b53fe6eb5bd07c78e192e6c83dff Mon Sep 17 00:00:00 2001 From: Klaus Jensen Date: Wed, 15 Feb 2023 21:08:21 +0100 Subject: [PATCH] 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 --- hw/nvme/ctrl.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) 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); } -- 2.50.1