qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: qemu-devel@nongnu.org
Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com>,
	Peter Maydell <peter.maydell@linaro.org>,
	qemu-block@nongnu.org, Peter Lieven <pl@kamp.de>,
	Max Reitz <mreitz@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Kevin Wolf <kwolf@redhat.com>, Fam Zheng <famz@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>
Subject: [Qemu-devel] [PULL 11/11] main-loop: drop spin_counter
Date: Mon,  4 Jun 2018 12:20:36 +0100	[thread overview]
Message-ID: <20180604112036.2715-12-stefanha@redhat.com> (raw)
In-Reply-To: <20180604112036.2715-1-stefanha@redhat.com>

Commit d759c951f3287fad04210a52f2dc93f94cf58c7f ("replay: push
replay_mutex_lock up the call tree") removed the !timeout lock
optimization in the main loop.

The idea of the optimization was to avoid ping-pongs between threads by
keeping the Big QEMU Lock held across non-blocking (!timeout) main loop
iterations.

A warning is printed when the main loop spins without releasing BQL for
long periods of time.  These warnings were supposed to aid debugging but
in practice they just alarm users.  They are considered noise because
the cause of spinning is not shown and is hard to find.

Now that the lock optimization has been removed, there is no danger of
hogging the BQL.  Drop the spin counter and the infamous warning.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
---
 util/main-loop.c                 | 25 -------------------------
 tests/qemu-iotests/common.filter |  1 -
 2 files changed, 26 deletions(-)

diff --git a/util/main-loop.c b/util/main-loop.c
index 992f9b0f34..affe0403c5 100644
--- a/util/main-loop.c
+++ b/util/main-loop.c
@@ -222,36 +222,11 @@ static int os_host_main_loop_wait(int64_t timeout)
 {
     GMainContext *context = g_main_context_default();
     int ret;
-    static int spin_counter;
 
     g_main_context_acquire(context);
 
     glib_pollfds_fill(&timeout);
 
-    /* If the I/O thread is very busy or we are incorrectly busy waiting in
-     * the I/O thread, this can lead to starvation of the BQL such that the
-     * VCPU threads never run.  To make sure we can detect the later case,
-     * print a message to the screen.  If we run into this condition, create
-     * a fake timeout in order to give the VCPU threads a chance to run.
-     */
-    if (!timeout && (spin_counter > MAX_MAIN_LOOP_SPIN)) {
-        static bool notified;
-
-        if (!notified && !qtest_enabled() && !qtest_driver()) {
-            warn_report("I/O thread spun for %d iterations",
-                        MAX_MAIN_LOOP_SPIN);
-            notified = true;
-        }
-
-        timeout = SCALE_MS;
-    }
-
-
-    if (timeout) {
-        spin_counter = 0;
-    } else {
-        spin_counter++;
-    }
     qemu_mutex_unlock_iothread();
     replay_mutex_unlock();
 
diff --git a/tests/qemu-iotests/common.filter b/tests/qemu-iotests/common.filter
index f08ee55046..2031e353a5 100644
--- a/tests/qemu-iotests/common.filter
+++ b/tests/qemu-iotests/common.filter
@@ -77,7 +77,6 @@ _filter_qemu()
 {
     sed -e "s#\\(^\\|(qemu) \\)$(basename $QEMU_PROG):#\1QEMU_PROG:#" \
         -e 's#^QEMU [0-9]\+\.[0-9]\+\.[0-9]\+ monitor#QEMU X.Y.Z monitor#' \
-        -e '/main-loop: WARNING: I\/O thread spun for [0-9]\+ iterations/d' \
         -e $'s#\r##' # QEMU monitor uses \r\n line endings
 }
 
-- 
2.17.1

  parent reply	other threads:[~2018-06-04 11:21 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-04 11:20 [Qemu-devel] [PULL 00/11] Block patches Stefan Hajnoczi
2018-06-04 11:20 ` [Qemu-devel] [PULL 01/11] block: Introduce API for copy offloading Stefan Hajnoczi
2018-06-04 11:20 ` [Qemu-devel] [PULL 02/11] raw: Check byte range uniformly Stefan Hajnoczi
2018-06-04 11:20 ` [Qemu-devel] [PULL 03/11] raw: Implement copy offloading Stefan Hajnoczi
2018-06-04 11:20 ` [Qemu-devel] [PULL 04/11] qcow2: " Stefan Hajnoczi
2018-06-04 11:20 ` [Qemu-devel] [PULL 05/11] file-posix: Implement bdrv_co_copy_range Stefan Hajnoczi
2018-06-04 11:20 ` [Qemu-devel] [PULL 06/11] iscsi: Query and save device designator when opening Stefan Hajnoczi
2018-06-04 11:20 ` [Qemu-devel] [PULL 07/11] iscsi: Create and use iscsi_co_wait_for_task Stefan Hajnoczi
2018-06-04 11:20 ` [Qemu-devel] [PULL 08/11] iscsi: Implement copy offloading Stefan Hajnoczi
2018-06-04 11:20 ` [Qemu-devel] [PULL 09/11] block-backend: Add blk_co_copy_range Stefan Hajnoczi
2018-06-04 11:20 ` [Qemu-devel] [PULL 10/11] qemu-img: Convert with copy offloading Stefan Hajnoczi
2018-06-04 11:20 ` Stefan Hajnoczi [this message]
2018-06-05  9:38 ` [Qemu-devel] [PULL 00/11] Block patches Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180604112036.2715-12-stefanha@redhat.com \
    --to=stefanha@redhat.com \
    --cc=famz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=pl@kamp.de \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=ronniesahlberg@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).