From: Prasad Pandit <ppandit@redhat.com>
To: qemu-devel@nongnu.org
Cc: Peter Xu <peterx@redhat.com>, Fabiano Rosas <farosas@suse.de>,
Prasad Pandit <pjp@fedoraproject.org>
Subject: [PATCH 2/5] migration/postcopy: magic value for postcopy channel
Date: Tue, 29 Oct 2024 20:39:05 +0530 [thread overview]
Message-ID: <20241029150908.1136894-3-ppandit@redhat.com> (raw)
In-Reply-To: <20241029150908.1136894-1-ppandit@redhat.com>
From: Prasad Pandit <pjp@fedoraproject.org>
During migration, the precopy and the multifd channels
send magic value (4-bytes) to the destination side,
for it to identify the channel and properly establish
connection. But Postcopy channel did not send such value.
Introduce a magic value to be sent on the postcopy channel.
It helps to identify channels when both multifd and postcopy
migration are enabled together. An explicitly defined magic
value makes code easier to follow, because it is consistent
with the other channels.
Signed-off-by: Prasad Pandit <pjp@fedoraproject.org>
---
migration/postcopy-ram.c | 7 +++++++
migration/postcopy-ram.h | 3 +++
2 files changed, 10 insertions(+)
diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c
index 83f6160a36..5bc19b541c 100644
--- a/migration/postcopy-ram.c
+++ b/migration/postcopy-ram.c
@@ -1580,6 +1580,9 @@ void postcopy_unregister_shared_ufd(struct PostCopyFD *pcfd)
void postcopy_preempt_new_channel(MigrationIncomingState *mis, QEMUFile *file)
{
+ if (mis->postcopy_qemufile_dst) {
+ return;
+ }
/*
* The new loading channel has its own threads, so it needs to be
* blocked too. It's by default true, just be explicit.
@@ -1612,6 +1615,10 @@ postcopy_preempt_send_channel_done(MigrationState *s,
* postcopy_qemufile_src to know whether it failed or not.
*/
qemu_sem_post(&s->postcopy_qemufile_src_sem);
+
+ /* Send magic value to identify postcopy channel on the destination */
+ uint32_t magic = cpu_to_be32(POSTCOPY_MAGIC);
+ qio_channel_write_all(ioc, (char *)&magic, sizeof(magic), NULL);
}
static void
diff --git a/migration/postcopy-ram.h b/migration/postcopy-ram.h
index a6df1b2811..49e2982558 100644
--- a/migration/postcopy-ram.h
+++ b/migration/postcopy-ram.h
@@ -15,6 +15,9 @@
#include "qapi/qapi-types-migration.h"
+/* Magic value to identify postcopy channel on the destination */
+#define POSTCOPY_MAGIC 0x55667788U
+
/* Return true if the host supports everything we need to do postcopy-ram */
bool postcopy_ram_supported_by_host(MigrationIncomingState *mis,
Error **errp);
--
2.47.0
next prev parent reply other threads:[~2024-10-29 15:09 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-29 15:09 [PATCH 0/5] Allow to enable multifd and postcopy migration together Prasad Pandit
2024-10-29 15:09 ` [PATCH 1/5] migration/multifd: move macros to multifd header Prasad Pandit
2024-10-29 15:09 ` Prasad Pandit [this message]
[not found] ` <ZyTnBwpOwXcHGGPJ@x1n>
2024-11-04 12:32 ` [PATCH 2/5] migration/postcopy: magic value for postcopy channel Prasad Pandit
2024-11-04 17:18 ` Peter Xu
2024-11-05 11:19 ` Prasad Pandit
2024-11-05 13:00 ` Peter Xu
2024-11-06 12:19 ` Prasad Pandit
2024-11-06 13:11 ` Fabiano Rosas
2024-11-07 12:05 ` Prasad Pandit
2024-11-07 12:11 ` Fabiano Rosas
2024-11-07 12:33 ` Daniel P. Berrangé
2024-11-07 16:17 ` Peter Xu
2024-11-07 16:57 ` Daniel P. Berrangé
2024-11-07 17:45 ` Peter Xu
2024-11-08 12:37 ` Prasad Pandit
2024-11-08 13:25 ` Fabiano Rosas
2024-11-06 16:00 ` Peter Xu
2024-11-07 11:52 ` Prasad Pandit
2024-11-07 15:56 ` Peter Xu
2024-10-29 15:09 ` [PATCH 3/5] migration: remove multifd check with postcopy Prasad Pandit
[not found] ` <ZyTnWYyHlrJUYQRB@x1n>
2024-11-04 12:23 ` Prasad Pandit
2024-11-04 16:52 ` Peter Xu
2024-11-05 9:50 ` Prasad Pandit
2024-10-29 15:09 ` [PATCH 4/5] migration: refactor ram_save_target_page functions Prasad Pandit
[not found] ` <ZyToBbvfWkIZ_40W@x1n>
2024-11-04 11:56 ` Prasad Pandit
2024-11-04 17:00 ` Peter Xu
2024-11-05 10:01 ` Prasad Pandit
2024-11-05 13:01 ` Peter Xu
2024-10-29 15:09 ` [PATCH 5/5] migration: enable multifd and postcopy together Prasad Pandit
2024-11-04 17:48 ` Peter Xu
2024-11-05 11:54 ` Prasad Pandit
2024-11-05 16:55 ` Peter Xu
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=20241029150908.1136894-3-ppandit@redhat.com \
--to=ppandit@redhat.com \
--cc=farosas@suse.de \
--cc=peterx@redhat.com \
--cc=pjp@fedoraproject.org \
--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).