From nobody Tue Nov 4 15:13:49 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 1530694030214220.83466555511416; Wed, 4 Jul 2018 01:47:10 -0700 (PDT) Received: from localhost ([::1]:44690 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fadRL-00023G-GS for importer@patchew.org; Wed, 04 Jul 2018 04:47:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46239) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fadPY-0001AG-U3 for qemu-devel@nongnu.org; Wed, 04 Jul 2018 04:45:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fadPY-0005jv-3o for qemu-devel@nongnu.org; Wed, 04 Jul 2018 04:45:16 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:34366 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 1fadPX-0005jn-Nb for qemu-devel@nongnu.org; Wed, 04 Jul 2018 04:45:15 -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 3D885401DEA8 for ; Wed, 4 Jul 2018 08:45:15 +0000 (UTC) Received: from xz-mi.redhat.com (ovpn-12-35.pek2.redhat.com [10.72.12.35]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3B1AC2026D76; Wed, 4 Jul 2018 08:45:11 +0000 (UTC) From: Peter Xu To: qemu-devel@nongnu.org Date: Wed, 4 Jul 2018 16:44:59 +0800 Message-Id: <20180704084507.14560-2-peterx@redhat.com> In-Reply-To: <20180704084507.14560-1-peterx@redhat.com> References: <20180704084507.14560-1-peterx@redhat.com> 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.6]); Wed, 04 Jul 2018 08:45:15 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Wed, 04 Jul 2018 08:45:15 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.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] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH 1/9] 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: "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: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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. Signed-off-by: Peter Xu Reviewed-by: Markus Armbruster --- monitor.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/monitor.c b/monitor.c index 14af7b7ea6..0e3ac52d87 100644 --- a/monitor.c +++ b/monitor.c @@ -4583,15 +4583,10 @@ static void monitor_qmp_setup_handlers_bh(void *opa= que) 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); + /* Use @mon_iothread context */ + 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 Tue Nov 4 15:13:49 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 1530694185901486.3754272523746; Wed, 4 Jul 2018 01:49:45 -0700 (PDT) Received: from localhost ([::1]:44698 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fadTn-0003l5-Up for importer@patchew.org; Wed, 04 Jul 2018 04:49:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46255) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fadPc-0001CR-VX for qemu-devel@nongnu.org; Wed, 04 Jul 2018 04:45:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fadPb-0005kT-W0 for qemu-devel@nongnu.org; Wed, 04 Jul 2018 04:45:20 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:49272 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 1fadPb-0005kN-RH for qemu-devel@nongnu.org; Wed, 04 Jul 2018 04:45:19 -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 5FF5281A4EAD for ; Wed, 4 Jul 2018 08:45:19 +0000 (UTC) Received: from xz-mi.redhat.com (ovpn-12-35.pek2.redhat.com [10.72.12.35]) by smtp.corp.redhat.com (Postfix) with ESMTP id DE3472026D76; Wed, 4 Jul 2018 08:45:15 +0000 (UTC) From: Peter Xu To: qemu-devel@nongnu.org Date: Wed, 4 Jul 2018 16:45:00 +0800 Message-Id: <20180704084507.14560-3-peterx@redhat.com> In-Reply-To: <20180704084507.14560-1-peterx@redhat.com> References: <20180704084507.14560-1-peterx@redhat.com> 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.8]); Wed, 04 Jul 2018 08:45:19 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Wed, 04 Jul 2018 08:45:19 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.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] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH 2/9] qapi: allow build_params to return "void" 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: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" When there is no parameter at all for a function prototype, return "void" for the parameter list. This will happen after the next patch where we removed the Error* for some of the emit functions. Signed-off-by: Peter Xu --- scripts/qapi/common.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/qapi/common.py b/scripts/qapi/common.py index 8b6708dbf1..105c82742f 100644 --- a/scripts/qapi/common.py +++ b/scripts/qapi/common.py @@ -1963,7 +1963,7 @@ extern const QEnumLookup %(c_name)s_lookup; def build_params(arg_type, boxed, extra): if not arg_type: assert not boxed - return extra + return extra if extra else "void" ret =3D '' sep =3D '' if boxed: @@ -1980,7 +1980,7 @@ def build_params(arg_type, boxed, extra): c_name(memb.name)) if extra: ret +=3D sep + extra - return ret + return ret if ret else "void" =20 =20 # --=20 2.17.1 From nobody Tue Nov 4 15:13:49 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 1530694191853252.77586763832403; Wed, 4 Jul 2018 01:49:51 -0700 (PDT) Received: from localhost ([::1]:44699 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fadTt-0003om-Lj for importer@patchew.org; Wed, 04 Jul 2018 04:49:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46276) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fadPj-0001Jz-NO for qemu-devel@nongnu.org; Wed, 04 Jul 2018 04:45:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fadPg-0005oo-Nw for qemu-devel@nongnu.org; Wed, 04 Jul 2018 04:45:27 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:40410 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 1fadPg-0005oX-DB for qemu-devel@nongnu.org; Wed, 04 Jul 2018 04:45:24 -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 E4BE07262D for ; Wed, 4 Jul 2018 08:45:23 +0000 (UTC) Received: from xz-mi.redhat.com (ovpn-12-35.pek2.redhat.com [10.72.12.35]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2D0662026D76; Wed, 4 Jul 2018 08:45:19 +0000 (UTC) From: Peter Xu To: qemu-devel@nongnu.org Date: Wed, 4 Jul 2018 16:45:01 +0800 Message-Id: <20180704084507.14560-4-peterx@redhat.com> In-Reply-To: <20180704084507.14560-1-peterx@redhat.com> References: <20180704084507.14560-1-peterx@redhat.com> 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]); Wed, 04 Jul 2018 08:45:23 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Wed, 04 Jul 2018 08:45:23 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.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] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH 3/9] qapi: remove error checks for event emission 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: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" In the whole QAPI event emission code we're passing in an Error* object along the whole stack. That's never useful since it never fails after all. Remove that. Then, remove that parameter from all the callers to send an event. Suggested-by: Eric Blake Suggested-by: Markus Armbruster Signed-off-by: Peter Xu --- docs/devel/qapi-code-gen.txt | 6 ++---- include/qapi/qmp-event.h | 3 +-- block/block-backend.c | 8 +++----- block/qcow2.c | 2 +- block/quorum.c | 4 ++-- block/write-threshold.c | 3 +-- blockjob.c | 13 +++++-------- cpus.c | 8 ++++---- dump.c | 3 +-- hw/acpi/core.c | 2 +- hw/acpi/cpu.c | 2 +- hw/acpi/memory_hotplug.c | 5 ++--- hw/char/virtio-console.c | 3 +-- hw/core/qdev.c | 3 +-- hw/net/virtio-net.c | 2 +- hw/ppc/spapr_rtc.c | 2 +- hw/timer/mc146818rtc.c | 2 +- hw/virtio/virtio-balloon.c | 3 +-- hw/watchdog/watchdog.c | 15 +++++++-------- job.c | 2 +- migration/migration.c | 4 ++-- migration/ram.c | 2 +- monitor.c | 5 ++--- scsi/pr-manager-helper.c | 3 +-- tests/test-qmp-event.c | 11 +++++------ ui/spice-core.c | 10 ++++------ ui/vnc.c | 7 +++---- vl.c | 16 +++++++--------- scripts/qapi/events.py | 23 ++++++----------------- 29 files changed, 69 insertions(+), 103 deletions(-) diff --git a/docs/devel/qapi-code-gen.txt b/docs/devel/qapi-code-gen.txt index 8decd6f17d..fb43c64ab2 100644 --- a/docs/devel/qapi-code-gen.txt +++ b/docs/devel/qapi-code-gen.txt @@ -1327,10 +1327,9 @@ Example: $ cat qapi-generated/example-qapi-events.c [Uninteresting stuff omitted...] =20 - void qapi_event_send_my_event(Error **errp) + void qapi_event_send_my_event(void) { QDict *qmp; - Error *err =3D NULL; QMPEventFuncEmit emit; =20 emit =3D qmp_event_get_func_emit(); @@ -1340,9 +1339,8 @@ Example: =20 qmp =3D qmp_event_build_dict("MY_EVENT"); =20 - emit(EXAMPLE_QAPI_EVENT_MY_EVENT, qmp, &err); + emit(EXAMPLE_QAPI_EVENT_MY_EVENT, qmp); =20 - error_propagate(errp, err); qobject_unref(qmp); } =20 diff --git a/include/qapi/qmp-event.h b/include/qapi/qmp-event.h index 0c87ad833e..23e588ccf8 100644 --- a/include/qapi/qmp-event.h +++ b/include/qapi/qmp-event.h @@ -14,8 +14,7 @@ #ifndef QMP_EVENT_H #define QMP_EVENT_H =20 - -typedef void (*QMPEventFuncEmit)(unsigned event, QDict *dict, Error **errp= ); +typedef void (*QMPEventFuncEmit)(unsigned event, QDict *dict); =20 void qmp_event_set_func_emit(QMPEventFuncEmit emit); =20 diff --git a/block/block-backend.c b/block/block-backend.c index 6b75bca317..4c24faba18 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -980,8 +980,7 @@ void blk_dev_change_media_cb(BlockBackend *blk, bool lo= ad, Error **errp) =20 if (tray_was_open !=3D tray_is_open) { char *id =3D blk_get_attached_dev_id(blk); - qapi_event_send_device_tray_moved(blk_name(blk), id, tray_is_o= pen, - &error_abort); + qapi_event_send_device_tray_moved(blk_name(blk), id, tray_is_o= pen); g_free(id); } } @@ -1665,8 +1664,7 @@ static void send_qmp_error_event(BlockBackend *blk, qapi_event_send_block_io_error(blk_name(blk), !!bs, bs ? bdrv_get_node_name(bs) : NULL, opt= ype, action, blk_iostatus_is_enabled(blk), - error =3D=3D ENOSPC, strerror(error), - &error_abort); + error =3D=3D ENOSPC, strerror(error)); } =20 /* This is done by device models because, while the block layer knows @@ -1782,7 +1780,7 @@ void blk_eject(BlockBackend *blk, bool eject_flag) * the frontend experienced a tray event. */ id =3D blk_get_attached_dev_id(blk); qapi_event_send_device_tray_moved(blk_name(blk), id, - eject_flag, &error_abort); + eject_flag); g_free(id); } =20 diff --git a/block/qcow2.c b/block/qcow2.c index 2f9e58e0c4..0fcf5ae716 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -4570,7 +4570,7 @@ void qcow2_signal_corruption(BlockDriverState *bs, bo= ol fatal, int64_t offset, *node_name !=3D '\0', node_name, message, offset >=3D 0, offset, size >=3D 0, size, - fatal, &error_abort); + fatal); g_free(message); =20 if (fatal) { diff --git a/block/quorum.c b/block/quorum.c index 9152da8c58..eb526cc0f1 100644 --- a/block/quorum.c +++ b/block/quorum.c @@ -199,7 +199,7 @@ static void quorum_report_bad(QuorumOpType type, uint64= _t offset, } =20 qapi_event_send_quorum_report_bad(type, !!msg, msg, node_name, start_s= ector, - end_sector - start_sector, &error_ab= ort); + end_sector - start_sector); } =20 static void quorum_report_failure(QuorumAIOCB *acb) @@ -210,7 +210,7 @@ static void quorum_report_failure(QuorumAIOCB *acb) BDRV_SECTOR_SIZE); =20 qapi_event_send_quorum_failure(reference, start_sector, - end_sector - start_sector, &error_abort= ); + end_sector - start_sector); } =20 static int quorum_vote_error(QuorumAIOCB *acb); diff --git a/block/write-threshold.c b/block/write-threshold.c index 1d48fc2077..85b78dc2a9 100644 --- a/block/write-threshold.c +++ b/block/write-threshold.c @@ -63,8 +63,7 @@ static int coroutine_fn before_write_notify(NotifierWithR= eturn *notifier, qapi_event_send_block_write_threshold( bs->node_name, amount, - bs->write_threshold_offset, - &error_abort); + bs->write_threshold_offset); =20 /* autodisable to avoid flooding the monitor */ write_threshold_disable(bs); diff --git a/blockjob.c b/blockjob.c index be5903aa96..bf7ef48f98 100644 --- a/blockjob.c +++ b/blockjob.c @@ -315,8 +315,7 @@ static void block_job_event_cancelled(Notifier *n, void= *opaque) job->job.id, job->job.progress_total, job->job.progress_current, - job->speed, - &error_abort); + job->speed); } =20 static void block_job_event_completed(Notifier *n, void *opaque) @@ -338,8 +337,7 @@ static void block_job_event_completed(Notifier *n, void= *opaque) job->job.progress_current, job->speed, !!msg, - msg, - &error_abort); + msg); } =20 static void block_job_event_pending(Notifier *n, void *opaque) @@ -351,8 +349,7 @@ static void block_job_event_pending(Notifier *n, void *= opaque) } =20 qapi_event_send_block_job_pending(job_type(&job->job), - job->job.id, - &error_abort); + job->job.id); } =20 static void block_job_event_ready(Notifier *n, void *opaque) @@ -367,7 +364,7 @@ static void block_job_event_ready(Notifier *n, void *op= aque) job->job.id, job->job.progress_total, job->job.progress_current, - job->speed, &error_abort); + job->speed); } =20 =20 @@ -494,7 +491,7 @@ BlockErrorAction block_job_error_action(BlockJob *job, = BlockdevOnError on_err, qapi_event_send_block_job_error(job->job.id, is_read ? IO_OPERATION_TYPE_READ : IO_OPERATION_TYPE_WRITE, - action, &error_abort); + action); } if (action =3D=3D BLOCK_ERROR_ACTION_STOP) { job_pause(&job->job); diff --git a/cpus.c b/cpus.c index b5844b7103..488a2b5c62 100644 --- a/cpus.c +++ b/cpus.c @@ -1011,7 +1011,7 @@ static int do_vm_stop(RunState state, bool send_stop) runstate_set(state); vm_state_notify(0, state); if (send_stop) { - qapi_event_send_stop(&error_abort); + qapi_event_send_stop(); } } =20 @@ -2059,13 +2059,13 @@ int vm_prepare_start(void) * the STOP event. */ if (runstate_is_running()) { - qapi_event_send_stop(&error_abort); - qapi_event_send_resume(&error_abort); + qapi_event_send_stop(); + qapi_event_send_resume(); return -1; } =20 /* We are sending this now, but the CPUs will be resumed shortly later= */ - qapi_event_send_resume(&error_abort); + qapi_event_send_resume(); =20 replay_enable_events(); cpu_enable_ticks(); diff --git a/dump.c b/dump.c index 04467b353e..2d8f6b3231 100644 --- a/dump.c +++ b/dump.c @@ -1890,8 +1890,7 @@ static void dump_process(DumpState *s, Error **errp) /* should never fail */ assert(result); qapi_event_send_dump_completed(result, !!local_err, (local_err ? \ - error_get_pretty(local_err) : NULL), - &error_abort); + error_get_pretty(local_err) : NULL)); qapi_free_DumpQueryResult(result); =20 error_propagate(errp, local_err); diff --git a/hw/acpi/core.c b/hw/acpi/core.c index b8d39012cd..aafdc61648 100644 --- a/hw/acpi/core.c +++ b/hw/acpi/core.c @@ -570,7 +570,7 @@ static void acpi_pm1_cnt_write(ACPIREGS *ar, uint16_t v= al) break; default: if (sus_typ =3D=3D ar->pm1.cnt.s4_val) { /* S4 request */ - qapi_event_send_suspend_disk(&error_abort); + qapi_event_send_suspend_disk(); qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN= ); } break; diff --git a/hw/acpi/cpu.c b/hw/acpi/cpu.c index 5ae595ecbe..d19b7722f0 100644 --- a/hw/acpi/cpu.c +++ b/hw/acpi/cpu.c @@ -160,7 +160,7 @@ static void cpu_hotplug_wr(void *opaque, hwaddr addr, u= int64_t data, cdev =3D &cpu_st->devs[cpu_st->selector]; cdev->ost_status =3D data; info =3D acpi_cpu_device_status(cpu_st->selector, cdev); - qapi_event_send_acpi_device_ost(info, &error_abort); + qapi_event_send_acpi_device_ost(info); qapi_free_ACPIOSTInfo(info); trace_cpuhp_acpi_write_ost_status(cpu_st->selector, cdev->ost_status); diff --git a/hw/acpi/memory_hotplug.c b/hw/acpi/memory_hotplug.c index 0ff1712c4c..8c7c1013f3 100644 --- a/hw/acpi/memory_hotplug.c +++ b/hw/acpi/memory_hotplug.c @@ -161,7 +161,7 @@ static void acpi_memory_hotplug_write(void *opaque, hwa= ddr addr, uint64_t data, /* TODO: implement memory removal on guest signal */ =20 info =3D acpi_memory_device_status(mem_st->selector, mdev); - qapi_event_send_acpi_device_ost(info, &error_abort); + qapi_event_send_acpi_device_ost(info); qapi_free_ACPIOSTInfo(info); break; case 0x14: /* set is_* fields */ @@ -185,8 +185,7 @@ static void acpi_memory_hotplug_write(void *opaque, hwa= ddr addr, uint64_t data, if (local_err) { trace_mhp_acpi_pc_dimm_delete_failed(mem_st->selector); qapi_event_send_mem_unplug_error(dev->id, - error_get_pretty(local_er= r), - &error_abort); + error_get_pretty(local_er= r)); error_free(local_err); break; } diff --git a/hw/char/virtio-console.c b/hw/char/virtio-console.c index 679a824888..2cbe1d4ed5 100644 --- a/hw/char/virtio-console.c +++ b/hw/char/virtio-console.c @@ -114,8 +114,7 @@ static void set_guest_connected(VirtIOSerialPort *port,= int guest_connected) } =20 if (dev->id) { - qapi_event_send_vserport_change(dev->id, guest_connected, - &error_abort); + qapi_event_send_vserport_change(dev->id, guest_connected); } } =20 diff --git a/hw/core/qdev.c b/hw/core/qdev.c index cf0db4b6da..9cdef2ed98 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -996,8 +996,7 @@ static void device_finalize(Object *obj) if (dev->pending_deleted_event) { g_assert(dev->canonical_path); =20 - qapi_event_send_device_deleted(!!dev->id, dev->id, dev->canonical_= path, - &error_abort); + qapi_event_send_device_deleted(!!dev->id, dev->id, dev->canonical_= path); g_free(dev->canonical_path); dev->canonical_path =3D NULL; } diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index f154756e85..4bdd5b8532 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -329,7 +329,7 @@ static void rxfilter_notify(NetClientState *nc) if (nc->rxfilter_notify_enabled) { gchar *path =3D object_get_canonical_path(OBJECT(n->qdev)); qapi_event_send_nic_rx_filter_changed(!!n->netclient_name, - n->netclient_name, path, &er= ror_abort); + n->netclient_name, path); g_free(path); =20 /* disable event notification to avoid events flooding */ diff --git a/hw/ppc/spapr_rtc.c b/hw/ppc/spapr_rtc.c index a37360537e..cd049f389d 100644 --- a/hw/ppc/spapr_rtc.c +++ b/hw/ppc/spapr_rtc.c @@ -118,7 +118,7 @@ static void rtas_set_time_of_day(PowerPCCPU *cpu, sPAPR= MachineState *spapr, } =20 /* Generate a monitor event for the change */ - qapi_event_send_rtc_change(qemu_timedate_diff(&tm), &error_abort); + qapi_event_send_rtc_change(qemu_timedate_diff(&tm)); =20 host_ns =3D qemu_clock_get_ns(rtc_clock); =20 diff --git a/hw/timer/mc146818rtc.c b/hw/timer/mc146818rtc.c index 6f1f723b1f..b941aa1966 100644 --- a/hw/timer/mc146818rtc.c +++ b/hw/timer/mc146818rtc.c @@ -635,7 +635,7 @@ static void rtc_set_time(RTCState *s) s->base_rtc =3D mktimegm(&tm); s->last_update =3D qemu_clock_get_ns(rtc_clock); =20 - qapi_event_send_rtc_change(qemu_timedate_diff(&tm), &error_abort); + qapi_event_send_rtc_change(qemu_timedate_diff(&tm)); } =20 static void rtc_set_cmos(RTCState *s, const struct tm *tm) diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c index 1f7a87f094..fcd41d314e 100644 --- a/hw/virtio/virtio-balloon.c +++ b/hw/virtio/virtio-balloon.c @@ -367,8 +367,7 @@ static void virtio_balloon_set_config(VirtIODevice *vde= v, dev->actual =3D le32_to_cpu(config.actual); if (dev->actual !=3D oldactual) { qapi_event_send_balloon_change(vm_ram_size - - ((ram_addr_t) dev->actual << VIRTIO_BALLOON_PFN_SH= IFT), - &error_abort); + ((ram_addr_t) dev->actual << VIRTIO_BALLOON_PFN_SH= IFT)); } trace_virtio_balloon_set_config(dev->actual, oldactual); } diff --git a/hw/watchdog/watchdog.c b/hw/watchdog/watchdog.c index 6e8ba061d8..33e6c20184 100644 --- a/hw/watchdog/watchdog.c +++ b/hw/watchdog/watchdog.c @@ -102,17 +102,17 @@ void watchdog_perform_action(void) { switch (watchdog_action) { case WATCHDOG_ACTION_RESET: /* same as 'system_reset' in monitor */ - qapi_event_send_watchdog(WATCHDOG_ACTION_RESET, &error_abort); + qapi_event_send_watchdog(WATCHDOG_ACTION_RESET); qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET); break; =20 case WATCHDOG_ACTION_SHUTDOWN: /* same as 'system_powerdown' in monit= or */ - qapi_event_send_watchdog(WATCHDOG_ACTION_SHUTDOWN, &error_abort); + qapi_event_send_watchdog(WATCHDOG_ACTION_SHUTDOWN); qemu_system_powerdown_request(); break; =20 case WATCHDOG_ACTION_POWEROFF: /* same as 'quit' command in monitor */ - qapi_event_send_watchdog(WATCHDOG_ACTION_POWEROFF, &error_abort); + qapi_event_send_watchdog(WATCHDOG_ACTION_POWEROFF); exit(0); =20 case WATCHDOG_ACTION_PAUSE: /* same as 'stop' command in monitor */ @@ -120,22 +120,21 @@ void watchdog_perform_action(void) * you would get a deadlock. Bypass the problem. */ qemu_system_vmstop_request_prepare(); - qapi_event_send_watchdog(WATCHDOG_ACTION_PAUSE, &error_abort); + qapi_event_send_watchdog(WATCHDOG_ACTION_PAUSE); qemu_system_vmstop_request(RUN_STATE_WATCHDOG); break; =20 case WATCHDOG_ACTION_DEBUG: - qapi_event_send_watchdog(WATCHDOG_ACTION_DEBUG, &error_abort); + qapi_event_send_watchdog(WATCHDOG_ACTION_DEBUG); fprintf(stderr, "watchdog: timer fired\n"); break; =20 case WATCHDOG_ACTION_NONE: - qapi_event_send_watchdog(WATCHDOG_ACTION_NONE, &error_abort); + qapi_event_send_watchdog(WATCHDOG_ACTION_NONE); break; =20 case WATCHDOG_ACTION_INJECT_NMI: - qapi_event_send_watchdog(WATCHDOG_ACTION_INJECT_NMI, - &error_abort); + qapi_event_send_watchdog(WATCHDOG_ACTION_INJECT_NMI); nmi_monitor_handle(0, NULL); break; =20 diff --git a/job.c b/job.c index fa671b431a..03dfc59bcd 100644 --- a/job.c +++ b/job.c @@ -174,7 +174,7 @@ static void job_state_transition(Job *job, JobStatus s1) job->status =3D s1; =20 if (!job_is_internal(job) && s1 !=3D s0) { - qapi_event_send_job_status_change(job->id, job->status, &error_abo= rt); + qapi_event_send_job_status_change(job->id, job->status); } } =20 diff --git a/migration/migration.c b/migration/migration.c index 94d71f8b24..728d731433 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -203,7 +203,7 @@ void migration_incoming_state_destroy(void) static void migrate_generate_event(int new_state) { if (migrate_use_events()) { - qapi_event_send_migration(new_state, &error_abort); + qapi_event_send_migration(new_state); } } =20 @@ -301,7 +301,7 @@ void qemu_start_incoming_migration(const char *uri, Err= or **errp) { const char *p; =20 - qapi_event_send_migration(MIGRATION_STATUS_SETUP, &error_abort); + qapi_event_send_migration(MIGRATION_STATUS_SETUP); if (!strcmp(uri, "defer")) { deferred_incoming_migration(errp); } else if (strstart(uri, "tcp:", &p)) { diff --git a/migration/ram.c b/migration/ram.c index 1cd98d6398..830406bc4f 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -1661,7 +1661,7 @@ static void migration_bitmap_sync(RAMState *rs) rs->bytes_xfer_prev =3D bytes_xfer_now; } if (migrate_use_events()) { - qapi_event_send_migration_pass(ram_counters.dirty_sync_count, NULL= ); + qapi_event_send_migration_pass(ram_counters.dirty_sync_count); } } =20 diff --git a/monitor.c b/monitor.c index 0e3ac52d87..80cada1162 100644 --- a/monitor.c +++ b/monitor.c @@ -632,7 +632,7 @@ static void monitor_qapi_event_handler(void *opaque); * applying any rate limiting if required. */ static void -monitor_qapi_event_queue(QAPIEvent event, QDict *qdict, Error **errp) +monitor_qapi_event_queue(QAPIEvent event, QDict *qdict) { MonitorQAPIEventConf *evconf; MonitorQAPIEventState *evstate; @@ -4269,8 +4269,7 @@ static void handle_qmp_command(JSONMessageParser *par= ser, GQueue *tokens) * that command was dropped. */ qapi_event_send_command_dropped(id, - COMMAND_DROP_REASON_QUEUE_FULL, - &error_abort); + COMMAND_DROP_REASON_QUEUE_FULL= ); qmp_request_free(req_obj); return; } diff --git a/scsi/pr-manager-helper.c b/scsi/pr-manager-helper.c index 519a296905..fd119bd0c3 100644 --- a/scsi/pr-manager-helper.c +++ b/scsi/pr-manager-helper.c @@ -44,8 +44,7 @@ static void pr_manager_send_status_changed_event(PRManage= rHelper *pr_mgr) char *id =3D object_get_canonical_path_component(OBJECT(pr_mgr)); =20 if (id) { - qapi_event_send_pr_manager_status_changed(id, !!pr_mgr->ioc, - &error_abort); + qapi_event_send_pr_manager_status_changed(id, !!pr_mgr->ioc); } } =20 diff --git a/tests/test-qmp-event.c b/tests/test-qmp-event.c index 8677094ad1..9cddd72adb 100644 --- a/tests/test-qmp-event.c +++ b/tests/test-qmp-event.c @@ -95,7 +95,7 @@ static bool qdict_cmp_simple(QDict *a, QDict *b) =20 /* This function is hooked as final emit function, which can verify the correctness. */ -static void event_test_emit(test_QAPIEvent event, QDict *d, Error **errp) +static void event_test_emit(test_QAPIEvent event, QDict *d) { QDict *t; int64_t s, ms; @@ -156,7 +156,7 @@ static void test_event_a(TestEventData *data, QDict *d; d =3D data->expect; qdict_put_str(d, "event", "EVENT_A"); - qapi_event_send_event_a(&error_abort); + qapi_event_send_event_a(); } =20 static void test_event_b(TestEventData *data, @@ -165,7 +165,7 @@ static void test_event_b(TestEventData *data, QDict *d; d =3D data->expect; qdict_put_str(d, "event", "EVENT_B"); - qapi_event_send_event_b(&error_abort); + qapi_event_send_event_b(); } =20 static void test_event_c(TestEventData *data, @@ -191,7 +191,7 @@ static void test_event_c(TestEventData *data, qdict_put_str(d, "event", "EVENT_C"); qdict_put(d, "data", d_data); =20 - qapi_event_send_event_c(true, 1, true, &b, "test2", &error_abort); + qapi_event_send_event_c(true, 1, true, &b, "test2"); =20 g_free(b.string); } @@ -233,8 +233,7 @@ static void test_event_d(TestEventData *data, qdict_put_str(d, "event", "EVENT_D"); qdict_put(d, "data", d_data); =20 - qapi_event_send_event_d(&a, "test3", false, NULL, true, ENUM_ONE_VALUE= 3, - &error_abort); + qapi_event_send_event_d(&a, "test3", false, NULL, true, ENUM_ONE_VALUE= 3); =20 g_free(struct1.string); g_free(a.string); diff --git a/ui/spice-core.c b/ui/spice-core.c index f8c0878529..a4fbbc3898 100644 --- a/ui/spice-core.c +++ b/ui/spice-core.c @@ -218,8 +218,7 @@ static void channel_event(int event, SpiceChannelEventI= nfo *info) switch (event) { case SPICE_CHANNEL_EVENT_CONNECTED: qapi_event_send_spice_connected(qapi_SpiceServerInfo_base(server), - qapi_SpiceChannel_base(client), - &error_abort); + qapi_SpiceChannel_base(client)); break; case SPICE_CHANNEL_EVENT_INITIALIZED: if (auth) { @@ -228,13 +227,12 @@ static void channel_event(int event, SpiceChannelEven= tInfo *info) } add_channel_info(client, info); channel_list_add(info); - qapi_event_send_spice_initialized(server, client, &error_abort); + qapi_event_send_spice_initialized(server, client); break; case SPICE_CHANNEL_EVENT_DISCONNECTED: channel_list_del(info); qapi_event_send_spice_disconnected(qapi_SpiceServerInfo_base(serve= r), - qapi_SpiceChannel_base(client), - &error_abort); + qapi_SpiceChannel_base(client)); break; default: break; @@ -287,7 +285,7 @@ static void migrate_connect_complete_cb(SpiceMigrateIns= tance *sin) =20 static void migrate_end_complete_cb(SpiceMigrateInstance *sin) { - qapi_event_send_spice_migrate_completed(&error_abort); + qapi_event_send_spice_migrate_completed(); spice_migration_completed =3D true; } =20 diff --git a/ui/vnc.c b/ui/vnc.c index 359693238b..2345bd054a 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -296,14 +296,13 @@ static void vnc_qmp_event(VncState *vs, QAPIEvent eve= nt) =20 switch (event) { case QAPI_EVENT_VNC_CONNECTED: - qapi_event_send_vnc_connected(si, qapi_VncClientInfo_base(vs->info= ), - &error_abort); + qapi_event_send_vnc_connected(si, qapi_VncClientInfo_base(vs->info= )); break; case QAPI_EVENT_VNC_INITIALIZED: - qapi_event_send_vnc_initialized(si, vs->info, &error_abort); + qapi_event_send_vnc_initialized(si, vs->info); break; case QAPI_EVENT_VNC_DISCONNECTED: - qapi_event_send_vnc_disconnected(si, vs->info, &error_abort); + qapi_event_send_vnc_disconnected(si, vs->info); break; default: break; diff --git a/vl.c b/vl.c index 9442beee21..29b1830259 100644 --- a/vl.c +++ b/vl.c @@ -1646,8 +1646,7 @@ void qemu_system_reset(ShutdownCause reason) qemu_devices_reset(); } if (reason !=3D SHUTDOWN_CAUSE_SUBSYSTEM_RESET) { - qapi_event_send_reset(shutdown_caused_by_guest(reason), - &error_abort); + qapi_event_send_reset(shutdown_caused_by_guest(reason)); } cpu_synchronize_all_post_reset(); } @@ -1660,11 +1659,11 @@ void qemu_system_guest_panicked(GuestPanicInformati= on *info) current_cpu->crash_occurred =3D true; } qapi_event_send_guest_panicked(GUEST_PANIC_ACTION_PAUSE, - !!info, info, &error_abort); + !!info, info); vm_stop(RUN_STATE_GUEST_PANICKED); if (!no_shutdown) { qapi_event_send_guest_panicked(GUEST_PANIC_ACTION_POWEROFF, - !!info, info, &error_abort); + !!info, info); qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_PANIC); } =20 @@ -1705,7 +1704,7 @@ static void qemu_system_suspend(void) pause_all_vcpus(); notifier_list_notify(&suspend_notifiers, NULL); runstate_set(RUN_STATE_SUSPENDED); - qapi_event_send_suspend(&error_abort); + qapi_event_send_suspend(); } =20 void qemu_system_suspend_request(void) @@ -1775,7 +1774,7 @@ void qemu_system_shutdown_request(ShutdownCause reaso= n) =20 static void qemu_system_powerdown(void) { - qapi_event_send_powerdown(&error_abort); + qapi_event_send_powerdown(); notifier_list_notify(&powerdown_notifiers, NULL); } =20 @@ -1818,8 +1817,7 @@ static bool main_loop_should_exit(void) request =3D qemu_shutdown_requested(); if (request) { qemu_kill_report(); - qapi_event_send_shutdown(shutdown_caused_by_guest(request), - &error_abort); + qapi_event_send_shutdown(shutdown_caused_by_guest(request)); if (no_shutdown) { vm_stop(RUN_STATE_SHUTDOWN); } else { @@ -1842,7 +1840,7 @@ static bool main_loop_should_exit(void) notifier_list_notify(&wakeup_notifiers, &wakeup_reason); wakeup_reason =3D QEMU_WAKEUP_REASON_NONE; resume_all_vcpus(); - qapi_event_send_wakeup(&error_abort); + qapi_event_send_wakeup(); } if (qemu_powerdown_requested()) { qemu_system_powerdown(); diff --git a/scripts/qapi/events.py b/scripts/qapi/events.py index 5657524688..3953dc9837 100644 --- a/scripts/qapi/events.py +++ b/scripts/qapi/events.py @@ -18,7 +18,7 @@ from qapi.common import * def build_event_send_proto(name, arg_type, boxed): return 'void qapi_event_send_%(c_name)s(%(param)s)' % { 'c_name': c_name(name.lower()), - 'param': build_params(arg_type, boxed, 'Error **errp')} + 'param': build_params(arg_type, boxed, "")} =20 =20 def gen_event_send_decl(name, arg_type, boxed): @@ -70,7 +70,6 @@ def gen_event_send(name, arg_type, boxed, event_enum_name= ): %(proto)s { QDict *qmp; - Error *err =3D NULL; QMPEventFuncEmit emit; ''', proto=3Dbuild_event_send_proto(name, arg_type, boxed)) @@ -103,45 +102,35 @@ def gen_event_send(name, arg_type, boxed, event_enum_= name): ''') if not arg_type.is_implicit(): ret +=3D mcgen(''' - visit_type_%(c_name)s(v, "%(name)s", &arg, &err); + visit_type_%(c_name)s(v, "%(name)s", &arg, NULL); ''', name=3Dname, c_name=3Darg_type.c_name()) else: ret +=3D mcgen(''' =20 - visit_start_struct(v, "%(name)s", NULL, 0, &err); - if (err) { - goto out; - } - visit_type_%(c_name)s_members(v, ¶m, &err); - if (!err) { - visit_check_struct(v, &err); - } + visit_start_struct(v, "%(name)s", NULL, 0, NULL); + visit_type_%(c_name)s_members(v, ¶m, NULL); + visit_check_struct(v, NULL); visit_end_struct(v, NULL); ''', name=3Dname, c_name=3Darg_type.c_name()) ret +=3D mcgen(''' - if (err) { - goto out; - } =20 visit_complete(v, &obj); qdict_put_obj(qmp, "data", obj); ''') =20 ret +=3D mcgen(''' - emit(%(c_enum)s, qmp, &err); + emit(%(c_enum)s, qmp); =20 ''', c_enum=3Dc_enum_const(event_enum_name, name)) =20 if arg_type and not arg_type.is_empty(): ret +=3D mcgen(''' -out: visit_free(v); ''') ret +=3D mcgen(''' - error_propagate(errp, err); qobject_unref(qmp); } ''') --=20 2.17.1 From nobody Tue Nov 4 15:13:49 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 1530694051364298.7588418287377; Wed, 4 Jul 2018 01:47:31 -0700 (PDT) Received: from localhost ([::1]:44691 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fadRi-0002GP-IE for importer@patchew.org; Wed, 04 Jul 2018 04:47:30 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46290) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fadPl-0001M0-SO for qemu-devel@nongnu.org; Wed, 04 Jul 2018 04:45:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fadPk-0005q5-6b for qemu-devel@nongnu.org; Wed, 04 Jul 2018 04:45:29 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:45772 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 1fadPk-0005po-01 for qemu-devel@nongnu.org; Wed, 04 Jul 2018 04:45:28 -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 8A106CB9F5 for ; Wed, 4 Jul 2018 08:45:27 +0000 (UTC) Received: from xz-mi.redhat.com (ovpn-12-35.pek2.redhat.com [10.72.12.35]) by smtp.corp.redhat.com (Postfix) with ESMTP id 885D82026D76; Wed, 4 Jul 2018 08:45:24 +0000 (UTC) From: Peter Xu To: qemu-devel@nongnu.org Date: Wed, 4 Jul 2018 16:45:02 +0800 Message-Id: <20180704084507.14560-5-peterx@redhat.com> In-Reply-To: <20180704084507.14560-1-peterx@redhat.com> References: <20180704084507.14560-1-peterx@redhat.com> 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]); Wed, 04 Jul 2018 08:45:27 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.1]); Wed, 04 Jul 2018 08:45:27 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.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] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH 4/9] monitor: move need_resume flag into monitor struct 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: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" It was put into the request object to show whether we'll need to resume the monitor after dispatching the command. Now we move that into the monitor struct so that it might be even used in other places in the future, e.g., out-of-band message flow controls. One thing to mention is that there is no lock needed before when accessing the flag since the request object will always be owned by a single thread. After we move it into monitor struct we need to protect that flag since it might be accessed by multiple threads now. Renaming the qmp_queue_lock into qmp_lock to protect the flag as well. No functional change. Signed-off-by: Peter Xu --- monitor.c | 72 +++++++++++++++++++++++++++++++------------------------ 1 file changed, 41 insertions(+), 31 deletions(-) diff --git a/monitor.c b/monitor.c index 80cada1162..215029bc22 100644 --- a/monitor.c +++ b/monitor.c @@ -176,14 +176,20 @@ typedef struct { bool capab_offered[QMP_CAPABILITY__MAX]; /* capabilities offered */ bool capab[QMP_CAPABILITY__MAX]; /* offered and accepted */ /* - * Protects qmp request/response queue. + * Protects qmp request/response queue, and need_resume flag. * Take monitor_lock first when you need both. */ - QemuMutex qmp_queue_lock; + QemuMutex qmp_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; + /* + * 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; } MonitorQMP; =20 /* @@ -261,12 +267,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 @@ -367,7 +367,7 @@ static void qmp_request_free(QMPRequest *req) g_free(req); } =20 -/* Caller must hold mon->qmp.qmp_queue_lock */ +/* Caller must hold mon->qmp.qmp_lock */ static void monitor_qmp_cleanup_req_queue_locked(Monitor *mon) { while (!g_queue_is_empty(mon->qmp.qmp_requests)) { @@ -375,7 +375,7 @@ static void monitor_qmp_cleanup_req_queue_locked(Monito= r *mon) } } =20 -/* Caller must hold the mon->qmp.qmp_queue_lock */ +/* Caller must hold the mon->qmp.qmp_lock */ static void monitor_qmp_cleanup_resp_queue_locked(Monitor *mon) { while (!g_queue_is_empty(mon->qmp.qmp_responses)) { @@ -385,12 +385,23 @@ static void monitor_qmp_cleanup_resp_queue_locked(Mon= itor *mon) =20 static void monitor_qmp_cleanup_queues(Monitor *mon) { - qemu_mutex_lock(&mon->qmp.qmp_queue_lock); + qemu_mutex_lock(&mon->qmp.qmp_lock); monitor_qmp_cleanup_req_queue_locked(mon); monitor_qmp_cleanup_resp_queue_locked(mon); - qemu_mutex_unlock(&mon->qmp.qmp_queue_lock); + qemu_mutex_unlock(&mon->qmp.qmp_lock); } =20 +/* Try to resume the monitor if it was suspended due to any reason */ +static void monitor_qmp_try_resume(Monitor *mon) +{ + assert(monitor_is_qmp(mon)); + qemu_mutex_lock(&mon->qmp.qmp_lock); + if (mon->qmp.need_resume) { + monitor_resume(mon); + mon->qmp.need_resume =3D false; + } + qemu_mutex_unlock(&mon->qmp.qmp_lock); +} =20 static void monitor_flush_locked(Monitor *mon); =20 @@ -525,9 +536,9 @@ static void qmp_queue_response(Monitor *mon, QDict *rsp) * Push a reference to the response queue. The I/O thread * drains that queue and emits. */ - qemu_mutex_lock(&mon->qmp.qmp_queue_lock); + qemu_mutex_lock(&mon->qmp.qmp_lock); g_queue_push_tail(mon->qmp.qmp_responses, qobject_ref(rsp)); - qemu_mutex_unlock(&mon->qmp.qmp_queue_lock); + qemu_mutex_unlock(&mon->qmp.qmp_lock); qemu_bh_schedule(qmp_respond_bh); } else { /* @@ -548,9 +559,9 @@ static QDict *monitor_qmp_response_pop_one(Monitor *mon) { QDict *data; =20 - qemu_mutex_lock(&mon->qmp.qmp_queue_lock); + qemu_mutex_lock(&mon->qmp.qmp_lock); data =3D g_queue_pop_head(mon->qmp.qmp_responses); - qemu_mutex_unlock(&mon->qmp.qmp_queue_lock); + qemu_mutex_unlock(&mon->qmp.qmp_lock); =20 return data; } @@ -769,7 +780,7 @@ static void monitor_data_init(Monitor *mon, bool skip_f= lush, { memset(mon, 0, sizeof(Monitor)); qemu_mutex_init(&mon->mon_lock); - qemu_mutex_init(&mon->qmp.qmp_queue_lock); + qemu_mutex_init(&mon->qmp.qmp_lock); mon->outbuf =3D qstring_new(); /* Use *mon_cmds by default. */ mon->cmd_table =3D mon_cmds; @@ -789,7 +800,7 @@ static void monitor_data_destroy(Monitor *mon) readline_free(mon->rs); qobject_unref(mon->outbuf); qemu_mutex_destroy(&mon->mon_lock); - qemu_mutex_destroy(&mon->qmp.qmp_queue_lock); + qemu_mutex_destroy(&mon->qmp.qmp_lock); monitor_qmp_cleanup_req_queue_locked(mon); monitor_qmp_cleanup_resp_queue_locked(mon); g_queue_free(mon->qmp.qmp_requests); @@ -4151,9 +4162,9 @@ static QMPRequest *monitor_qmp_requests_pop_any(void) qemu_mutex_lock(&monitor_lock); =20 QTAILQ_FOREACH(mon, &mon_list, entry) { - qemu_mutex_lock(&mon->qmp.qmp_queue_lock); + qemu_mutex_lock(&mon->qmp.qmp_lock); req_obj =3D g_queue_pop_head(mon->qmp.qmp_requests); - qemu_mutex_unlock(&mon->qmp.qmp_queue_lock); + qemu_mutex_unlock(&mon->qmp.qmp_lock); if (req_obj) { break; } @@ -4176,26 +4187,26 @@ static QMPRequest *monitor_qmp_requests_pop_any(voi= d) static void monitor_qmp_bh_dispatcher(void *data) { QMPRequest *req_obj =3D monitor_qmp_requests_pop_any(); + Monitor *mon; QDict *rsp; =20 if (!req_obj) { return; } =20 + mon =3D 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); + monitor_qmp_dispatch(mon, req_obj->req, req_obj->id); } else { assert(req_obj->err); rsp =3D qmp_error_response(req_obj->err); - monitor_qmp_respond(req_obj->mon, rsp, NULL); + monitor_qmp_respond(mon, rsp, NULL); qobject_unref(rsp); } =20 - if (req_obj->need_resume) { - /* Pairs with the monitor_suspend() in handle_qmp_command() */ - monitor_resume(req_obj->mon); - } + monitor_qmp_try_resume(mon); + qmp_request_free(req_obj); =20 /* Reschedule instead of looping so the main loop stays responsive */ @@ -4244,10 +4255,9 @@ static void handle_qmp_command(JSONMessageParser *pa= rser, GQueue *tokens) 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); + qemu_mutex_lock(&mon->qmp.qmp_lock); =20 /* * If OOB is not enabled on the current monitor, we'll emulate the @@ -4257,11 +4267,11 @@ static void handle_qmp_command(JSONMessageParser *p= arser, GQueue *tokens) */ if (!qmp_oob_enabled(mon)) { monitor_suspend(mon); - req_obj->need_resume =3D true; + mon->qmp.need_resume =3D true; } else { /* Drop the request if queue is full. */ if (mon->qmp.qmp_requests->length >=3D QMP_REQ_QUEUE_LEN_MAX) { - qemu_mutex_unlock(&mon->qmp.qmp_queue_lock); + qemu_mutex_unlock(&mon->qmp.qmp_lock); /* * FIXME @id's scope is just @mon, and broadcasting it is * wrong. If another monitor's client has a command with @@ -4281,7 +4291,7 @@ static void handle_qmp_command(JSONMessageParser *par= ser, GQueue *tokens) * etc. will be delivered to the handler side. */ g_queue_push_tail(mon->qmp.qmp_requests, req_obj); - qemu_mutex_unlock(&mon->qmp.qmp_queue_lock); + qemu_mutex_unlock(&mon->qmp.qmp_lock); =20 /* Kick the dispatcher routine */ qemu_bh_schedule(qmp_dispatcher_bh); --=20 2.17.1 From nobody Tue Nov 4 15:13:49 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 1530694208116780.561258806169; Wed, 4 Jul 2018 01:50:08 -0700 (PDT) Received: from localhost ([::1]:44700 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fadUA-00040S-FY for importer@patchew.org; Wed, 04 Jul 2018 04:50:02 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46334) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fadPp-0001OK-4E for qemu-devel@nongnu.org; Wed, 04 Jul 2018 04:45:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fadPn-0005rL-Rf for qemu-devel@nongnu.org; Wed, 04 Jul 2018 04:45:33 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:40454 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 1fadPn-0005r9-LZ for qemu-devel@nongnu.org; Wed, 04 Jul 2018 04:45:31 -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 318F734698 for ; Wed, 4 Jul 2018 08:45:31 +0000 (UTC) Received: from xz-mi.redhat.com (ovpn-12-35.pek2.redhat.com [10.72.12.35]) by smtp.corp.redhat.com (Postfix) with ESMTP id 317132026D76; Wed, 4 Jul 2018 08:45:27 +0000 (UTC) From: Peter Xu To: qemu-devel@nongnu.org Date: Wed, 4 Jul 2018 16:45:03 +0800 Message-Id: <20180704084507.14560-6-peterx@redhat.com> In-Reply-To: <20180704084507.14560-1-peterx@redhat.com> References: <20180704084507.14560-1-peterx@redhat.com> 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]); Wed, 04 Jul 2018 08:45:31 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Wed, 04 Jul 2018 08:45:31 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.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] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH 5/9] monitor: suspend monitor instead of send CMD_DROP 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: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" When we received too many qmp commands, previously we'll send COMMAND_DROPPED events to monitors, then we'll drop the requests. It can only solve the flow control of the request queue, however it'll not really work since we might queue unlimited events in the response queue which is a potential risk. Now instead of sending such an event, we stop consuming the client input when we noticed that the queue is reaching its limitation before hand. Then after we handled commands, we'll try to resume the monitor when needed. Signed-off-by: Peter Xu --- monitor.c | 46 ++++++++++++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/monitor.c b/monitor.c index 215029bc22..ebf862914f 100644 --- a/monitor.c +++ b/monitor.c @@ -164,6 +164,8 @@ struct MonFdset { QLIST_ENTRY(MonFdset) next; }; =20 +#define QMP_REQ_QUEUE_LEN_MAX (8) + typedef struct { JSONMessageParser parser; /* @@ -396,10 +398,21 @@ static void monitor_qmp_try_resume(Monitor *mon) { assert(monitor_is_qmp(mon)); qemu_mutex_lock(&mon->qmp.qmp_lock); + + if (mon->qmp.qmp_requests->length >=3D QMP_REQ_QUEUE_LEN_MAX) { + /* + * This should not happen, but in case if it happens, we + * should still keep the monitor in suspend state + */ + qemu_mutex_unlock(&mon->qmp.qmp_lock); + return; + } + if (mon->qmp.need_resume) { monitor_resume(mon); mon->qmp.need_resume =3D false; } + qemu_mutex_unlock(&mon->qmp.qmp_lock); } =20 @@ -4213,7 +4226,14 @@ static void monitor_qmp_bh_dispatcher(void *data) qemu_bh_schedule(qmp_dispatcher_bh); } =20 -#define QMP_REQ_QUEUE_LEN_MAX (8) +/* Called with Monitor.qmp.qmp_lock held. */ +static void monitor_qmp_suspend_locked(Monitor *mon) +{ + assert(monitor_is_qmp(mon)); + assert(mon->qmp.need_resume =3D=3D false); + monitor_suspend(mon); + mon->qmp.need_resume =3D true; +} =20 static void handle_qmp_command(JSONMessageParser *parser, GQueue *tokens) { @@ -4266,22 +4286,16 @@ static void handle_qmp_command(JSONMessageParser *p= arser, GQueue *tokens) * OOB is not enabled, the server will never drop any command. */ if (!qmp_oob_enabled(mon)) { - monitor_suspend(mon); - mon->qmp.need_resume =3D true; + monitor_qmp_suspend_locked(mon); } else { - /* Drop the request if queue is full. */ - if (mon->qmp.qmp_requests->length >=3D QMP_REQ_QUEUE_LEN_MAX) { - qemu_mutex_unlock(&mon->qmp.qmp_lock); - /* - * FIXME @id's scope is just @mon, and broadcasting it is - * wrong. If another monitor's client has a command with - * the same ID in flight, the event will incorrectly claim - * that command was dropped. - */ - qapi_event_send_command_dropped(id, - COMMAND_DROP_REASON_QUEUE_FULL= ); - qmp_request_free(req_obj); - return; + /* + * If the queue is reaching the length limitation, we queue + * this command, meanwhile we suspend the monitor to block new + * commands. We'll resume ourselves until the queue has more + * space. + */ + if (mon->qmp.qmp_requests->length >=3D QMP_REQ_QUEUE_LEN_MAX - 1) { + monitor_qmp_suspend_locked(mon); } } =20 --=20 2.17.1 From nobody Tue Nov 4 15:13:49 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 1530694344093536.7985049912357; Wed, 4 Jul 2018 01:52:24 -0700 (PDT) Received: from localhost ([::1]:44714 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fadWR-0005tV-BK for importer@patchew.org; Wed, 04 Jul 2018 04:52:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46357) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fadPs-0001Oz-6i for qemu-devel@nongnu.org; Wed, 04 Jul 2018 04:45:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fadPr-0005vx-Bg for qemu-devel@nongnu.org; Wed, 04 Jul 2018 04:45:36 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:50978 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 1fadPr-0005v8-5p for qemu-devel@nongnu.org; Wed, 04 Jul 2018 04:45:35 -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 B73B14075E3C for ; Wed, 4 Jul 2018 08:45:34 +0000 (UTC) Received: from xz-mi.redhat.com (ovpn-12-35.pek2.redhat.com [10.72.12.35]) by smtp.corp.redhat.com (Postfix) with ESMTP id C430B2026D76; Wed, 4 Jul 2018 08:45:31 +0000 (UTC) From: Peter Xu To: qemu-devel@nongnu.org Date: Wed, 4 Jul 2018 16:45:04 +0800 Message-Id: <20180704084507.14560-7-peterx@redhat.com> In-Reply-To: <20180704084507.14560-1-peterx@redhat.com> References: <20180704084507.14560-1-peterx@redhat.com> 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.5]); Wed, 04 Jul 2018 08:45:34 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Wed, 04 Jul 2018 08:45:34 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.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] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH 6/9] qapi: remove COMMAND_DROPPED event 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: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Now it was not used any more. Drop it, especially if we can do that before we release QEMU 3.0. Signed-off-by: Peter Xu --- qapi/misc.json | 40 ---------------------------------------- 1 file changed, 40 deletions(-) diff --git a/qapi/misc.json b/qapi/misc.json index f1860418e8..ceda21746b 100644 --- a/qapi/misc.json +++ b/qapi/misc.json @@ -3432,46 +3432,6 @@ ## { 'command': 'query-sev-capabilities', 'returns': 'SevCapability' } =20 -## -# @CommandDropReason: -# -# Reasons that caused one command to be dropped. -# -# @queue-full: the command queue is full. This can only occur when -# the client sends a new non-oob command before the -# response to the previous non-oob command has been -# received. -# -# Since: 2.12 -## -{ 'enum': 'CommandDropReason', - 'data': [ 'queue-full' ] } - -## -# @COMMAND_DROPPED: -# -# Emitted when a command is dropped due to some reason. Commands can -# only be dropped when the oob capability is enabled. -# -# @id: The dropped command's "id" field. -# FIXME Broken by design. Events are broadcast to all monitors. If -# another monitor's client has a command with the same ID in flight, -# the event will incorrectly claim that command was dropped. -# -# @reason: The reason why the command is dropped. -# -# Since: 2.12 -# -# Example: -# -# { "event": "COMMAND_DROPPED", -# "data": {"result": {"id": "libvirt-102", -# "reason": "queue-full" } } } -# -## -{ 'event': 'COMMAND_DROPPED' , - 'data': { 'id': 'any', 'reason': 'CommandDropReason' } } - ## # @set-numa-node: # --=20 2.17.1 From nobody Tue Nov 4 15:13:49 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 153069432285814.221728980105354; Wed, 4 Jul 2018 01:52:02 -0700 (PDT) Received: from localhost ([::1]:44712 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fadW6-0005eQ-1d for importer@patchew.org; Wed, 04 Jul 2018 04:52:02 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46373) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fadPy-0001Qp-2e for qemu-devel@nongnu.org; Wed, 04 Jul 2018 04:45:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fadPu-00060j-Vh for qemu-devel@nongnu.org; Wed, 04 Jul 2018 04:45:42 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:34132 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 1fadPu-0005zz-Ps for qemu-devel@nongnu.org; Wed, 04 Jul 2018 04:45:38 -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 540964078BBB for ; Wed, 4 Jul 2018 08:45:38 +0000 (UTC) Received: from xz-mi.redhat.com (ovpn-12-35.pek2.redhat.com [10.72.12.35]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5A5ED2026D76; Wed, 4 Jul 2018 08:45:35 +0000 (UTC) From: Peter Xu To: qemu-devel@nongnu.org Date: Wed, 4 Jul 2018 16:45:05 +0800 Message-Id: <20180704084507.14560-8-peterx@redhat.com> In-Reply-To: <20180704084507.14560-1-peterx@redhat.com> References: <20180704084507.14560-1-peterx@redhat.com> 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.7]); Wed, 04 Jul 2018 08:45:38 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 04 Jul 2018 08:45:38 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.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] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH 7/9] monitor: restrict response queue length too 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: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Before this patch we were only monitoring the request queue, but it's still possible that a client only sends requests but it never eats any reply from us. In that case our response queue might grow with unlimited responses and put us at risk. Now we play the similar trick as we have done to the request queue to make sure we apply the same queue length rule to the response queue as well. Then we also need to peek at the queue length after we unqueue a response now, to make sure we'll kick the monitor to alive if it was suspended due to "response queue full". Reported-by: Markus Armbruster Signed-off-by: Peter Xu --- monitor.c | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/monitor.c b/monitor.c index ebf862914f..9b78cf1c63 100644 --- a/monitor.c +++ b/monitor.c @@ -393,18 +393,15 @@ static void monitor_qmp_cleanup_queues(Monitor *mon) qemu_mutex_unlock(&mon->qmp.qmp_lock); } =20 -/* Try to resume the monitor if it was suspended due to any reason */ -static void monitor_qmp_try_resume(Monitor *mon) +/* Callers must be with Monitor.qmp.qmp_lock held. */ +static void monitor_qmp_try_resume_locked(Monitor *mon) { - assert(monitor_is_qmp(mon)); - qemu_mutex_lock(&mon->qmp.qmp_lock); - - if (mon->qmp.qmp_requests->length >=3D QMP_REQ_QUEUE_LEN_MAX) { + if (mon->qmp.qmp_requests->length >=3D QMP_REQ_QUEUE_LEN_MAX || + mon->qmp.qmp_responses->length >=3D QMP_REQ_QUEUE_LEN_MAX) { /* * This should not happen, but in case if it happens, we * should still keep the monitor in suspend state */ - qemu_mutex_unlock(&mon->qmp.qmp_lock); return; } =20 @@ -412,7 +409,14 @@ static void monitor_qmp_try_resume(Monitor *mon) monitor_resume(mon); mon->qmp.need_resume =3D false; } +} =20 +/* Try to resume the monitor if it was suspended due to any reason */ +static void monitor_qmp_try_resume(Monitor *mon) +{ + assert(monitor_is_qmp(mon)); + qemu_mutex_lock(&mon->qmp.qmp_lock); + monitor_qmp_try_resume_locked(mon); qemu_mutex_unlock(&mon->qmp.qmp_lock); } =20 @@ -574,6 +578,8 @@ static QDict *monitor_qmp_response_pop_one(Monitor *mon) =20 qemu_mutex_lock(&mon->qmp.qmp_lock); data =3D g_queue_pop_head(mon->qmp.qmp_responses); + /* In case if we were suspended due to response queue full */ + monitor_qmp_try_resume_locked(mon); qemu_mutex_unlock(&mon->qmp.qmp_lock); =20 return data; @@ -4289,12 +4295,13 @@ static void handle_qmp_command(JSONMessageParser *p= arser, GQueue *tokens) monitor_qmp_suspend_locked(mon); } else { /* - * If the queue is reaching the length limitation, we queue - * this command, meanwhile we suspend the monitor to block new - * commands. We'll resume ourselves until the queue has more - * space. + * If any of the req/resp queue is reaching the length + * limitation, we queue this command, meanwhile we suspend the + * monitor to block new commands. We'll resume ourselves + * until both of the queues have more spaces. */ - if (mon->qmp.qmp_requests->length >=3D QMP_REQ_QUEUE_LEN_MAX - 1) { + if (mon->qmp.qmp_requests->length >=3D QMP_REQ_QUEUE_LEN_MAX - 1 || + mon->qmp.qmp_responses->length >=3D QMP_REQ_QUEUE_LEN_MAX - 1)= { monitor_qmp_suspend_locked(mon); } } --=20 2.17.1 From nobody Tue Nov 4 15:13:49 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 1530694334663675.4058252455895; Wed, 4 Jul 2018 01:52:14 -0700 (PDT) Received: from localhost ([::1]:44713 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fadWE-0005lG-SU for importer@patchew.org; Wed, 04 Jul 2018 04:52:10 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46384) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fadQ0-0001Sn-06 for qemu-devel@nongnu.org; Wed, 04 Jul 2018 04:45:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fadPy-00066L-QD for qemu-devel@nongnu.org; Wed, 04 Jul 2018 04:45:44 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:34136 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 1fadPy-00065S-K1 for qemu-devel@nongnu.org; Wed, 04 Jul 2018 04:45:42 -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 06C8F4078BBB for ; Wed, 4 Jul 2018 08:45:42 +0000 (UTC) Received: from xz-mi.redhat.com (ovpn-12-35.pek2.redhat.com [10.72.12.35]) by smtp.corp.redhat.com (Postfix) with ESMTP id EDA5B2026D76; Wed, 4 Jul 2018 08:45:38 +0000 (UTC) From: Peter Xu To: qemu-devel@nongnu.org Date: Wed, 4 Jul 2018 16:45:06 +0800 Message-Id: <20180704084507.14560-9-peterx@redhat.com> In-Reply-To: <20180704084507.14560-1-peterx@redhat.com> References: <20180704084507.14560-1-peterx@redhat.com> 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.7]); Wed, 04 Jul 2018 08:45:42 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 04 Jul 2018 08:45:42 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.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] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH 8/9] monitor: remove "x-oob", turn oob on by default 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: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" OOB commands were introduced in commit cf869d53172. Unfortunately, we ran into a regression, and had to disable them by default for 2.12 (commit be933ffc23). http://lists.gnu.org/archive/html/qemu-devel/2018-03/msg06231.html The regression has since been fixed (commit 951702f39c7 "monitor: bind dispatch bh to iohandler context"). Time to re-enable OOB. This patch partly reverts be933ffc23 (monitor: new parameter "x-oob"), and turns it on again for non-MUX QMPs. Note that we can't enable Out-Of-Band for monitors with MUX-typed chardev backends, because not all the chardev frontends can run without main thread, or can run in multiple threads. Some trivial touch-up in the test code is required to make sure qmp-test won't break. Reviewed-by: Markus Armbruster Signed-off-by: Peter Xu --- include/monitor/monitor.h | 1 - monitor.c | 22 ++++++---------------- tests/libqtest.c | 2 +- tests/qmp-test.c | 2 +- vl.c | 5 ----- 5 files changed, 8 insertions(+), 24 deletions(-) diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h index d6ab70cae2..0cb0538a31 100644 --- a/include/monitor/monitor.h +++ b/include/monitor/monitor.h @@ -13,7 +13,6 @@ extern Monitor *cur_mon; #define MONITOR_USE_READLINE 0x02 #define MONITOR_USE_CONTROL 0x04 #define MONITOR_USE_PRETTY 0x08 -#define MONITOR_USE_OOB 0x10 =20 bool monitor_cur_is_qmp(void); =20 diff --git a/monitor.c b/monitor.c index 9b78cf1c63..9eb9f06599 100644 --- a/monitor.c +++ b/monitor.c @@ -4626,19 +4626,12 @@ void monitor_init(Chardev *chr, int flags) { Monitor *mon =3D g_malloc(sizeof(*mon)); bool use_readline =3D flags & MONITOR_USE_READLINE; - bool use_oob =3D flags & MONITOR_USE_OOB; - - if (use_oob) { - if (CHARDEV_IS_MUX(chr)) { - error_report("Monitor out-of-band is not supported with " - "MUX typed chardev backend"); - exit(1); - } - if (use_readline) { - error_report("Monitor out-of-band is only supported by QMP"); - exit(1); - } - } + /* + * Note: we can't enable Out-Of-Band for monitors with MUX-typed + * chardev backends, because not all the chardev frontends can run + * without main thread, or can run in multiple threads. + */ + bool use_oob =3D (flags & MONITOR_USE_CONTROL) && !CHARDEV_IS_MUX(chr); =20 monitor_data_init(mon, false, use_oob); =20 @@ -4735,9 +4728,6 @@ QemuOptsList qemu_mon_opts =3D { },{ .name =3D "pretty", .type =3D QEMU_OPT_BOOL, - },{ - .name =3D "x-oob", - .type =3D QEMU_OPT_BOOL, }, { /* end of list */ } }, diff --git a/tests/libqtest.c b/tests/libqtest.c index 098af6aec4..c5cb3f925c 100644 --- a/tests/libqtest.c +++ b/tests/libqtest.c @@ -213,7 +213,7 @@ QTestState *qtest_init_without_qmp_handshake(bool use_o= ob, "-display none " "%s", qemu_binary, socket_path, getenv("QTEST_LOG") ? "/dev/fd/2" : "/de= v/null", - qmp_socket_path, use_oob ? ",x-oob=3Don"= : "", + qmp_socket_path, "", extra_args ?: ""); execlp("/bin/sh", "sh", "-c", command, NULL); exit(1); diff --git a/tests/qmp-test.c b/tests/qmp-test.c index 57c1296573..033d610b0e 100644 --- a/tests/qmp-test.c +++ b/tests/qmp-test.c @@ -89,7 +89,7 @@ static void test_qmp_protocol(void) g_assert(q); test_version(qdict_get(q, "version")); capabilities =3D qdict_get_qlist(q, "capabilities"); - g_assert(capabilities && qlist_empty(capabilities)); + g_assert(capabilities); qobject_unref(resp); =20 /* Test valid command before handshake */ diff --git a/vl.c b/vl.c index 29b1830259..e087cc1b72 100644 --- a/vl.c +++ b/vl.c @@ -2322,11 +2322,6 @@ static int mon_init_func(void *opaque, QemuOpts *opt= s, Error **errp) if (qemu_opt_get_bool(opts, "pretty", 0)) flags |=3D MONITOR_USE_PRETTY; =20 - /* OOB is off by default */ - if (qemu_opt_get_bool(opts, "x-oob", 0)) { - flags |=3D MONITOR_USE_OOB; - } - chardev =3D qemu_opt_get(opts, "chardev"); chr =3D qemu_chr_find(chardev); if (chr =3D=3D NULL) { --=20 2.17.1 From nobody Tue Nov 4 15:13:49 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 1530694452123584.1868481347806; Wed, 4 Jul 2018 01:54:12 -0700 (PDT) Received: from localhost ([::1]:44724 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fadYB-0007H0-Ef for importer@patchew.org; Wed, 04 Jul 2018 04:54:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46395) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fadQ3-0001Vl-BJ for qemu-devel@nongnu.org; Wed, 04 Jul 2018 04:45:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fadQ2-0006Ac-8q for qemu-devel@nongnu.org; Wed, 04 Jul 2018 04:45:47 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:34138 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 1fadQ2-00069v-2p for qemu-devel@nongnu.org; Wed, 04 Jul 2018 04:45:46 -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 A16024078BBB for ; Wed, 4 Jul 2018 08:45:45 +0000 (UTC) Received: from xz-mi.redhat.com (ovpn-12-35.pek2.redhat.com [10.72.12.35]) by smtp.corp.redhat.com (Postfix) with ESMTP id A2B9D2026D76; Wed, 4 Jul 2018 08:45:42 +0000 (UTC) From: Peter Xu To: qemu-devel@nongnu.org Date: Wed, 4 Jul 2018 16:45:07 +0800 Message-Id: <20180704084507.14560-10-peterx@redhat.com> In-Reply-To: <20180704084507.14560-1-peterx@redhat.com> References: <20180704084507.14560-1-peterx@redhat.com> 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.7]); Wed, 04 Jul 2018 08:45:45 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 04 Jul 2018 08:45:45 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.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] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH 9/9] Revert "tests: Add parameter to qtest_init_without_qmp_handshake" 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: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This reverts commit ddee57e0176f6ab53b13c6c97605b62737a8fd7a. Meanwhile, revert one line from fa198ad9bdef to make sure qtest_init_without_qmp_handshake() will only pass in one parameter. Reviewed-by: Markus Armbruster Signed-off-by: Peter Xu --- tests/libqtest.h | 4 +--- tests/libqtest.c | 10 ++++------ tests/qmp-test.c | 4 ++-- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/tests/libqtest.h b/tests/libqtest.h index ac52872cbe..180d2cc6ff 100644 --- a/tests/libqtest.h +++ b/tests/libqtest.h @@ -56,14 +56,12 @@ QTestState *qtest_init(const char *extra_args); =20 /** * qtest_init_without_qmp_handshake: - * @use_oob: true to have the server advertise OOB support * @extra_args: other arguments to pass to QEMU. CAUTION: these * arguments are subject to word splitting and shell evaluation. * * Returns: #QTestState instance. */ -QTestState *qtest_init_without_qmp_handshake(bool use_oob, - const char *extra_args); +QTestState *qtest_init_without_qmp_handshake(const char *extra_args); =20 /** * qtest_quit: diff --git a/tests/libqtest.c b/tests/libqtest.c index c5cb3f925c..51af4a289e 100644 --- a/tests/libqtest.c +++ b/tests/libqtest.c @@ -173,8 +173,7 @@ static const char *qtest_qemu_binary(void) return qemu_bin; } =20 -QTestState *qtest_init_without_qmp_handshake(bool use_oob, - const char *extra_args) +QTestState *qtest_init_without_qmp_handshake(const char *extra_args) { QTestState *s; int sock, qmpsock, i; @@ -207,13 +206,12 @@ QTestState *qtest_init_without_qmp_handshake(bool use= _oob, command =3D g_strdup_printf("exec %s " "-qtest unix:%s,nowait " "-qtest-log %s " - "-chardev socket,path=3D%s,nowait,id=3Dc= har0 " - "-mon chardev=3Dchar0,mode=3Dcontrol%s " + "-qmp unix:%s,nowait " "-machine accel=3Dqtest " "-display none " "%s", qemu_binary, socket_path, getenv("QTEST_LOG") ? "/dev/fd/2" : "/de= v/null", - qmp_socket_path, "", + qmp_socket_path, extra_args ?: ""); execlp("/bin/sh", "sh", "-c", command, NULL); exit(1); @@ -248,7 +246,7 @@ QTestState *qtest_init_without_qmp_handshake(bool use_o= ob, =20 QTestState *qtest_init(const char *extra_args) { - QTestState *s =3D qtest_init_without_qmp_handshake(false, extra_args); + QTestState *s =3D qtest_init_without_qmp_handshake(extra_args); =20 /* Read the QMP greeting and then do the handshake */ qtest_qmp_discard_response(s, ""); diff --git a/tests/qmp-test.c b/tests/qmp-test.c index 033d610b0e..bd7118a5a9 100644 --- a/tests/qmp-test.c +++ b/tests/qmp-test.c @@ -81,7 +81,7 @@ static void test_qmp_protocol(void) QList *capabilities; QTestState *qts; =20 - qts =3D qtest_init_without_qmp_handshake(false, common_args); + qts =3D qtest_init_without_qmp_handshake(common_args); =20 /* Test greeting */ resp =3D qtest_qmp_receive(qts); @@ -196,7 +196,7 @@ static void test_qmp_oob(void) QList *capabilities; QString *qstr; =20 - qts =3D qtest_init_without_qmp_handshake(true, common_args); + qts =3D qtest_init_without_qmp_handshake(common_args); =20 /* Check the greeting message. */ resp =3D qtest_qmp_receive(qts); --=20 2.17.1