From nobody Mon Apr 14 21:56:06 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1528111987346712.0266258959995; Mon, 4 Jun 2018 04:33:07 -0700 (PDT) Received: from localhost ([::1]:38987 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fPnjW-0000KW-AZ for importer@patchew.org; Mon, 04 Jun 2018 07:33:06 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36809) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fPnY7-0008Db-Jq for qemu-devel@nongnu.org; Mon, 04 Jun 2018 07:21:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fPnY4-0001a0-Ea for qemu-devel@nongnu.org; Mon, 04 Jun 2018 07:21:19 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:33470 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fPnY2-0001Z1-7W; Mon, 04 Jun 2018 07:21:14 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D001D401EF05; Mon, 4 Jun 2018 11:21:13 +0000 (UTC) Received: from localhost (ovpn-116-202.ams2.redhat.com [10.36.116.202]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6CEA320357CA; Mon, 4 Jun 2018 11:21:13 +0000 (UTC) From: Stefan Hajnoczi To: Date: Mon, 4 Jun 2018 12:20:36 +0100 Message-Id: <20180604112036.2715-12-stefanha@redhat.com> In-Reply-To: <20180604112036.2715-1-stefanha@redhat.com> References: <20180604112036.2715-1-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Mon, 04 Jun 2018 11:21:13 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Mon, 04 Jun 2018 11:21:13 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'stefanha@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 11/11] main-loop: drop spin_counter X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Peter Maydell , Fam Zheng , Stefan Hajnoczi , qemu-block@nongnu.org, Peter Lieven , Max Reitz , Ronnie Sahlberg , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Jeff Cody --- 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 =3D g_main_context_default(); int ret; - static int spin_counter; =20 g_main_context_acquire(context); =20 glib_pollfds_fill(&timeout); =20 - /* 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, crea= te - * 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 =3D true; - } - - timeout =3D SCALE_MS; - } - - - if (timeout) { - spin_counter =3D 0; - } else { - spin_counter++; - } qemu_mutex_unlock_iothread(); replay_mutex_unlock(); =20 diff --git a/tests/qemu-iotests/common.filter b/tests/qemu-iotests/common.f= ilter 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 } =20 --=20 2.17.1