Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.2/patches/2219976/?format=api
{ "id": 2219976, "url": "http://patchwork.ozlabs.org/api/1.2/patches/2219976/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260405-work-qmp-monitor-hotplug-v2-2-ad5bedd2917a@kernel.org/", "project": { "id": 14, "url": "http://patchwork.ozlabs.org/api/1.2/projects/14/?format=api", "name": "QEMU Development", "link_name": "qemu-devel", "list_id": "qemu-devel.nongnu.org", "list_email": "qemu-devel@nongnu.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20260405-work-qmp-monitor-hotplug-v2-2-ad5bedd2917a@kernel.org>", "list_archive_url": null, "date": "2026-04-05T13:11:18", "name": "[v2,2/5] monitor/qmp: add infrastructure for safe dynamic monitor removal", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "0df62f583b142094db362c6d9629abc5c7269905", "submitter": { "id": 82326, "url": "http://patchwork.ozlabs.org/api/1.2/people/82326/?format=api", "name": "Christian Brauner", "email": "brauner@kernel.org" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260405-work-qmp-monitor-hotplug-v2-2-ad5bedd2917a@kernel.org/mbox/", "series": [ { "id": 498784, "url": "http://patchwork.ozlabs.org/api/1.2/series/498784/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=498784", "date": "2026-04-05T13:11:16", "name": "monitor: add dynamic QMP monitor hotplug support", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/498784/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2219976/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2219976/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=jqs6r/kZ;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)" ], "Received": [ "from lists.gnu.org (lists.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fpXtT37rSz1xy1\n\tfor <incoming@patchwork.ozlabs.org>; Sun, 05 Apr 2026 23:12:17 +1000 (AEST)", "from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1w9NGT-0006WA-Dp; Sun, 05 Apr 2026 09:11:45 -0400", "from eggs.gnu.org ([2001:470:142:3::10])\n by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <brauner@kernel.org>)\n id 1w9NGP-0006Uj-RY\n for qemu-devel@nongnu.org; Sun, 05 Apr 2026 09:11:41 -0400", "from tor.source.kernel.org ([172.105.4.254])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <brauner@kernel.org>)\n id 1w9NGN-0006dG-Ns\n for qemu-devel@nongnu.org; Sun, 05 Apr 2026 09:11:41 -0400", "from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58])\n by tor.source.kernel.org (Postfix) with ESMTP id CBCF46001A;\n Sun, 5 Apr 2026 13:11:38 +0000 (UTC)", "by smtp.kernel.org (Postfix) with ESMTPSA id 52262C116C6;\n Sun, 5 Apr 2026 13:11:36 +0000 (UTC)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n s=k20201202; t=1775394698;\n bh=5eeDKAFYh38vdP8ude4jd3oT3eRJVXRuSCT4UpRbzbE=;\n h=From:Date:Subject:References:In-Reply-To:To:Cc:From;\n b=jqs6r/kZ6j3KROo3FMdUXHccfPhtSrtkk8DTbkj9r0AU6+ITnd9API9+Ed8iBLoQ+\n UCTyOmgyUt3XH3N+MYe4uelYh6TLC0sqxp2lo4MwCAuN8Vky/kPv6udhw3aAXobCDc\n wr7V6AW4012UyBnw2RXAdL84zGgdPYveDA6X4K0/f2cw6T0oKSRcT72V4mHwd4XwAx\n LGcv1tyGSHId5D/Gv6CsJAFZ5LZ+2KjYUDz7P9mWn5oQfDha78EPph6iFTPyD4wRj0\n ppxXR+CQ3R0hGzWbj0weAN8TWHhCxVwBxSyJSYnMTzcnxrze5k0y6i1A10QoB1LBHZ\n zUZHUc5Vujsuw==", "From": "Christian Brauner <brauner@kernel.org>", "Date": "Sun, 05 Apr 2026 15:11:18 +0200", "Subject": "[PATCH v2 2/5] monitor/qmp: add infrastructure for safe dynamic\n monitor removal", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"utf-8\"", "Content-Transfer-Encoding": "8bit", "Message-Id": "<20260405-work-qmp-monitor-hotplug-v2-2-ad5bedd2917a@kernel.org>", "References": "<20260405-work-qmp-monitor-hotplug-v2-0-ad5bedd2917a@kernel.org>", "In-Reply-To": "<20260405-work-qmp-monitor-hotplug-v2-0-ad5bedd2917a@kernel.org>", "To": "qemu-devel@nongnu.org", "Cc": "Markus Armbruster <armbru@redhat.com>, Eric Blake <eblake@redhat.com>,\n Fabiano Rosas <farosas@suse.de>, Laurent Vivier <lvivier@redhat.com>,\n Paolo Bonzini <pbonzini@redhat.com>, Thomas Huth <th.huth+qemu@posteo.eu>,\n\t=?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <philmd@linaro.org>, =?utf-8?q?Dani?=\n\t=?utf-8?q?el_P=2E_Berrang=C3=A9?= <berrange@redhat.com>,\n Christian Brauner <brauner@kernel.org>", "X-Mailer": "b4 0.16-dev", "X-Developer-Signature": "v=1; a=openpgp-sha256; l=13148; i=brauner@kernel.org;\n h=from:subject:message-id; bh=5eeDKAFYh38vdP8ude4jd3oT3eRJVXRuSCT4UpRbzbE=;\n b=owGbwMvMwCU28Zj0gdSKO4sYT6slMWReim/qO33r9504dv66eVl7g9QNG7Uu7X4o/DYh6WR03\n NXNb6ec7ShlYRDjYpAVU2RxaDcJl1vOU7HZKFMDZg4rE8gQBi5OAZjIk0kM/1OOpt83t/l5fJvw\n zjBXu91XbAIjpBzaVyz/9d/W8tfJjU8ZGaY7TFs6u3ONfumZKwu4X9ZzLVKZ5rxxElthS2zqD7e\n ZrGwA", "X-Developer-Key": "i=brauner@kernel.org; a=openpgp;\n fpr=4880B8C9BD0E5106FC070F4F7B3C391EFEA93624", "Received-SPF": "pass client-ip=172.105.4.254; envelope-from=brauner@kernel.org;\n helo=tor.source.kernel.org", "X-Spam_score_int": "-25", "X-Spam_score": "-2.6", "X-Spam_bar": "--", "X-Spam_report": "(-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.54,\n DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001,\n SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no", "X-Spam_action": "no action", "X-BeenThere": "qemu-devel@nongnu.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "qemu development <qemu-devel.nongnu.org>", "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>", "List-Archive": "<https://lists.nongnu.org/archive/html/qemu-devel>", "List-Post": "<mailto:qemu-devel@nongnu.org>", "List-Help": "<mailto:qemu-devel-request@nongnu.org?subject=help>", "List-Subscribe": "<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>", "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org", "Sender": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org" }, "content": "Add monitor_qmp_destroy() to allow destroying a single QMP monitor at\nruntime without shutting down the entire dispatcher coroutine.\n\nConvert monitor_accept_input from a oneshot BH (aio_bh_schedule_oneshot)\nto a persistent BH (aio_bh_new + qemu_bh_schedule). Oneshot BHs cannot\nbe cancelled, so monitor_resume() racing with destruction would schedule\na callback against memory that monitor_qmp_destroy() is about to free.\nA persistent BH can be deleted during destruction, cancelling any\npending schedule.\n\nMove qemu_chr_fe_accept_input() under mon_lock in monitor_accept_input()\nso it cannot race with monitor_qmp_destroy() which deletes the BH under\nthe same lock.\n\nExtract monitor_cancel_out_watch() for cancelling a pending out_watch\nGSource. g_source_remove() only searches the default GMainContext but\niothread monitors attach the watch to the iothread context, so\ng_main_context_find_source_by_id() with the correct context followed by\ng_source_destroy() is needed. When chardev handlers have been\ndisconnected via qemu_chr_fe_set_handlers(NULL), s->gcontext is reset to\nNULL by qemu_chr_be_update_read_handlers(). A watch created after the\nreset (e.g. by a self-removal response flush) lands on the default\nGMainContext rather than the iothread context. Fall back to searching\nthe default context when the iothread context search misses.\n\nThe monitor_qmp_destroy() sequence is:\n\n 1. Delete accept_input_bh (cancel pending resume).\n 2. Under mon_lock: set skip_flush so no further writes can create\n new out_watch GSources, then cancel any existing out_watch.\n skip_flush must be set first because the chardev gcontext has\n already been reset to NULL by handler disconnect -- a flush at\n this point would attach the watch to the default GMainContext\n rather than the iothread context, and\n monitor_cancel_out_watch() searching the iothread context would\n miss it, leaking a GSource that fires monitor_unblocked() on\n freed memory.\n 3. For iothread monitors: synchronize with the iothread via\n aio_wait_bh_oneshot(). An in-flight monitor_unblocked() GSource\n callback may be blocked on mon_lock (held in step 2) and will\n resume after we release it. Since BHs cannot fire while a\n GSource callback is dispatching, the no-op BH only runs after\n monitor_unblocked() has returned, making destruction safe.\n 4. Final drain of the request queue to catch requests enqueued by an\n in-flight monitor_qmp_read() that raced with the drain in\n qmp_monitor_remove().\n 5. monitor_data_destroy() + g_free().\n\nAdd qmp_dispatcher_current_mon tracking in the dispatcher coroutine to\nhandle self-removal (a monitor sends monitor-remove targeting itself).\nBoth the dispatcher yield points and QMP command handlers run under the\nBQL, so no additional locking is needed. After dispatching each\nrequest, the dispatcher checks the dead flag: if set, it closes the\nchardev connection, calls monitor_qmp_destroy(), and clears the tracking\npointer. monitor_resume() is skipped because the chardev handlers are\nalready disconnected, and resume would schedule a BH against a monitor\nabout to be freed.\n\nAdd a setup_pending flag for iothread monitors so qmp_monitor_remove()\ncan reject removal before the setup BH has completed.\n\nSigned-off-by: Christian Brauner (Amutable) <brauner@kernel.org>\n---\n monitor/monitor-internal.h | 6 +++++\n monitor/monitor.c | 49 ++++++++++++++++++++++++++--------\n monitor/qmp.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++\n 3 files changed, 110 insertions(+), 11 deletions(-)", "diff": "diff --git a/monitor/monitor-internal.h b/monitor/monitor-internal.h\nindex 8f5fe7c111..1d9f740abb 100644\n--- a/monitor/monitor-internal.h\n+++ b/monitor/monitor-internal.h\n@@ -100,6 +100,7 @@ struct Monitor {\n bool use_io_thread;\n bool dynamic; /* true if created via monitor-add */\n bool dead; /* true if monitor-remove called, awaiting drain */\n+ QEMUBH *accept_input_bh; /* persistent BH for monitor_accept_input() */\n \n char *id; /* Monitor identifier (NULL for unnamed CLI monitors) */\n char *mon_cpu_path;\n@@ -138,6 +139,7 @@ typedef struct {\n Monitor common;\n JSONMessageParser parser;\n bool pretty;\n+ bool setup_pending; /* iothread BH has not yet set up chardev handlers */\n /*\n * When a client connects, we're in capabilities negotiation mode.\n * @commands is &qmp_cap_negotiation_commands then. When command\n@@ -176,15 +178,19 @@ void monitor_data_init(Monitor *mon, bool is_qmp, bool skip_flush,\n bool use_io_thread);\n void monitor_data_destroy(Monitor *mon);\n int monitor_can_read(void *opaque);\n+void monitor_cancel_out_watch(Monitor *mon);\n void monitor_list_append(Monitor *mon);\n void monitor_fdsets_cleanup(void);\n \n void qmp_send_response(MonitorQMP *mon, const QDict *rsp);\n void monitor_data_destroy_qmp(MonitorQMP *mon);\n+void monitor_qmp_destroy(MonitorQMP *mon);\n+void monitor_qmp_drain_queue(MonitorQMP *mon);\n void coroutine_fn monitor_qmp_dispatcher_co(void *data);\n void qmp_dispatcher_co_wake(void);\n \n Monitor *monitor_find_by_id(const char *id);\n+bool monitor_qmp_dispatcher_is_servicing(MonitorQMP *mon);\n \n int get_monitor_def(Monitor *mon, int64_t *pval, const char *name);\n void handle_hmp_command(MonitorHMP *mon, const char *cmdline);\ndiff --git a/monitor/monitor.c b/monitor/monitor.c\nindex 7144255e12..0080e8ca0e 100644\n--- a/monitor/monitor.c\n+++ b/monitor/monitor.c\n@@ -146,6 +146,28 @@ static gboolean monitor_unblocked(void *do_not_use, GIOCondition cond,\n return G_SOURCE_REMOVE;\n }\n \n+/* Cancel a pending out_watch GSource. Caller must hold mon_lock. */\n+void monitor_cancel_out_watch(Monitor *mon)\n+{\n+ if (mon->out_watch) {\n+ GMainContext *ctx = NULL;\n+ GSource *src;\n+\n+ if (mon->use_io_thread) {\n+ ctx = iothread_get_g_main_context(mon_iothread);\n+ }\n+ src = g_main_context_find_source_by_id(ctx, mon->out_watch);\n+ if (!src && ctx) {\n+ /* Handler disconnect may have reset gcontext to NULL. */\n+ src = g_main_context_find_source_by_id(NULL, mon->out_watch);\n+ }\n+ if (src) {\n+ g_source_destroy(src);\n+ }\n+ mon->out_watch = 0;\n+ }\n+}\n+\n /* Caller must hold mon->mon_lock */\n void monitor_flush_locked(Monitor *mon)\n {\n@@ -545,13 +567,13 @@ static void monitor_accept_input(void *opaque)\n MonitorHMP *hmp_mon = container_of(mon, MonitorHMP, common);\n assert(hmp_mon->rs);\n readline_restart(hmp_mon->rs);\n+ qemu_chr_fe_accept_input(&mon->chr);\n qemu_mutex_unlock(&mon->mon_lock);\n readline_show_prompt(hmp_mon->rs);\n } else {\n+ qemu_chr_fe_accept_input(&mon->chr);\n qemu_mutex_unlock(&mon->mon_lock);\n }\n-\n- qemu_chr_fe_accept_input(&mon->chr);\n }\n \n void monitor_resume(Monitor *mon)\n@@ -561,15 +583,7 @@ void monitor_resume(Monitor *mon)\n }\n \n if (qatomic_dec_fetch(&mon->suspend_cnt) == 0) {\n- AioContext *ctx;\n-\n- if (mon->use_io_thread) {\n- ctx = iothread_get_aio_context(mon_iothread);\n- } else {\n- ctx = qemu_get_aio_context();\n- }\n-\n- aio_bh_schedule_oneshot(ctx, monitor_accept_input, mon);\n+ qemu_bh_schedule(mon->accept_input_bh);\n }\n \n trace_monitor_suspend(mon, -1);\n@@ -610,6 +624,8 @@ static void monitor_iothread_init(void)\n void monitor_data_init(Monitor *mon, bool is_qmp, bool skip_flush,\n bool use_io_thread)\n {\n+ AioContext *ctx;\n+\n if (use_io_thread && !mon_iothread) {\n monitor_iothread_init();\n }\n@@ -618,6 +634,13 @@ void monitor_data_init(Monitor *mon, bool is_qmp, bool skip_flush,\n mon->outbuf = g_string_new(NULL);\n mon->skip_flush = skip_flush;\n mon->use_io_thread = use_io_thread;\n+\n+ if (use_io_thread) {\n+ ctx = iothread_get_aio_context(mon_iothread);\n+ } else {\n+ ctx = qemu_get_aio_context();\n+ }\n+ mon->accept_input_bh = aio_bh_new(ctx, monitor_accept_input, mon);\n }\n \n void monitor_data_destroy(Monitor *mon)\n@@ -631,6 +654,10 @@ void monitor_data_destroy(Monitor *mon)\n readline_free(container_of(mon, MonitorHMP, common)->rs);\n }\n g_string_free(mon->outbuf, true);\n+ if (mon->accept_input_bh) {\n+ qemu_bh_delete(mon->accept_input_bh);\n+ mon->accept_input_bh = NULL;\n+ }\n qemu_mutex_destroy(&mon->mon_lock);\n }\n \ndiff --git a/monitor/qmp.c b/monitor/qmp.c\nindex afbe2283d6..6645b82d48 100644\n--- a/monitor/qmp.c\n+++ b/monitor/qmp.c\n@@ -26,6 +26,7 @@\n \n #include \"chardev/char-io.h\"\n #include \"monitor-internal.h\"\n+#include \"qemu/aio-wait.h\"\n #include \"qapi/error.h\"\n #include \"qapi/qapi-commands-control.h\"\n #include \"qobject/qdict.h\"\n@@ -71,6 +72,9 @@ typedef struct QMPRequest QMPRequest;\n \n QmpCommandList qmp_commands, qmp_cap_negotiation_commands;\n \n+/* Monitor being serviced by the dispatcher. Protected by BQL. */\n+static MonitorQMP *qmp_dispatcher_current_mon;\n+\n static bool qmp_oob_enabled(MonitorQMP *mon)\n {\n return mon->capab[QMP_CAPABILITY_OOB];\n@@ -98,6 +102,12 @@ static void monitor_qmp_cleanup_req_queue_locked(MonitorQMP *mon)\n }\n }\n \n+void monitor_qmp_drain_queue(MonitorQMP *mon)\n+{\n+ QEMU_LOCK_GUARD(&mon->qmp_queue_lock);\n+ monitor_qmp_cleanup_req_queue_locked(mon);\n+}\n+\n static void monitor_qmp_cleanup_queue_and_resume(MonitorQMP *mon)\n {\n QEMU_LOCK_GUARD(&mon->qmp_queue_lock);\n@@ -287,6 +297,7 @@ void coroutine_fn monitor_qmp_dispatcher_co(void *data)\n */\n \n mon = req_obj->mon;\n+ qmp_dispatcher_current_mon = mon;\n \n /*\n * We need to resume the monitor if handle_qmp_command()\n@@ -342,11 +353,26 @@ void coroutine_fn monitor_qmp_dispatcher_co(void *data)\n qobject_unref(rsp);\n }\n \n+ /*\n+ * Self-removal: monitor-remove marked this monitor dead.\n+ * Close chardev, destroy, skip monitor_resume().\n+ */\n+ if (mon->common.dead) {\n+ qemu_chr_fe_set_handlers(&mon->common.chr, NULL, NULL,\n+ NULL, NULL, NULL, NULL, true);\n+ qmp_request_free(req_obj);\n+ monitor_qmp_destroy(mon);\n+ monitor_fdsets_cleanup();\n+ qmp_dispatcher_current_mon = NULL;\n+ continue;\n+ }\n+\n if (!oob_enabled) {\n monitor_resume(&mon->common);\n }\n \n qmp_request_free(req_obj);\n+ qmp_dispatcher_current_mon = NULL;\n }\n qatomic_set(&qmp_dispatcher_co, NULL);\n }\n@@ -499,6 +525,44 @@ void monitor_data_destroy_qmp(MonitorQMP *mon)\n g_queue_free(mon->qmp_requests);\n }\n \n+static void monitor_qmp_iothread_quiesce(void *opaque)\n+{\n+ /* No-op: synchronization point only */\n+}\n+\n+/*\n+ * Destroy a single dynamically-added QMP monitor.\n+ * The monitor must already have been removed from mon_list.\n+ */\n+void monitor_qmp_destroy(MonitorQMP *mon)\n+{\n+ qemu_bh_delete(mon->common.accept_input_bh);\n+ mon->common.accept_input_bh = NULL;\n+\n+ WITH_QEMU_LOCK_GUARD(&mon->common.mon_lock) {\n+ /* Disable flushes before cancel — gcontext is already wrong. */\n+ mon->common.skip_flush = true;\n+ monitor_cancel_out_watch(&mon->common);\n+ }\n+\n+ /* Synchronize with in-flight iothread callbacks. */\n+ if (mon->common.use_io_thread) {\n+ aio_wait_bh_oneshot(iothread_get_aio_context(mon_iothread),\n+ monitor_qmp_iothread_quiesce, NULL);\n+ }\n+\n+ /* Catch requests from a racing monitor_qmp_read(). */\n+ monitor_qmp_drain_queue(mon);\n+\n+ monitor_data_destroy(&mon->common);\n+ g_free(mon);\n+}\n+\n+bool monitor_qmp_dispatcher_is_servicing(MonitorQMP *mon)\n+{\n+ return qmp_dispatcher_current_mon == mon;\n+}\n+\n static void monitor_qmp_setup_handlers_bh(void *opaque)\n {\n MonitorQMP *mon = opaque;\n@@ -510,6 +574,7 @@ static void monitor_qmp_setup_handlers_bh(void *opaque)\n qemu_chr_fe_set_handlers(&mon->common.chr, monitor_can_read,\n monitor_qmp_read, monitor_qmp_event,\n NULL, &mon->common, context, true);\n+ qatomic_set(&mon->setup_pending, false);\n }\n \n void monitor_init_qmp(Chardev *chr, bool pretty, const char *id,\n@@ -553,6 +618,7 @@ void monitor_init_qmp(Chardev *chr, bool pretty, const char *id,\n * since chardev might be running in the monitor I/O\n * thread. Schedule a bottom half.\n */\n+ mon->setup_pending = true;\n aio_bh_schedule_oneshot(iothread_get_aio_context(mon_iothread),\n monitor_qmp_setup_handlers_bh, mon);\n /* Synchronous insert for immediate duplicate detection. */\n", "prefixes": [ "v2", "2/5" ] }