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 2/4] iothread: Introduce a new flag to show iothreads attached status
Date: Wed, 21 Jan 2026 14:41:08 +0800 [thread overview]
Message-ID: <20260121064110.28760-2-zhangckid@gmail.com> (raw)
In-Reply-To: <20260121064110.28760-1-zhangckid@gmail.com>
QEMU Need a flag to show current iothread attached status
when hotplug multi iothreads. For example virtio-blk.
Signed-off-by: Zhang Chen <zhangckid@gmail.com>
---
include/system/iothread.h | 1 +
iothread.c | 5 +++++
2 files changed, 6 insertions(+)
diff --git a/include/system/iothread.h b/include/system/iothread.h
index e26d13c6c7..3d00474523 100644
--- a/include/system/iothread.h
+++ b/include/system/iothread.h
@@ -32,6 +32,7 @@ struct IOThread {
QemuSemaphore init_done_sem; /* is thread init done? */
bool stopping; /* has iothread_stop() been called? */
bool running; /* should iothread_run() continue? */
+ bool attached; /* Whether or not attached to device */
int thread_id;
/* AioContext poll parameters */
diff --git a/iothread.c b/iothread.c
index caf68e0764..38e38fb44d 100644
--- a/iothread.c
+++ b/iothread.c
@@ -94,6 +94,7 @@ void iothread_stop(IOThread *iothread)
return;
}
iothread->stopping = true;
+ iothread->attached = false;
aio_bh_schedule_oneshot(iothread->ctx, iothread_stop_bh, iothread);
qemu_thread_join(&iothread->thread);
}
@@ -199,6 +200,9 @@ static void iothread_init(EventLoopBase *base, Error **errp)
*/
iothread_init_gcontext(iothread, thread_name);
+ /* Clear iothread attached flag for init gcontext */
+ iothread->attached = false;
+
iothread_set_aio_context_params(base, &local_error);
if (local_error) {
error_propagate(errp, local_error);
@@ -336,6 +340,7 @@ char *iothread_get_id(IOThread *iothread)
AioContext *iothread_get_aio_context(IOThread *iothread)
{
+ iothread->attached = true;
return iothread->ctx;
}
--
2.49.0
next prev parent reply other threads:[~2026-01-21 6:41 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 ` Zhang Chen [this message]
2026-01-21 6:41 ` [PATCH V2 3/4] qapi: Add attached flag for iothread Zhang Chen
2026-01-23 12:57 ` 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-2-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.