From: Juraj Marcin <jmarcin@redhat.com>
To: qemu-devel@nongnu.org
Cc: Juraj Marcin <jmarcin@redhat.com>, Peter Xu <peterx@redhat.com>,
"Dr. David Alan Gilbert" <dave@treblig.org>,
Jiri Denemark <jdenemar@redhat.com>,
Fabiano Rosas <farosas@suse.de>
Subject: [PATCH v3 6/7] migration: Make postcopy listen thread joinable
Date: Thu, 30 Oct 2025 22:49:10 +0100 [thread overview]
Message-ID: <20251030214915.1411860-7-jmarcin@redhat.com> (raw)
In-Reply-To: <20251030214915.1411860-1-jmarcin@redhat.com>
From: Juraj Marcin <jmarcin@redhat.com>
This patch makes the listen thread joinable instead detached, and joins
it alongside other postcopy threads.
Signed-off-by: Juraj Marcin <jmarcin@redhat.com>
---
migration/postcopy-ram.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c
index 91431f02a4..8405cce7b4 100644
--- a/migration/postcopy-ram.c
+++ b/migration/postcopy-ram.c
@@ -2181,7 +2181,6 @@ static void *postcopy_listen_thread(void *opaque)
out:
rcu_unregister_thread();
- mis->have_listen_thread = false;
postcopy_state_set(POSTCOPY_INCOMING_END);
migration_bh_schedule(postcopy_listen_thread_bh, NULL);
@@ -2215,7 +2214,7 @@ int postcopy_incoming_setup(MigrationIncomingState *mis, Error **errp)
mis->have_listen_thread = true;
postcopy_thread_create(mis, &mis->listen_thread,
MIGRATION_THREAD_DST_LISTEN,
- postcopy_listen_thread, QEMU_THREAD_DETACHED);
+ postcopy_listen_thread, QEMU_THREAD_JOINABLE);
return 0;
}
@@ -2224,6 +2223,11 @@ int postcopy_incoming_cleanup(MigrationIncomingState *mis)
{
int rc = 0;
+ if (mis->have_listen_thread) {
+ qemu_thread_join(&mis->listen_thread);
+ mis->have_listen_thread = false;
+ }
+
if (migrate_postcopy_ram()) {
rc = postcopy_ram_incoming_cleanup(mis);
}
--
2.51.0
next prev parent reply other threads:[~2025-10-30 21:52 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-30 21:49 [PATCH v3 0/7] migration: Introduce POSTCOPY_DEVICE state Juraj Marcin
2025-10-30 21:49 ` [PATCH v3 1/7] migration: Do not try to start VM if disk activation fails Juraj Marcin
2025-10-30 21:49 ` [PATCH v3 2/7] migration: Move postcopy_ram_listen_thread() to postcopy-ram.c Juraj Marcin
2025-10-30 22:28 ` Peter Xu
2025-10-30 21:49 ` [PATCH v3 3/7] migration: Introduce postcopy incoming setup and cleanup functions Juraj Marcin
2025-10-30 22:35 ` Peter Xu
2025-10-30 21:49 ` [PATCH v3 4/7] migration: Refactor all incoming cleanup info migration_incoming_destroy() Juraj Marcin
2025-10-30 22:49 ` Peter Xu
2025-10-31 11:03 ` Juraj Marcin
2025-10-31 16:29 ` Peter Xu
2025-10-31 17:01 ` Peter Xu
2025-10-30 21:49 ` [PATCH v3 5/7] migration: Respect exit-on-error when migration fails before resuming Juraj Marcin
2025-10-30 22:49 ` Peter Xu
2025-10-30 21:49 ` Juraj Marcin [this message]
2025-10-30 22:49 ` [PATCH v3 6/7] migration: Make postcopy listen thread joinable Peter Xu
2025-10-30 21:49 ` [PATCH v3 7/7] migration: Introduce POSTCOPY_DEVICE state Juraj Marcin
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=20251030214915.1411860-7-jmarcin@redhat.com \
--to=jmarcin@redhat.com \
--cc=dave@treblig.org \
--cc=farosas@suse.de \
--cc=jdenemar@redhat.com \
--cc=peterx@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).