Blame SOURCES/kvm-aio-posix-do-skip-system-call-if-ctx-notifier-pollin.patch

383d26
From 189e720e9fa5536fb22960f158b3b7f91dcccf2c Mon Sep 17 00:00:00 2001
383d26
From: Fam Zheng <famz@redhat.com>
383d26
Date: Tue, 18 Sep 2018 09:07:14 +0200
383d26
Subject: [PATCH 3/3] aio-posix: do skip system call if ctx->notifier polling
383d26
 succeeds
383d26
383d26
RH-Author: Fam Zheng <famz@redhat.com>
383d26
Message-id: <20180918090714.18069-4-famz@redhat.com>
383d26
Patchwork-id: 82214
383d26
O-Subject: [RHEL-7.6 qemu-kvm-rhev PATCH 3/3] aio-posix: do skip system call if ctx->notifier polling succeeds
383d26
Bugzilla: 1628191
383d26
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
383d26
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
383d26
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
383d26
383d26
From: Paolo Bonzini <pbonzini@redhat.com>
383d26
383d26
Commit 70232b5253 ("aio-posix: Don't count ctx->notifier as progress when
383d26
2018-08-15), by not reporting progress, causes aio_poll to execute the
383d26
system call when polling succeeds because of ctx->notifier.  This introduces
383d26
latency before the call to aio_bh_poll() and negates the advantages of
383d26
polling, unfortunately.
383d26
383d26
The fix builds on the previous patch, separating the effect of polling on
383d26
the timeout from the progress reported to aio_poll().  ctx->notifier
383d26
does zero the timeout, causing the caller to skip the system call,
383d26
but it does not report progress, so that the bug fix of commit 70232b5253
383d26
still stands.
383d26
383d26
Fixes: 70232b5253a3c4e03ed1ac47ef9246a8ac66c6fa
383d26
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
383d26
Message-Id: <20180912171040.1732-4-pbonzini@redhat.com>
383d26
Reviewed-by: Fam Zheng <famz@redhat.com>
383d26
Signed-off-by: Fam Zheng <famz@redhat.com>
383d26
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
383d26
---
383d26
 util/aio-posix.c | 7 ++++---
383d26
 1 file changed, 4 insertions(+), 3 deletions(-)
383d26
383d26
diff --git a/util/aio-posix.c b/util/aio-posix.c
383d26
index 1b17597..357de8a 100644
383d26
--- a/util/aio-posix.c
383d26
+++ b/util/aio-posix.c
383d26
@@ -498,10 +498,11 @@ static bool run_poll_handlers_once(AioContext *ctx, int64_t *timeout)
383d26
     QLIST_FOREACH_RCU(node, &ctx->aio_handlers, node) {
383d26
         if (!node->deleted && node->io_poll &&
383d26
             aio_node_check(ctx, node->is_external) &&
383d26
-            node->io_poll(node->opaque) &&
383d26
-            node->opaque != &ctx->notifier) {
383d26
+            node->io_poll(node->opaque)) {
383d26
             *timeout = 0;
383d26
-            progress = true;
383d26
+            if (node->opaque != &ctx->notifier) {
383d26
+                progress = true;
383d26
+            }
383d26
         }
383d26
 
383d26
         /* Caller handles freeing deleted nodes.  Don't do it here. */
383d26
-- 
383d26
1.8.3.1
383d26