From nobody Wed Nov 5 18:34:58 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 1536128749419524.1149347694941; Tue, 4 Sep 2018 23:25:49 -0700 (PDT) Received: from localhost ([::1]:54006 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fxRG8-0007nq-97 for importer@patchew.org; Wed, 05 Sep 2018 02:25:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37308) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fxREB-0006c3-M2 for qemu-devel@nongnu.org; Wed, 05 Sep 2018 02:23:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fxRE6-000765-3d for qemu-devel@nongnu.org; Wed, 05 Sep 2018 02:23:44 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:44358 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 1fxRE5-000741-4W for qemu-devel@nongnu.org; Wed, 05 Sep 2018 02:23:41 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3519B804BAAC for ; Wed, 5 Sep 2018 06:23:40 +0000 (UTC) Received: from xz-x1.redhat.com (ovpn-12-80.pek2.redhat.com [10.72.12.80]) by smtp.corp.redhat.com (Postfix) with ESMTP id E02B110DCF45; Wed, 5 Sep 2018 06:23:33 +0000 (UTC) From: Peter Xu To: qemu-devel@nongnu.org Date: Wed, 5 Sep 2018 14:23:09 +0800 Message-Id: <20180905062313.4059-3-peterx@redhat.com> In-Reply-To: <20180905062313.4059-1-peterx@redhat.com> References: <20180905062313.4059-1-peterx@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Wed, 05 Sep 2018 06:23:40 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Wed, 05 Sep 2018 06:23:40 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'peterx@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH v8 2/6] monitor: resume the monitor earlier if needed 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: "Dr . David Alan Gilbert" , peterx@redhat.com, Markus Armbruster , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Currently when QMP request queue full we won't resume the monitor until we have completely handled the current command. It's not necessary since even before it's handled the queue is already non-full. Moving the resume logic earlier before the command execution, hence drop the need_resume local variable. Signed-off-by: Peter Xu --- monitor.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/monitor.c b/monitor.c index a89bb86599..c2c9853f75 100644 --- a/monitor.c +++ b/monitor.c @@ -4130,7 +4130,6 @@ static void monitor_qmp_bh_dispatcher(void *data) { QMPRequest *req_obj =3D monitor_qmp_requests_pop_any_with_lock(); QDict *rsp; - bool need_resume; Monitor *mon; =20 if (!req_obj) { @@ -4139,8 +4138,11 @@ static void monitor_qmp_bh_dispatcher(void *data) =20 mon =3D req_obj->mon; /* qmp_oob_enabled() might change after "qmp_capabilities" */ - need_resume =3D !qmp_oob_enabled(mon) || - mon->qmp.qmp_requests->length =3D=3D QMP_REQ_QUEUE_LEN_MAX - 1; + if (!qmp_oob_enabled(mon) || + mon->qmp.qmp_requests->length =3D=3D QMP_REQ_QUEUE_LEN_MAX - 1) { + /* Pairs with the monitor_suspend() in handle_qmp_command() */ + monitor_resume(mon); + } qemu_mutex_unlock(&mon->qmp.qmp_queue_lock); if (req_obj->req) { trace_monitor_qmp_cmd_in_band(qobject_get_try_str(req_obj->id) ?: = ""); @@ -4153,10 +4155,6 @@ static void monitor_qmp_bh_dispatcher(void *data) qobject_unref(rsp); } =20 - if (need_resume) { - /* Pairs with the monitor_suspend() in handle_qmp_command() */ - monitor_resume(mon); - } qmp_request_free(req_obj); =20 /* Reschedule instead of looping so the main loop stays responsive */ --=20 2.17.1