From nobody Wed Nov 5 16:49:02 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 1535800910318630.8148215057541; Sat, 1 Sep 2018 04:21:50 -0700 (PDT) Received: from localhost ([::1]:36570 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fw3yP-0001f7-7z for importer@patchew.org; Sat, 01 Sep 2018 07:21:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50800) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fw3u7-0003St-FR for qemu-devel@nongnu.org; Sat, 01 Sep 2018 07:17:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fw3u6-0000ji-0W for qemu-devel@nongnu.org; Sat, 01 Sep 2018 07:17:23 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:48026 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 1fw3u5-0000jN-QF for qemu-devel@nongnu.org; Sat, 01 Sep 2018 07:17:21 -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 79A4787A70 for ; Sat, 1 Sep 2018 11:17:21 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-191.ams2.redhat.com [10.36.116.191]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 115C3101041C; Sat, 1 Sep 2018 11:17:18 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id B622E1138603; Sat, 1 Sep 2018 13:17:16 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Sat, 1 Sep 2018 13:17:11 +0200 Message-Id: <20180901111716.1675-2-armbru@redhat.com> In-Reply-To: <20180901111716.1675-1-armbru@redhat.com> References: <20180901111716.1675-1-armbru@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.1]); Sat, 01 Sep 2018 11:17:21 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Sat, 01 Sep 2018 11:17:21 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'armbru@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] [PULL 1/6] monitor: simplify monitor_qmp_setup_handlers_bh 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: Peter Xu 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" From: Peter Xu When we reach monitor_qmp_setup_handlers_bh() we must be using the IOThread then, so no need to check against it any more. Instead, we assert. Reviewed-by: Markus Armbruster Signed-off-by: Peter Xu Message-Id: <20180815133747.25032-2-peterx@redhat.com> [Insufficiently useful comment dropped] Signed-off-by: Markus Armbruster --- monitor.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/monitor.c b/monitor.c index 021c11b1bf..c049776603 100644 --- a/monitor.c +++ b/monitor.c @@ -4631,15 +4631,9 @@ static void monitor_qmp_setup_handlers_bh(void *opaq= ue) Monitor *mon =3D opaque; GMainContext *context; =20 - if (mon->use_io_thread) { - /* Use @mon_iothread context */ - context =3D monitor_get_io_context(); - assert(context); - } else { - /* Use default main loop context */ - context =3D NULL; - } - + assert(mon->use_io_thread); + context =3D monitor_get_io_context(); + assert(context); qemu_chr_fe_set_handlers(&mon->chr, monitor_can_read, monitor_qmp_read, monitor_qmp_event, NULL, mon, context, true); monitor_list_append(mon); --=20 2.17.1 From nobody Wed Nov 5 16:49:02 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 1535800908947866.9164533235262; Sat, 1 Sep 2018 04:21:48 -0700 (PDT) Received: from localhost ([::1]:36568 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fw3yN-0001dv-Sy for importer@patchew.org; Sat, 01 Sep 2018 07:21:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50801) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fw3u7-0003Su-FX for qemu-devel@nongnu.org; Sat, 01 Sep 2018 07:17:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fw3u6-0000jo-19 for qemu-devel@nongnu.org; Sat, 01 Sep 2018 07:17:23 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:46274 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 1fw3u5-0000jM-Qm for qemu-devel@nongnu.org; Sat, 01 Sep 2018 07:17:21 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7906E5C97 for ; Sat, 1 Sep 2018 11:17:21 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-191.ams2.redhat.com [10.36.116.191]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1136B2027EA0; Sat, 1 Sep 2018 11:17:18 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id B979D113860E; Sat, 1 Sep 2018 13:17:16 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Sat, 1 Sep 2018 13:17:12 +0200 Message-Id: <20180901111716.1675-3-armbru@redhat.com> In-Reply-To: <20180901111716.1675-1-armbru@redhat.com> References: <20180901111716.1675-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Sat, 01 Sep 2018 11:17:21 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Sat, 01 Sep 2018 11:17:21 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'armbru@redhat.com' RCPT:'' Content-Transfer-Encoding: quoted-printable 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] [PULL 2/6] monitor: accept input on resume 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: =?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-Type: text/plain; charset="utf-8" From: Marc-Andr=C3=A9 Lureau A chardev may stop trying to write if the associated can_read() callback returned 0. This happens when the monitor is suspended. The frontend is supposed to call qemu_chr_fe_accept_input() when it is ready to accept data again. An issue was observed with a spice port: pending commands may be delayed, as the chardev is not flushed. Most chardev don't use the accept_input() callback, and instead check regularly if they can write. The ones that do use it are braille, mux, msmouse, spice (abstract), spicevmc, spiceport, wctablet. Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20180817173752.19136-1-marcandre.lureau@redhat.com> Signed-off-by: Markus Armbruster --- monitor.c | 1 + 1 file changed, 1 insertion(+) diff --git a/monitor.c b/monitor.c index c049776603..c1add2ce09 100644 --- a/monitor.c +++ b/monitor.c @@ -4411,6 +4411,7 @@ void monitor_resume(Monitor *mon) assert(mon->rs); readline_show_prompt(mon->rs); } + qemu_chr_fe_accept_input(&mon->chr); } trace_monitor_suspend(mon, -1); } --=20 2.17.1 From nobody Wed Nov 5 16:49:02 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 1535801003393705.5991811939633; Sat, 1 Sep 2018 04:23:23 -0700 (PDT) Received: from localhost ([::1]:36576 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fw3zu-0004o6-CZ for importer@patchew.org; Sat, 01 Sep 2018 07:23:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50799) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fw3u7-0003Sr-FO for qemu-devel@nongnu.org; Sat, 01 Sep 2018 07:17:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fw3u6-0000jv-9u for qemu-devel@nongnu.org; Sat, 01 Sep 2018 07:17:23 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:48030 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 1fw3u6-0000jc-5B for qemu-devel@nongnu.org; Sat, 01 Sep 2018 07:17:22 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CDAA487A7C for ; Sat, 1 Sep 2018 11:17:21 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-191.ams2.redhat.com [10.36.116.191]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 112DB2018084; Sat, 1 Sep 2018 11:17:18 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id BEB5611385A7; Sat, 1 Sep 2018 13:17:16 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Sat, 1 Sep 2018 13:17:13 +0200 Message-Id: <20180901111716.1675-4-armbru@redhat.com> In-Reply-To: <20180901111716.1675-1-armbru@redhat.com> References: <20180901111716.1675-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Sat, 01 Sep 2018 11:17:21 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Sat, 01 Sep 2018 11:17:21 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'armbru@redhat.com' RCPT:'' Content-Transfer-Encoding: quoted-printable 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] [PULL 3/6] monitor: consitify qmp_send_response() QDict argument 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: =?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-Type: text/plain; charset="utf-8" From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Markus Armbruster Message-Id: <20180829134043.31706-2-marcandre.lureau@redhat.com> Signed-off-by: Markus Armbruster --- monitor.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/monitor.c b/monitor.c index c1add2ce09..bd0810df4d 100644 --- a/monitor.c +++ b/monitor.c @@ -503,9 +503,9 @@ int monitor_fprintf(FILE *stream, const char *fmt, ...) return 0; } =20 -static void qmp_send_response(Monitor *mon, QDict *rsp) +static void qmp_send_response(Monitor *mon, const QDict *rsp) { - QObject *data =3D QOBJECT(rsp); + const QObject *data =3D QOBJECT(rsp); QString *json; =20 json =3D mon->flags & MONITOR_USE_PRETTY ? qobject_to_json_pretty(data= ) : --=20 2.17.1 From nobody Wed Nov 5 16:49:02 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 (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1535800774002247.52388535808132; Sat, 1 Sep 2018 04:19:34 -0700 (PDT) Received: from localhost ([::1]:36554 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fw3w3-0007YA-I7 for importer@patchew.org; Sat, 01 Sep 2018 07:19:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50798) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fw3u7-0003Sq-FM for qemu-devel@nongnu.org; Sat, 01 Sep 2018 07:17:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fw3u4-0000j4-H4 for qemu-devel@nongnu.org; Sat, 01 Sep 2018 07:17:23 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:48024 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 1fw3u4-0000ir-CO for qemu-devel@nongnu.org; Sat, 01 Sep 2018 07:17:20 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 10CD787A70 for ; Sat, 1 Sep 2018 11:17:20 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-191.ams2.redhat.com [10.36.116.191]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 113D2FA988; Sat, 1 Sep 2018 11:17:18 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id C2D9D11385CB; Sat, 1 Sep 2018 13:17:16 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Sat, 1 Sep 2018 13:17:14 +0200 Message-Id: <20180901111716.1675-5-armbru@redhat.com> In-Reply-To: <20180901111716.1675-1-armbru@redhat.com> References: <20180901111716.1675-1-armbru@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Sat, 01 Sep 2018 11:17:20 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Sat, 01 Sep 2018 11:17:20 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'armbru@redhat.com' RCPT:'' Content-Transfer-Encoding: quoted-printable 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] [PULL 4/6] qmp: constify qmp_is_oob() 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: =?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-Type: text/plain; charset="utf-8" From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Markus Armbruster Message-Id: <20180829134043.31706-3-marcandre.lureau@redhat.com> Signed-off-by: Markus Armbruster --- include/qapi/qmp/dispatch.h | 2 +- qapi/qmp-dispatch.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/qapi/qmp/dispatch.h b/include/qapi/qmp/dispatch.h index 4e2e749faf..68a528a9aa 100644 --- a/include/qapi/qmp/dispatch.h +++ b/include/qapi/qmp/dispatch.h @@ -50,7 +50,7 @@ bool qmp_has_success_response(const QmpCommand *cmd); QDict *qmp_error_response(Error *err); QDict *qmp_dispatch(QmpCommandList *cmds, QObject *request, bool allow_oob); -bool qmp_is_oob(QDict *dict); +bool qmp_is_oob(const QDict *dict); =20 typedef void (*qmp_cmd_callback_fn)(QmpCommand *cmd, void *opaque); =20 diff --git a/qapi/qmp-dispatch.c b/qapi/qmp-dispatch.c index d8da1a62de..1d922e04f7 100644 --- a/qapi/qmp-dispatch.c +++ b/qapi/qmp-dispatch.c @@ -155,7 +155,7 @@ QDict *qmp_error_response(Error *err) /* * Does @qdict look like a command to be run out-of-band? */ -bool qmp_is_oob(QDict *dict) +bool qmp_is_oob(const QDict *dict) { return qdict_haskey(dict, "exec-oob") && !qdict_haskey(dict, "execute"); --=20 2.17.1 From nobody Wed Nov 5 16:49:02 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 1535800910519511.77193151567576; Sat, 1 Sep 2018 04:21:50 -0700 (PDT) Received: from localhost ([::1]:36569 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fw3yP-0001eM-F6 for importer@patchew.org; Sat, 01 Sep 2018 07:21:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50836) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fw3u8-0003Wy-FD for qemu-devel@nongnu.org; Sat, 01 Sep 2018 07:17:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fw3u7-0000kR-6c for qemu-devel@nongnu.org; Sat, 01 Sep 2018 07:17:24 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:48034 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 1fw3u7-0000k9-0i for qemu-devel@nongnu.org; Sat, 01 Sep 2018 07:17:23 -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 A2A0887A77 for ; Sat, 1 Sep 2018 11:17:22 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-191.ams2.redhat.com [10.36.116.191]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4AE6F2166B41; Sat, 1 Sep 2018 11:17:20 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id C7D70113853B; Sat, 1 Sep 2018 13:17:16 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Sat, 1 Sep 2018 13:17:15 +0200 Message-Id: <20180901111716.1675-6-armbru@redhat.com> In-Reply-To: <20180901111716.1675-1-armbru@redhat.com> References: <20180901111716.1675-1-armbru@redhat.com> MIME-Version: 1.0 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.1]); Sat, 01 Sep 2018 11:17:22 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Sat, 01 Sep 2018 11:17:22 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'armbru@redhat.com' RCPT:'' Content-Transfer-Encoding: quoted-printable 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] [PULL 5/6] Revert "qmp: isolate responses into io thread" 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: =?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-Type: text/plain; charset="utf-8" From: Marc-Andr=C3=A9 Lureau This reverts commit abe3cd0ff7f774966da6842620806ab7576fe4f3. There is no need to add an additional queue to send the reply to the IOThread, because QMP response is thread safe, and chardev write path is thread safe. It will schedule the watcher in the associated IOThread. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Markus Armbruster Message-Id: <20180829134043.31706-4-marcandre.lureau@redhat.com> Signed-off-by: Markus Armbruster --- monitor.c | 120 ++---------------------------------------------------- 1 file changed, 3 insertions(+), 117 deletions(-) diff --git a/monitor.c b/monitor.c index bd0810df4d..25f656bf8a 100644 --- a/monitor.c +++ b/monitor.c @@ -182,8 +182,6 @@ typedef struct { QemuMutex qmp_queue_lock; /* Input queue that holds all the parsed QMP requests */ GQueue *qmp_requests; - /* Output queue contains all the QMP responses in order */ - GQueue *qmp_responses; } MonitorQMP; =20 /* @@ -247,9 +245,6 @@ IOThread *mon_iothread; /* Bottom half to dispatch the requests received from I/O thread */ QEMUBH *qmp_dispatcher_bh; =20 -/* Bottom half to deliver the responses back to clients */ -QEMUBH *qmp_respond_bh; - struct QMPRequest { /* Owner of the request */ Monitor *mon; @@ -375,19 +370,10 @@ static void monitor_qmp_cleanup_req_queue_locked(Moni= tor *mon) } } =20 -/* Caller must hold the mon->qmp.qmp_queue_lock */ -static void monitor_qmp_cleanup_resp_queue_locked(Monitor *mon) -{ - while (!g_queue_is_empty(mon->qmp.qmp_responses)) { - qobject_unref((QDict *)g_queue_pop_head(mon->qmp.qmp_responses)); - } -} - static void monitor_qmp_cleanup_queues(Monitor *mon) { qemu_mutex_lock(&mon->qmp.qmp_queue_lock); monitor_qmp_cleanup_req_queue_locked(mon); - monitor_qmp_cleanup_resp_queue_locked(mon); qemu_mutex_unlock(&mon->qmp.qmp_queue_lock); } =20 @@ -518,85 +504,6 @@ static void qmp_send_response(Monitor *mon, const QDic= t *rsp) qobject_unref(json); } =20 -static void qmp_queue_response(Monitor *mon, QDict *rsp) -{ - if (mon->use_io_thread) { - /* - * Push a reference to the response queue. The I/O thread - * drains that queue and emits. - */ - qemu_mutex_lock(&mon->qmp.qmp_queue_lock); - g_queue_push_tail(mon->qmp.qmp_responses, qobject_ref(rsp)); - qemu_mutex_unlock(&mon->qmp.qmp_queue_lock); - qemu_bh_schedule(qmp_respond_bh); - } else { - /* - * Not using monitor I/O thread, i.e. we are in the main thread. - * Emit right away. - */ - qmp_send_response(mon, rsp); - } -} - -struct QMPResponse { - Monitor *mon; - QDict *data; -}; -typedef struct QMPResponse QMPResponse; - -static QDict *monitor_qmp_response_pop_one(Monitor *mon) -{ - QDict *data; - - qemu_mutex_lock(&mon->qmp.qmp_queue_lock); - data =3D g_queue_pop_head(mon->qmp.qmp_responses); - qemu_mutex_unlock(&mon->qmp.qmp_queue_lock); - - return data; -} - -static void monitor_qmp_response_flush(Monitor *mon) -{ - QDict *data; - - while ((data =3D monitor_qmp_response_pop_one(mon))) { - qmp_send_response(mon, data); - qobject_unref(data); - } -} - -/* - * Pop a QMPResponse from any monitor's response queue into @response. - * Return false if all the queues are empty; else true. - */ -static bool monitor_qmp_response_pop_any(QMPResponse *response) -{ - Monitor *mon; - QDict *data =3D NULL; - - qemu_mutex_lock(&monitor_lock); - QTAILQ_FOREACH(mon, &mon_list, entry) { - data =3D monitor_qmp_response_pop_one(mon); - if (data) { - response->mon =3D mon; - response->data =3D data; - break; - } - } - qemu_mutex_unlock(&monitor_lock); - return data !=3D NULL; -} - -static void monitor_qmp_bh_responder(void *opaque) -{ - QMPResponse response; - - while (monitor_qmp_response_pop_any(&response)) { - qmp_send_response(response.mon, response.data); - qobject_unref(response.data); - } -} - static MonitorQAPIEventConf monitor_qapi_event_conf[QAPI_EVENT__MAX] =3D { /* Limit guest-triggerable events to 1 per second */ [QAPI_EVENT_RTC_CHANGE] =3D { 1000 * SCALE_MS }, @@ -620,7 +527,7 @@ static void monitor_qapi_event_emit(QAPIEvent event, QD= ict *qdict) QTAILQ_FOREACH(mon, &mon_list, entry) { if (monitor_is_qmp(mon) && mon->qmp.commands !=3D &qmp_cap_negotiation_commands) { - qmp_queue_response(mon, qdict); + qmp_send_response(mon, qdict); } } } @@ -818,7 +725,6 @@ static void monitor_data_init(Monitor *mon, bool skip_f= lush, mon->skip_flush =3D skip_flush; mon->use_io_thread =3D use_io_thread; mon->qmp.qmp_requests =3D g_queue_new(); - mon->qmp.qmp_responses =3D g_queue_new(); } =20 static void monitor_data_destroy(Monitor *mon) @@ -833,9 +739,7 @@ static void monitor_data_destroy(Monitor *mon) qemu_mutex_destroy(&mon->mon_lock); qemu_mutex_destroy(&mon->qmp.qmp_queue_lock); monitor_qmp_cleanup_req_queue_locked(mon); - monitor_qmp_cleanup_resp_queue_locked(mon); g_queue_free(mon->qmp.qmp_requests); - g_queue_free(mon->qmp.qmp_responses); } =20 char *qmp_human_monitor_command(const char *command_line, bool has_cpu_ind= ex, @@ -4152,7 +4056,7 @@ static void monitor_qmp_respond(Monitor *mon, QDict *= rsp, QObject *id) qdict_put_obj(rsp, "id", qobject_ref(id)); } =20 - qmp_queue_response(mon, rsp); + qmp_send_response(mon, rsp); } } =20 @@ -4445,7 +4349,7 @@ static void monitor_qmp_event(void *opaque, int event) mon->qmp.commands =3D &qmp_cap_negotiation_commands; monitor_qmp_caps_reset(mon); data =3D qmp_greeting(mon); - qmp_queue_response(mon, data); + qmp_send_response(mon, data); qobject_unref(data); mon_refcount++; break; @@ -4456,7 +4360,6 @@ static void monitor_qmp_event(void *opaque, int event) * stdio, it's possible that stdout is still open when stdin * is closed. */ - monitor_qmp_response_flush(mon); monitor_qmp_cleanup_queues(mon); json_message_parser_destroy(&mon->qmp.parser); json_message_parser_init(&mon->qmp.parser, handle_qmp_command, @@ -4559,15 +4462,6 @@ static void monitor_iothread_init(void) qmp_dispatcher_bh =3D aio_bh_new(iohandler_get_aio_context(), monitor_qmp_bh_dispatcher, NULL); - - /* - * The responder BH must be run in the monitor I/O thread, so that - * monitors that are using the I/O thread have their output - * written by the I/O thread. - */ - qmp_respond_bh =3D aio_bh_new(monitor_get_aio_context(), - monitor_qmp_bh_responder, - NULL); } =20 void monitor_init_globals(void) @@ -4714,12 +4608,6 @@ void monitor_cleanup(void) */ iothread_stop(mon_iothread); =20 - /* - * Flush all response queues. Note that even after this flush, - * data may remain in output buffers. - */ - monitor_qmp_bh_responder(NULL); - /* Flush output buffers and destroy monitors */ qemu_mutex_lock(&monitor_lock); QTAILQ_FOREACH_SAFE(mon, &mon_list, entry, next) { @@ -4733,8 +4621,6 @@ void monitor_cleanup(void) /* QEMUBHs needs to be deleted before destroying the I/O thread */ qemu_bh_delete(qmp_dispatcher_bh); qmp_dispatcher_bh =3D NULL; - qemu_bh_delete(qmp_respond_bh); - qmp_respond_bh =3D NULL; =20 iothread_destroy(mon_iothread); mon_iothread =3D NULL; --=20 2.17.1 From nobody Wed Nov 5 16:49:02 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 (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 153580077408277.6063468188122; Sat, 1 Sep 2018 04:19:34 -0700 (PDT) Received: from localhost ([::1]:36553 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fw3w3-0007XL-RN for importer@patchew.org; Sat, 01 Sep 2018 07:19:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50807) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fw3u7-0003UB-OR for qemu-devel@nongnu.org; Sat, 01 Sep 2018 07:17:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fw3u6-0000kI-Sj for qemu-devel@nongnu.org; Sat, 01 Sep 2018 07:17:23 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:48032 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 1fw3u6-0000k3-N4 for qemu-devel@nongnu.org; Sat, 01 Sep 2018 07:17:22 -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 6451C87A70 for ; Sat, 1 Sep 2018 11:17:22 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-191.ams2.redhat.com [10.36.116.191]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4B4E510FFE55; Sat, 1 Sep 2018 11:17:20 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id CE0331138408; Sat, 1 Sep 2018 13:17:16 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Sat, 1 Sep 2018 13:17:16 +0200 Message-Id: <20180901111716.1675-7-armbru@redhat.com> In-Reply-To: <20180901111716.1675-1-armbru@redhat.com> References: <20180901111716.1675-1-armbru@redhat.com> MIME-Version: 1.0 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.1]); Sat, 01 Sep 2018 11:17:22 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Sat, 01 Sep 2018 11:17:22 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'armbru@redhat.com' RCPT:'' Content-Transfer-Encoding: quoted-printable 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] [PULL 6/6] monitor: no need to save need_resume 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: =?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-Type: text/plain; charset="utf-8" From: Marc-Andr=C3=A9 Lureau There is no need for per-command need_resume granularity, it should resume after running an non-oob command on oob-disabled monitor. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Markus Armbruster Message-Id: <20180829134043.31706-5-marcandre.lureau@redhat.com> Signed-off-by: Markus Armbruster --- monitor.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/monitor.c b/monitor.c index 25f656bf8a..cf3b629cf7 100644 --- a/monitor.c +++ b/monitor.c @@ -256,12 +256,6 @@ struct QMPRequest { */ QObject *req; Error *err; - /* - * Whether we need to resume the monitor afterward. This flag is - * used to emulate the old QMP server behavior that the current - * command must be completed before execution of the next one. - */ - bool need_resume; }; typedef struct QMPRequest QMPRequest; =20 @@ -4131,11 +4125,14 @@ static void monitor_qmp_bh_dispatcher(void *data) { QMPRequest *req_obj =3D monitor_qmp_requests_pop_any(); QDict *rsp; + bool need_resume; =20 if (!req_obj) { return; } =20 + /* qmp_oob_enabled() might change after "qmp_capabilities" */ + need_resume =3D !qmp_oob_enabled(req_obj->mon); if (req_obj->req) { trace_monitor_qmp_cmd_in_band(qobject_get_try_str(req_obj->id) ?: = ""); monitor_qmp_dispatch(req_obj->mon, req_obj->req, req_obj->id); @@ -4147,7 +4144,7 @@ static void monitor_qmp_bh_dispatcher(void *data) qobject_unref(rsp); } =20 - if (req_obj->need_resume) { + if (need_resume) { /* Pairs with the monitor_suspend() in handle_qmp_command() */ monitor_resume(req_obj->mon); } @@ -4195,7 +4192,6 @@ static void handle_qmp_command(void *opaque, QObject = *req, Error *err) req_obj->id =3D id; req_obj->req =3D req; req_obj->err =3D err; - req_obj->need_resume =3D false; =20 /* Protect qmp_requests and fetching its length. */ qemu_mutex_lock(&mon->qmp.qmp_queue_lock); @@ -4208,7 +4204,6 @@ static void handle_qmp_command(void *opaque, QObject = *req, Error *err) */ if (!qmp_oob_enabled(mon)) { monitor_suspend(mon); - req_obj->need_resume =3D true; } else { /* Drop the request if queue is full. */ if (mon->qmp.qmp_requests->length >=3D QMP_REQ_QUEUE_LEN_MAX) { --=20 2.17.1