From: Zhang Chen <zhangckid@gmail.com>
To: qemu-devel <qemu-devel@nongnu.org>,
"Dr . David Alan Gilbert" <dave@treblig.org>,
Eric Blake <eblake@redhat.com>,
Markus Armbruster <armbru@redhat.com>
Cc: Zhang Chen <zhangckid@gmail.com>
Subject: [PATCH V2 3/4] qapi: Add attached flag for iothread
Date: Wed, 21 Jan 2026 14:41:09 +0800 [thread overview]
Message-ID: <20260121064110.28760-3-zhangckid@gmail.com> (raw)
In-Reply-To: <20260121064110.28760-1-zhangckid@gmail.com>
The attached flag depends on struct IOThreadInfo's
'attached': 'bool'. It can show whether the iothread
is attached to an actual device. Show in the qmp/hmp
CMD with "attached": true/false.
Signed-off-by: Zhang Chen <zhangckid@gmail.com>
---
iothread.c | 1 +
monitor/hmp-cmds.c | 2 ++
qapi/misc.json | 6 ++++++
3 files changed, 9 insertions(+)
diff --git a/iothread.c b/iothread.c
index 38e38fb44d..fb4898e491 100644
--- a/iothread.c
+++ b/iothread.c
@@ -358,6 +358,7 @@ static int query_one_iothread(Object *object, void *opaque)
info = g_new0(IOThreadInfo, 1);
info->id = iothread_get_id(iothread);
info->thread_id = iothread->thread_id;
+ info->attached = iothread->attached;
info->poll_max_ns = iothread->poll_max_ns;
info->poll_grow = iothread->poll_grow;
info->poll_shrink = iothread->poll_shrink;
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
index 5a673cddb2..7463f34bf5 100644
--- a/monitor/hmp-cmds.c
+++ b/monitor/hmp-cmds.c
@@ -202,6 +202,8 @@ void hmp_info_iothreads(Monitor *mon, const QDict *qdict)
value = info->value;
monitor_printf(mon, "%s:\n", value->id);
monitor_printf(mon, " thread_id=%" PRId64 "\n", value->thread_id);
+ monitor_printf(mon, " attached=%s" "\n",
+ value->attached ? "true" : "false");
monitor_printf(mon, " poll-max-ns=%" PRId64 "\n", value->poll_max_ns);
monitor_printf(mon, " poll-grow=%" PRId64 "\n", value->poll_grow);
monitor_printf(mon, " poll-shrink=%" PRId64 "\n", value->poll_shrink);
diff --git a/qapi/misc.json b/qapi/misc.json
index e87994c9d9..99ffd45ce5 100644
--- a/qapi/misc.json
+++ b/qapi/misc.json
@@ -76,6 +76,9 @@
#
# @thread-id: ID of the underlying host thread
#
+# @attached: flag to show current iothread attach to device status
+# (since 12.0)
+#
# @poll-max-ns: maximum polling time in ns, 0 means polling is
# disabled (since 2.9)
#
@@ -93,6 +96,7 @@
{ 'struct': 'IOThreadInfo',
'data': {'id': 'str',
'thread-id': 'int',
+ 'attached': 'bool',
'poll-max-ns': 'int',
'poll-grow': 'int',
'poll-shrink': 'int',
@@ -118,6 +122,7 @@
# {
# "id":"iothread0",
# "thread-id":3134,
+# "attached":false",
# 'poll-max-ns':32768,
# "poll-grow":0,
# "poll-shrink":0,
@@ -126,6 +131,7 @@
# {
# "id":"iothread1",
# "thread-id":3135,
+# "attached":true",
# 'poll-max-ns':32768,
# "poll-grow":0,
# "poll-shrink":0,
--
2.49.0
next prev parent reply other threads:[~2026-01-21 6:42 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-21 6:41 [PATCH V2 1/4] qapi/misc: Fix missed query-iothreads items Zhang Chen
2026-01-21 6:41 ` [PATCH V2 2/4] iothread: Introduce a new flag to show iothreads attached status Zhang Chen
2026-01-21 6:41 ` Zhang Chen [this message]
2026-01-23 12:57 ` [PATCH V2 3/4] qapi: Add attached flag for iothread Markus Armbruster
2026-01-21 6:41 ` [PATCH V2 4/4] qemu-options: Introduce new " Zhang Chen
2026-01-23 13:04 ` Markus Armbruster
2026-01-23 12:51 ` [PATCH V2 1/4] qapi/misc: Fix missed query-iothreads items Markus Armbruster
2026-01-24 13:48 ` Zhang Chen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260121064110.28760-3-zhangckid@gmail.com \
--to=zhangckid@gmail.com \
--cc=armbru@redhat.com \
--cc=dave@treblig.org \
--cc=eblake@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.