[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH RFC 07/12] migration/rdma: Be sure all channels are created
From: |
Zhimin Feng |
Subject: |
[PATCH RFC 07/12] migration/rdma: Be sure all channels are created |
Date: |
Thu, 9 Jan 2020 12:59:17 +0800 |
From: fengzhimin <address@hidden>
We need to build all multiRDMA channels before we start migration.
Signed-off-by: fengzhimin <address@hidden>
---
migration/rdma.c | 44 ++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 42 insertions(+), 2 deletions(-)
diff --git a/migration/rdma.c b/migration/rdma.c
index db75a4372a..518a21b0fe 100644
--- a/migration/rdma.c
+++ b/migration/rdma.c
@@ -4076,6 +4076,38 @@ static QEMUFile *qemu_fopen_rdma(RDMAContext *rdma,
const char *mode)
return rioc->file;
}
+static bool multiRDMA_send_all_channels_created(void)
+{
+ int thread_count = migrate_multiRDMA_channels();
+
+ return thread_count == atomic_read(&multiRDMA_send_state->count);
+}
+
+static bool multiRDMA_recv_all_channels_created(void)
+{
+ int thread_count = migrate_multiRDMA_channels();
+
+ return thread_count == atomic_read(&multiRDMA_recv_state->count);
+}
+
+static bool migration_has_all_rdma_channels(void)
+{
+ bool all_channels;
+ if (multiRDMA_send_state) {
+ MigrationState *ms = migrate_get_current();
+ all_channels = multiRDMA_send_all_channels_created();
+
+ return all_channels && ms->to_dst_file != NULL;
+ } else {
+ MigrationIncomingState *mis = migration_incoming_get_current();
+ all_channels = multiRDMA_recv_all_channels_created();
+
+ return all_channels && mis->from_src_file != NULL;
+ }
+
+ return false;
+}
+
static RDMAChannelInit_t migration_rdma_recv_initial_packet(QEMUFile *f,
Error **errp)
{
@@ -4168,7 +4200,6 @@ static void migration_multiRDMA_process_incoming(QEMUFile
*f, RDMAContext *rdma)
if (!mis->from_src_file) {
rdma->migration_started_on_destination = 1;
migration_incoming_setup(f);
- migration_incoming_process();
}
break;
@@ -4189,6 +4220,11 @@ static void
migration_multiRDMA_process_incoming(QEMUFile *f, RDMAContext *rdma)
}
break;
}
+
+ /* wait for all channels to be established */
+ if (migration_has_all_rdma_channels()) {
+ migration_incoming_process();
+ }
}
static void rdma_accept_incoming_migration(void *opaque)
@@ -4683,7 +4719,11 @@ void rdma_start_outgoing_migration(void *opaque,
ERROR(errp, "init multiRDMA channels failure!");
goto err;
}
- migrate_fd_connect(s, NULL);
+
+ /* wait for all channels to be established */
+ if (migration_has_all_rdma_channels()) {
+ migrate_fd_connect(s, NULL);
+ }
} else {
migrate_fd_connect(s, NULL);
}
--
2.19.1
- RE: [PATCH RFC 01/12] migration: Add multiRDMA capability support, (continued)
[PATCH RFC 02/12] migration: Export the 'migration_incoming_setup' function and add the 'migrate_use_rdma_pin_all' function, Zhimin Feng, 2020/01/09
[PATCH RFC 07/12] migration/rdma: Be sure all channels are created,
Zhimin Feng <=
[PATCH RFC 05/12] migration/rdma: Create the multiRDMA channels, Zhimin Feng, 2020/01/09
Re: [PATCH RFC 00/12] *** mulitple RDMA channels for migration ***, no-reply, 2020/01/09
Re: [PATCH RFC 00/12] *** mulitple RDMA channels for migration ***, Dr. David Alan Gilbert, 2020/01/15