From: Peter Xu <peterx@redhat.com>
To: qemu-devel@nongnu.org
Cc: Manish Mishra <manish.mishra@nutanix.com>,
"Daniel P . Berrange" <berrange@redhat.com>,
Juan Quintela <quintela@redhat.com>,
"Dr . David Alan Gilbert" <dgilbert@redhat.com>,
peterx@redhat.com,
Leonardo Bras Soares Passos <lsoaresp@redhat.com>
Subject: [PATCH v2 2/3] migration: Add a semaphore to count PONGs
Date: Thu, 2 Feb 2023 16:24:57 -0500 [thread overview]
Message-ID: <20230202212458.726496-3-peterx@redhat.com> (raw)
In-Reply-To: <20230202212458.726496-1-peterx@redhat.com>
This is mostly useless, but useful for us to know whether the main channel
is correctly established without changing the migration protocol.
Signed-off-by: Peter Xu <peterx@redhat.com>
---
migration/migration.c | 3 +++
migration/migration.h | 6 ++++++
2 files changed, 9 insertions(+)
diff --git a/migration/migration.c b/migration/migration.c
index ef7fceb5d7..d66f5cfcd7 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -2993,6 +2993,7 @@ retry:
case MIG_RP_MSG_PONG:
tmp32 = ldl_be_p(buf);
trace_source_return_path_thread_pong(tmp32);
+ qemu_sem_post(&ms->rp_state.rp_pong_acks);
break;
case MIG_RP_MSG_REQ_PAGES:
@@ -4488,6 +4489,7 @@ static void migration_instance_finalize(Object *obj)
qemu_sem_destroy(&ms->postcopy_pause_sem);
qemu_sem_destroy(&ms->postcopy_pause_rp_sem);
qemu_sem_destroy(&ms->rp_state.rp_sem);
+ qemu_sem_destroy(&ms->rp_state.rp_pong_acks);
qemu_sem_destroy(&ms->postcopy_qemufile_src_sem);
error_free(ms->error);
}
@@ -4534,6 +4536,7 @@ static void migration_instance_init(Object *obj)
qemu_sem_init(&ms->postcopy_pause_sem, 0);
qemu_sem_init(&ms->postcopy_pause_rp_sem, 0);
qemu_sem_init(&ms->rp_state.rp_sem, 0);
+ qemu_sem_init(&ms->rp_state.rp_pong_acks, 0);
qemu_sem_init(&ms->rate_limit_sem, 0);
qemu_sem_init(&ms->wait_unplug_sem, 0);
qemu_sem_init(&ms->postcopy_qemufile_src_sem, 0);
diff --git a/migration/migration.h b/migration/migration.h
index c351872360..4cb1cb6fa8 100644
--- a/migration/migration.h
+++ b/migration/migration.h
@@ -276,6 +276,12 @@ struct MigrationState {
*/
bool rp_thread_created;
QemuSemaphore rp_sem;
+ /*
+ * We post to this when we got one PONG from dest. So far it's an
+ * easy way to know the main channel has successfully established
+ * on dest QEMU.
+ */
+ QemuSemaphore rp_pong_acks;
} rp_state;
double mbps;
--
2.37.3
next prev parent reply other threads:[~2023-02-02 21:25 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-02 21:24 [PATCH v2 0/3] migration: Fix disorder of channel creations Peter Xu
2023-02-02 21:24 ` [PATCH v2 1/3] migration: Rework multi-channel checks on URI Peter Xu
2023-02-08 19:19 ` Juan Quintela
2023-02-08 20:03 ` Peter Xu
2023-02-02 21:24 ` Peter Xu [this message]
2023-02-08 19:19 ` [PATCH v2 2/3] migration: Add a semaphore to count PONGs Juan Quintela
2023-02-02 21:24 ` [PATCH v2 3/3] migration: Postpone postcopy preempt channel to be after main 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=20230202212458.726496-3-peterx@redhat.com \
--to=peterx@redhat.com \
--cc=berrange@redhat.com \
--cc=dgilbert@redhat.com \
--cc=lsoaresp@redhat.com \
--cc=manish.mishra@nutanix.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
/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).