|
|
383d26 |
From d215f56d789b8d6a2cb27501c89a516d213b1af3 Mon Sep 17 00:00:00 2001
|
|
|
383d26 |
From: Jeffrey Cody <jcody@redhat.com>
|
|
|
383d26 |
Date: Wed, 20 Jun 2018 17:44:46 +0200
|
|
|
383d26 |
Subject: [PATCH 51/54] main-loop: drop spin_counter
|
|
|
383d26 |
|
|
|
383d26 |
RH-Author: Jeffrey Cody <jcody@redhat.com>
|
|
|
383d26 |
Message-id: <835200bb37bc622f0f6f9c471c809a1b73a08482.1529516334.git.jcody@redhat.com>
|
|
|
383d26 |
Patchwork-id: 80906
|
|
|
383d26 |
O-Subject: [RHEL-7.6 qemu-kvm-rhev PATCH v2 1/1] main-loop: drop spin_counter
|
|
|
383d26 |
Bugzilla: 1168213
|
|
|
383d26 |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
383d26 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
383d26 |
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
|
|
|
383d26 |
|
|
|
383d26 |
From: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
383d26 |
|
|
|
383d26 |
Commit d759c951f3287fad04210a52f2dc93f94cf58c7f ("replay: push
|
|
|
383d26 |
replay_mutex_lock up the call tree") removed the !timeout lock
|
|
|
383d26 |
optimization in the main loop.
|
|
|
383d26 |
|
|
|
383d26 |
The idea of the optimization was to avoid ping-pongs between threads by
|
|
|
383d26 |
keeping the Big QEMU Lock held across non-blocking (!timeout) main loop
|
|
|
383d26 |
iterations.
|
|
|
383d26 |
|
|
|
383d26 |
A warning is printed when the main loop spins without releasing BQL for
|
|
|
383d26 |
long periods of time. These warnings were supposed to aid debugging but
|
|
|
383d26 |
in practice they just alarm users. They are considered noise because
|
|
|
383d26 |
the cause of spinning is not shown and is hard to find.
|
|
|
383d26 |
|
|
|
383d26 |
Now that the lock optimization has been removed, there is no danger of
|
|
|
383d26 |
hogging the BQL. Drop the spin counter and the infamous warning.
|
|
|
383d26 |
|
|
|
383d26 |
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
383d26 |
Reviewed-by: Jeff Cody <jcody@redhat.com>
|
|
|
383d26 |
(cherry picked from commit 21891a5a3011608845b5d7f1f9cce60cdc2bcc62)
|
|
|
383d26 |
Note: The original patch series from Stefan makes note that the
|
|
|
383d26 |
patch can be dropped because the lock optimization changed
|
|
|
383d26 |
upstream.
|
|
|
383d26 |
|
|
|
383d26 |
However, even without that optimization change upstream, this
|
|
|
383d26 |
warning / debug message is not very useful, and is just noise that
|
|
|
383d26 |
does not aid in debugging. Go ahead and remove it anyway.
|
|
|
383d26 |
Signed-off-by: Jeff Cody <jcody@redhat.com>
|
|
|
383d26 |
|
|
|
383d26 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
383d26 |
---
|
|
|
383d26 |
tests/qemu-iotests/common.filter | 1 -
|
|
|
383d26 |
util/main-loop.c | 25 -------------------------
|
|
|
383d26 |
2 files changed, 26 deletions(-)
|
|
|
383d26 |
|
|
|
383d26 |
diff --git a/tests/qemu-iotests/common.filter b/tests/qemu-iotests/common.filter
|
|
|
383d26 |
index c5f4bcf..7acb454 100644
|
|
|
383d26 |
--- a/tests/qemu-iotests/common.filter
|
|
|
383d26 |
+++ b/tests/qemu-iotests/common.filter
|
|
|
383d26 |
@@ -77,7 +77,6 @@ _filter_qemu()
|
|
|
383d26 |
{
|
|
|
383d26 |
sed -e "s#\\(^\\|(qemu) \\)$(basename $QEMU_PROG):#\1QEMU_PROG:#" \
|
|
|
383d26 |
-e 's#^QEMU [0-9]\+\.[0-9]\+\.[0-9]\+ monitor#QEMU X.Y.Z monitor#' \
|
|
|
383d26 |
- -e '/main-loop: WARNING: I\/O thread spun for [0-9]\+ iterations/d' \
|
|
|
383d26 |
-e $'s#\r##' # QEMU monitor uses \r\n line endings
|
|
|
383d26 |
}
|
|
|
383d26 |
|
|
|
383d26 |
diff --git a/util/main-loop.c b/util/main-loop.c
|
|
|
383d26 |
index 992f9b0..affe040 100644
|
|
|
383d26 |
--- a/util/main-loop.c
|
|
|
383d26 |
+++ b/util/main-loop.c
|
|
|
383d26 |
@@ -222,36 +222,11 @@ static int os_host_main_loop_wait(int64_t timeout)
|
|
|
383d26 |
{
|
|
|
383d26 |
GMainContext *context = g_main_context_default();
|
|
|
383d26 |
int ret;
|
|
|
383d26 |
- static int spin_counter;
|
|
|
383d26 |
|
|
|
383d26 |
g_main_context_acquire(context);
|
|
|
383d26 |
|
|
|
383d26 |
glib_pollfds_fill(&timeout);
|
|
|
383d26 |
|
|
|
383d26 |
- /* If the I/O thread is very busy or we are incorrectly busy waiting in
|
|
|
383d26 |
- * the I/O thread, this can lead to starvation of the BQL such that the
|
|
|
383d26 |
- * VCPU threads never run. To make sure we can detect the later case,
|
|
|
383d26 |
- * print a message to the screen. If we run into this condition, create
|
|
|
383d26 |
- * a fake timeout in order to give the VCPU threads a chance to run.
|
|
|
383d26 |
- */
|
|
|
383d26 |
- if (!timeout && (spin_counter > MAX_MAIN_LOOP_SPIN)) {
|
|
|
383d26 |
- static bool notified;
|
|
|
383d26 |
-
|
|
|
383d26 |
- if (!notified && !qtest_enabled() && !qtest_driver()) {
|
|
|
383d26 |
- warn_report("I/O thread spun for %d iterations",
|
|
|
383d26 |
- MAX_MAIN_LOOP_SPIN);
|
|
|
383d26 |
- notified = true;
|
|
|
383d26 |
- }
|
|
|
383d26 |
-
|
|
|
383d26 |
- timeout = SCALE_MS;
|
|
|
383d26 |
- }
|
|
|
383d26 |
-
|
|
|
383d26 |
-
|
|
|
383d26 |
- if (timeout) {
|
|
|
383d26 |
- spin_counter = 0;
|
|
|
383d26 |
- } else {
|
|
|
383d26 |
- spin_counter++;
|
|
|
383d26 |
- }
|
|
|
383d26 |
qemu_mutex_unlock_iothread();
|
|
|
383d26 |
replay_mutex_unlock();
|
|
|
383d26 |
|
|
|
383d26 |
--
|
|
|
383d26 |
1.8.3.1
|
|
|
383d26 |
|