Skip to contentSkip to conversation

Enable postcopy RDMA live migration

PATCH Superseded Lidong Chen 3 participants 20 messages Apr 7, 2018 – Apr 24, 2018

v1 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

cover Enable postcopy RDMA live migration

Current Qemu RDMA communication does not support send and receive data at the same time, so when RDMA live migration with postcopy enabled, the source qemu return path thread get qemu file error.

Those patch add the postcopy support for RDMA live migration.

Lidong Chen (5):
migration: create a dedicated connection for rdma return path
migration: add the interface to set get_return_path
migration: implement the get_return_path for RDMA iochannel
migration: fix qemu carsh when RDMA live migration
migration: disable RDMA WRITR after postcopy started.

 migration/qemu-file-channel.c |  12 ++--
 migration/qemu-file.c         |  13 +++-
 migration/qemu-file.h         |   2 +-
 migration/rdma.c              | 148 ++++++++++++++++++++++++++++++++++++++++--
 4 files changed, 163 insertions(+), 12 deletions(-)
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 1/5 migration: create a dedicated connection for rdma return path

If start a RDMA migration with postcopy enabled, the source qemu establish a dedicated connection for return path.

---
 migration/rdma.c | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 91 insertions(+), 3 deletions(-)
migration/rdma.c +91 -3
index da474fc..230bd97 100644
@@ -387,6 +387,10 @@ typedef struct RDMAContext {
     uint64_t unregistrations[RDMA_SIGNALED_SEND_MAX];
 
     GHashTable *blockmap;
+
+    /* the RDMAContext for return path */
+    struct RDMAContext *return_path;
+    bool is_return_path;
 } RDMAContext;
 
 #define TYPE_QIO_CHANNEL_RDMA "qio-channel-rdma"
@@ -2329,10 +2333,22 @@ static void qemu_rdma_cleanup(RDMAContext *rdma)
         rdma_destroy_id(rdma->cm_id);
         rdma->cm_id = NULL;
     }
+
+    /* the destination side, listen_id and channel is shared */
     if (rdma->listen_id) {
-        rdma_destroy_id(rdma->listen_id);
+        if (!rdma->is_return_path) {
+            rdma_destroy_id(rdma->listen_id);
+        }
         rdma->listen_id = NULL;
+
+        if (rdma->channel) {
+            if (!rdma->is_return_path) {
+                rdma_destroy_event_channel(rdma->channel);
+            }
+            rdma->channel = NULL;
+        }
     }
+
     if (rdma->channel) {
         rdma_destroy_event_channel(rdma->channel);
         rdma->channel = NULL;
@@ -2561,6 +2577,25 @@ err_dest_init_create_listen_id:
 
 }
 
+static void qemu_rdma_return_path_dest_init(RDMAContext *rdma_return_path,
+                                            RDMAContext *rdma)
+{
+    int idx;
+
+    for (idx = 0; idx < RDMA_WRID_MAX; idx++) {
+        rdma_return_path->wr_data[idx].control_len = 0;
+        rdma_return_path->wr_data[idx].control_curr = NULL;
+    }
+
+    /*the CM channel and CM id is shared*/
+    rdma_return_path->channel = rdma->channel;
+    rdma_return_path->listen_id = rdma->listen_id;
+
+    rdma->return_path = rdma_return_path;
+    rdma_return_path->return_path = rdma;
+    rdma_return_path->is_return_path = true;
+}
+
 static void *qemu_rdma_data_init(const char *host_port, Error **errp)
 {
     RDMAContext *rdma = NULL;
@@ -3014,6 +3049,8 @@ err:
     return ret;
 }
 
+static void rdma_accept_incoming_migration(void *opaque);
+
 static int qemu_rdma_accept(RDMAContext *rdma)
 {
     RDMACapabilities cap;
@@ -3108,7 +3145,14 @@ static int qemu_rdma_accept(RDMAContext *rdma)
         }
     }
 
-    qemu_set_fd_handler(rdma->channel->fd, NULL, NULL, NULL);
+    /* Accept the second connection request for return path */
+    if (migrate_postcopy() && !rdma->is_return_path) {
+        qemu_set_fd_handler(rdma->channel->fd, rdma_accept_incoming_migration,
+                            NULL,
+                            (void *)(intptr_t)rdma->return_path);
+    } else {
+        qemu_set_fd_handler(rdma->channel->fd, NULL, NULL, NULL);
+    }
 
     ret = rdma_accept(rdma->cm_id, &conn_param);
     if (ret) {
@@ -3681,6 +3725,10 @@ static void rdma_accept_incoming_migration(void *opaque)
 
     trace_qemu_rdma_accept_incoming_migration_accepted();
 
+    if (rdma->is_return_path) {
+        return;
+    }
+
     f = qemu_fopen_rdma(rdma, "rb");
     if (f == NULL) {
         ERROR(errp, "could not qemu_fopen_rdma!");
@@ -3695,7 +3743,7 @@ static void rdma_accept_incoming_migration(void *opaque)
 void rdma_start_incoming_migration(const char *host_port, Error **errp)
 {
     int ret;
-    RDMAContext *rdma;
+    RDMAContext *rdma, *rdma_return_path;
     Error *local_err = NULL;
 
     trace_rdma_start_incoming_migration();
@@ -3722,12 +3770,24 @@ void rdma_start_incoming_migration(const char *host_port, Error **errp)
 
     trace_rdma_start_incoming_migration_after_rdma_listen();
 
+    /* initialize the RDMAContext for return path */
+    if (migrate_postcopy()) {
+        rdma_return_path = qemu_rdma_data_init(host_port, &local_err);
+
+        if (rdma_return_path == NULL) {
+            goto err;
+        }
+
+        qemu_rdma_return_path_dest_init(rdma_return_path, rdma);
+    }
+
     qemu_set_fd_handler(rdma->channel->fd, rdma_accept_incoming_migration,
                         NULL, (void *)(intptr_t)rdma);
     return;
 err:
     error_propagate(errp, local_err);
     g_free(rdma);
+    g_free(rdma_return_path);
 }
 
 void rdma_start_outgoing_migration(void *opaque,
@@ -3735,6 +3795,7 @@ void rdma_start_outgoing_migration(void *opaque,
 {
     MigrationState *s = opaque;
     RDMAContext *rdma = qemu_rdma_data_init(host_port, errp);
+    RDMAContext *rdma_return_path = NULL;
     int ret = 0;
 
     if (rdma == NULL) {
@@ -3755,6 +3816,32 @@ void rdma_start_outgoing_migration(void *opaque,
         goto err;
     }
 
+    /* RDMA postcopy need a seprate queue pair for return path */
+    if (migrate_postcopy()) {
+        rdma_return_path = qemu_rdma_data_init(host_port, errp);
+
+        if (rdma_return_path == NULL) {
+            goto err;
+        }
+
+        ret = qemu_rdma_source_init(rdma_return_path,
+            s->enabled_capabilities[MIGRATION_CAPABILITY_RDMA_PIN_ALL], errp);
+
+        if (ret) {
+            goto err;
+        }
+
+        ret = qemu_rdma_connect(rdma_return_path, errp);
+
+        if (ret) {
+            goto err;
+        }
+
+        rdma->return_path = rdma_return_path;
+        rdma_return_path->return_path = rdma;
+        rdma_return_path->is_return_path = true;
+    }
+
     trace_rdma_start_outgoing_migration_after_rdma_connect();
 
     s->to_dst_file = qemu_fopen_rdma(rdma, "wb");
@@ -3762,4 +3849,5 @@ void rdma_start_outgoing_migration(void *opaque,
     return;
 err:
     g_free(rdma);
+    g_free(rdma_return_path);
 }
Signature · 1 line
1.8.3.1
#2 lore raw

Re: [Qemu-devel] [PATCH 1/5] migration: create a dedicated connection for rdma return path

Quoted 4 lines · * Lidong Chen ([email protected]) wrote:

If start a RDMA migration with postcopy enabled, the source qemu establish a dedicated connection for return path.

OK, I think that'll work.

Quoted 189 lines
---
 migration/rdma.c | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 91 insertions(+), 3 deletions(-)
migration/rdma.c +91 -3
index da474fc..230bd97 100644
@@ -387,6 +387,10 @@ typedef struct RDMAContext {
     uint64_t unregistrations[RDMA_SIGNALED_SEND_MAX];
 
     GHashTable *blockmap;
+
+    /* the RDMAContext for return path */
+    struct RDMAContext *return_path;
+    bool is_return_path;
 } RDMAContext;
 
 #define TYPE_QIO_CHANNEL_RDMA "qio-channel-rdma"
@@ -2329,10 +2333,22 @@ static void qemu_rdma_cleanup(RDMAContext *rdma)
         rdma_destroy_id(rdma->cm_id);
         rdma->cm_id = NULL;
     }
+
+    /* the destination side, listen_id and channel is shared */
     if (rdma->listen_id) {
-        rdma_destroy_id(rdma->listen_id);
+        if (!rdma->is_return_path) {
+            rdma_destroy_id(rdma->listen_id);
+        }
         rdma->listen_id = NULL;
+
+        if (rdma->channel) {
+            if (!rdma->is_return_path) {
+                rdma_destroy_event_channel(rdma->channel);
+            }
+            rdma->channel = NULL;
+        }
     }
+
     if (rdma->channel) {
         rdma_destroy_event_channel(rdma->channel);
         rdma->channel = NULL;
@@ -2561,6 +2577,25 @@ err_dest_init_create_listen_id:
 
 }
 
+static void qemu_rdma_return_path_dest_init(RDMAContext *rdma_return_path,
+                                            RDMAContext *rdma)
+{
+    int idx;
+
+    for (idx = 0; idx < RDMA_WRID_MAX; idx++) {
+        rdma_return_path->wr_data[idx].control_len = 0;
+        rdma_return_path->wr_data[idx].control_curr = NULL;
+    }
+
+    /*the CM channel and CM id is shared*/
+    rdma_return_path->channel = rdma->channel;
+    rdma_return_path->listen_id = rdma->listen_id;
+
+    rdma->return_path = rdma_return_path;
+    rdma_return_path->return_path = rdma;
+    rdma_return_path->is_return_path = true;
+}
+
 static void *qemu_rdma_data_init(const char *host_port, Error **errp)
 {
     RDMAContext *rdma = NULL;
@@ -3014,6 +3049,8 @@ err:
     return ret;
 }
 
+static void rdma_accept_incoming_migration(void *opaque);
+
 static int qemu_rdma_accept(RDMAContext *rdma)
 {
     RDMACapabilities cap;
@@ -3108,7 +3145,14 @@ static int qemu_rdma_accept(RDMAContext *rdma)
         }
     }
 
-    qemu_set_fd_handler(rdma->channel->fd, NULL, NULL, NULL);
+    /* Accept the second connection request for return path */
+    if (migrate_postcopy() && !rdma->is_return_path) {
+        qemu_set_fd_handler(rdma->channel->fd, rdma_accept_incoming_migration,
+                            NULL,
+                            (void *)(intptr_t)rdma->return_path);
+    } else {
+        qemu_set_fd_handler(rdma->channel->fd, NULL, NULL, NULL);
+    }
 
     ret = rdma_accept(rdma->cm_id, &conn_param);
     if (ret) {
@@ -3681,6 +3725,10 @@ static void rdma_accept_incoming_migration(void *opaque)
 
     trace_qemu_rdma_accept_incoming_migration_accepted();
 
+    if (rdma->is_return_path) {
+        return;
+    }
+
     f = qemu_fopen_rdma(rdma, "rb");
     if (f == NULL) {
         ERROR(errp, "could not qemu_fopen_rdma!");
@@ -3695,7 +3743,7 @@ static void rdma_accept_incoming_migration(void *opaque)
 void rdma_start_incoming_migration(const char *host_port, Error **errp)
 {
     int ret;
-    RDMAContext *rdma;
+    RDMAContext *rdma, *rdma_return_path;
     Error *local_err = NULL;
 
     trace_rdma_start_incoming_migration();
@@ -3722,12 +3770,24 @@ void rdma_start_incoming_migration(const char *host_port, Error **errp)
 
     trace_rdma_start_incoming_migration_after_rdma_listen();
 
+    /* initialize the RDMAContext for return path */
+    if (migrate_postcopy()) {
+        rdma_return_path = qemu_rdma_data_init(host_port, &local_err);
+
+        if (rdma_return_path == NULL) {
+            goto err;
+        }
+
+        qemu_rdma_return_path_dest_init(rdma_return_path, rdma);
+    }
+
     qemu_set_fd_handler(rdma->channel->fd, rdma_accept_incoming_migration,
                         NULL, (void *)(intptr_t)rdma);
     return;
 err:
     error_propagate(errp, local_err);
     g_free(rdma);
+    g_free(rdma_return_path);
 }
 
 void rdma_start_outgoing_migration(void *opaque,
@@ -3735,6 +3795,7 @@ void rdma_start_outgoing_migration(void *opaque,
 {
     MigrationState *s = opaque;
     RDMAContext *rdma = qemu_rdma_data_init(host_port, errp);
+    RDMAContext *rdma_return_path = NULL;
     int ret = 0;
 
     if (rdma == NULL) {
@@ -3755,6 +3816,32 @@ void rdma_start_outgoing_migration(void *opaque,
         goto err;
     }
 
+    /* RDMA postcopy need a seprate queue pair for return path */
+    if (migrate_postcopy()) {
+        rdma_return_path = qemu_rdma_data_init(host_port, errp);
+
+        if (rdma_return_path == NULL) {
+            goto err;
+        }
+
+        ret = qemu_rdma_source_init(rdma_return_path,
+            s->enabled_capabilities[MIGRATION_CAPABILITY_RDMA_PIN_ALL], errp);
+
+        if (ret) {
+            goto err;
+        }
+
+        ret = qemu_rdma_connect(rdma_return_path, errp);
+
+        if (ret) {
+            goto err;
+        }
+
+        rdma->return_path = rdma_return_path;
+        rdma_return_path->return_path = rdma;
+        rdma_return_path->is_return_path = true;
+    }
+
     trace_rdma_start_outgoing_migration_after_rdma_connect();
 
     s->to_dst_file = qemu_fopen_rdma(rdma, "wb");
@@ -3762,4 +3849,5 @@ void rdma_start_outgoing_migration(void *opaque,
     return;
 err:
     g_free(rdma);
+    g_free(rdma_return_path);
 }
Signature · 1 line
1.8.3.1

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#3 lore raw

PATCH 2/5 migration: add the interface to set get_return_path

In reply to Lidong Chen

The default get_return_path function of iochannel does not work for RDMA live migration. So add the interface to set get_return_path.

---
 migration/qemu-file-channel.c | 12 ++++++++----
 migration/qemu-file.c         | 10 ++++++++--
 migration/qemu-file.h         |  2 +-
 3 files changed, 17 insertions(+), 7 deletions(-)
migration/qemu-file-channel.c +8 -4
index e202d73..d4dd8c4 100644
@@ -156,7 +156,6 @@ static const QEMUFileOps channel_input_ops = {
     .close = channel_close,
     .shut_down = channel_shutdown,
     .set_blocking = channel_set_blocking,
-    .get_return_path = channel_get_input_return_path,
 };
 
 
@@ -165,18 +164,23 @@ static const QEMUFileOps channel_output_ops = {
     .close = channel_close,
     .shut_down = channel_shutdown,
     .set_blocking = channel_set_blocking,
-    .get_return_path = channel_get_output_return_path,
 };
 
 
 QEMUFile *qemu_fopen_channel_input(QIOChannel *ioc)
 {
+    QEMUFile *f;
     object_ref(OBJECT(ioc));
-    return qemu_fopen_ops(ioc, &channel_input_ops);
+    f = qemu_fopen_ops(ioc, &channel_input_ops);
+    qemu_file_set_return_path(f, channel_get_input_return_path);
+    return f;
 }
 
 QEMUFile *qemu_fopen_channel_output(QIOChannel *ioc)
 {
+    QEMUFile *f;
     object_ref(OBJECT(ioc));
-    return qemu_fopen_ops(ioc, &channel_output_ops);
+    f = qemu_fopen_ops(ioc, &channel_output_ops);
+    qemu_file_set_return_path(f, channel_get_output_return_path);
+    return f;
 }
migration/qemu-file.c +8 -2
index bb63c77..8acb574 100644
@@ -36,6 +36,7 @@
 struct QEMUFile {
     const QEMUFileOps *ops;
     const QEMUFileHooks *hooks;
+    QEMURetPathFunc *get_return_path;
     void *opaque;
 
     int64_t bytes_xfer;
@@ -72,10 +73,15 @@ int qemu_file_shutdown(QEMUFile *f)
  */
 QEMUFile *qemu_file_get_return_path(QEMUFile *f)
 {
-    if (!f->ops->get_return_path) {
+    if (!f->get_return_path) {
         return NULL;
     }
-    return f->ops->get_return_path(f->opaque);
+    return f->get_return_path(f->opaque);
+}
+
+void qemu_file_set_return_path(QEMUFile *f, QEMURetPathFunc *get_return_path)
+{
+    f->get_return_path = get_return_path;
 }
 
 bool qemu_file_mode_is_not_valid(const char *mode)
migration/qemu-file.h +1 -1
index f4f356a..74210b7 100644
@@ -102,7 +102,6 @@ typedef struct QEMUFileOps {
     QEMUFileCloseFunc *close;
     QEMUFileSetBlocking *set_blocking;
     QEMUFileWritevBufferFunc *writev_buffer;
-    QEMURetPathFunc *get_return_path;
     QEMUFileShutdownFunc *shut_down;
 } QEMUFileOps;
 
@@ -114,6 +113,7 @@ typedef struct QEMUFileHooks {
 } QEMUFileHooks;
 
 QEMUFile *qemu_fopen_ops(void *opaque, const QEMUFileOps *ops);
+void qemu_file_set_return_path(QEMUFile *f, QEMURetPathFunc *get_return_path);
 void qemu_file_set_hooks(QEMUFile *f, const QEMUFileHooks *hooks);
 int qemu_get_fd(QEMUFile *f);
 int qemu_fclose(QEMUFile *f);
Signature · 1 line
1.8.3.1
#4 lore raw

Re: [Qemu-devel] [PATCH 2/5] migration: add the interface to set get_return_path

Quoted 4 lines · * Lidong Chen ([email protected]) wrote:

The default get_return_path function of iochannel does not work for RDMA live migration. So add the interface to set get_return_path.

Lets see how Dan wants this done, he knows the channel/file stuff; to me this feels like it should be adding a member to QIOChannelClass that gets used by QEMUFile's get_return_path.

(Dan and see next patch)

Dave

Quoted 98 lines
---
 migration/qemu-file-channel.c | 12 ++++++++----
 migration/qemu-file.c         | 10 ++++++++--
 migration/qemu-file.h         |  2 +-
 3 files changed, 17 insertions(+), 7 deletions(-)
migration/qemu-file-channel.c +8 -4
index e202d73..d4dd8c4 100644
@@ -156,7 +156,6 @@ static const QEMUFileOps channel_input_ops = {
     .close = channel_close,
     .shut_down = channel_shutdown,
     .set_blocking = channel_set_blocking,
-    .get_return_path = channel_get_input_return_path,
 };
 
 
@@ -165,18 +164,23 @@ static const QEMUFileOps channel_output_ops = {
     .close = channel_close,
     .shut_down = channel_shutdown,
     .set_blocking = channel_set_blocking,
-    .get_return_path = channel_get_output_return_path,
 };
 
 
 QEMUFile *qemu_fopen_channel_input(QIOChannel *ioc)
 {
+    QEMUFile *f;
     object_ref(OBJECT(ioc));
-    return qemu_fopen_ops(ioc, &channel_input_ops);
+    f = qemu_fopen_ops(ioc, &channel_input_ops);
+    qemu_file_set_return_path(f, channel_get_input_return_path);
+    return f;
 }
 
 QEMUFile *qemu_fopen_channel_output(QIOChannel *ioc)
 {
+    QEMUFile *f;
     object_ref(OBJECT(ioc));
-    return qemu_fopen_ops(ioc, &channel_output_ops);
+    f = qemu_fopen_ops(ioc, &channel_output_ops);
+    qemu_file_set_return_path(f, channel_get_output_return_path);
+    return f;
 }
migration/qemu-file.c +8 -2
index bb63c77..8acb574 100644
@@ -36,6 +36,7 @@
 struct QEMUFile {
     const QEMUFileOps *ops;
     const QEMUFileHooks *hooks;
+    QEMURetPathFunc *get_return_path;
     void *opaque;
 
     int64_t bytes_xfer;
@@ -72,10 +73,15 @@ int qemu_file_shutdown(QEMUFile *f)
  */
 QEMUFile *qemu_file_get_return_path(QEMUFile *f)
 {
-    if (!f->ops->get_return_path) {
+    if (!f->get_return_path) {
         return NULL;
     }
-    return f->ops->get_return_path(f->opaque);
+    return f->get_return_path(f->opaque);
+}
+
+void qemu_file_set_return_path(QEMUFile *f, QEMURetPathFunc *get_return_path)
+{
+    f->get_return_path = get_return_path;
 }
 
 bool qemu_file_mode_is_not_valid(const char *mode)
migration/qemu-file.h +1 -1
index f4f356a..74210b7 100644
@@ -102,7 +102,6 @@ typedef struct QEMUFileOps {
     QEMUFileCloseFunc *close;
     QEMUFileSetBlocking *set_blocking;
     QEMUFileWritevBufferFunc *writev_buffer;
-    QEMURetPathFunc *get_return_path;
     QEMUFileShutdownFunc *shut_down;
 } QEMUFileOps;
 
@@ -114,6 +113,7 @@ typedef struct QEMUFileHooks {
 } QEMUFileHooks;
 
 QEMUFile *qemu_fopen_ops(void *opaque, const QEMUFileOps *ops);
+void qemu_file_set_return_path(QEMUFile *f, QEMURetPathFunc *get_return_path);
 void qemu_file_set_hooks(QEMUFile *f, const QEMUFileHooks *hooks);
 int qemu_get_fd(QEMUFile *f);
 int qemu_fclose(QEMUFile *f);
Signature · 1 line
1.8.3.1

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#5 lore raw

Re: [Qemu-devel] [PATCH 2/5] migration: add the interface to set get_return_path

Quoted 9 lines · Dr. David Alan Gilbert
Quoted 4 lines · * Lidong Chen ([email protected]) wrote:

The default get_return_path function of iochannel does not work for RDMA live migration. So add the interface to set get_return_path.

Lets see how Dan wants this done, he knows the channel/file stuff; to me this feels like it should be adding a member to QIOChannelClass that gets used by QEMUFile's get_return_path.

No that doesn't really fit the model. IMHO the entire concept of a separate return path object is really wrong. The QIOChannel implementations are (almost) all capable of bi-directional I/O, which is why the the get_retun_path function just creates a second QEMUFile pointing to the same QIOChannel object we already had. Migration only needs the second QEMUFile, because that struct re-uses the same struct fields for tracking different bits of info depending on which direction you're doing I/O in. A real fix would be to stop overloading the same fields for multiple purposes in the QEMUFile, so that we only needed a single QEMUFile instance.

Ignoring that though, the particular problem we're facing here is that the QIOChannelRDMA impl that is used is not written in a way that allows bi-directional I/O, despite the RDMA code it uses being capable of it.

So rather than changing this get_return_path code, IMHO, the right fix to simply improve the QIOChannelRDMA impl so that it fully supports bi-directional I/O like all the other channels do.

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#6 lore raw

Re: [Qemu-devel] [PATCH 2/5] migration: add the interface to set get_return_path

Quoted 21 lines · Daniel P. Berrangé
Quoted 9 lines · Dr. David Alan Gilbert
Quoted 4 lines · * Lidong Chen ([email protected]) wrote:

The default get_return_path function of iochannel does not work for RDMA live migration. So add the interface to set get_return_path.

Lets see how Dan wants this done, he knows the channel/file stuff; to me this feels like it should be adding a member to QIOChannelClass that gets used by QEMUFile's get_return_path.

No that doesn't really fit the model. IMHO the entire concept of a separate return path object is really wrong. The QIOChannel implementations are (almost) all capable of bi-directional I/O, which is why the the get_retun_path function just creates a second QEMUFile pointing to the same QIOChannel object we already had. Migration only needs the second QEMUFile, because that struct re-uses the same struct fields for tracking different bits of info depending on which direction you're doing I/O in. A real fix would be to stop overloading the same fields for multiple purposes in the QEMUFile, so that we only needed a single QEMUFile instance.

Quoted 7 lines

Ignoring that though, the particular problem we're facing here is that the QIOChannelRDMA impl that is used is not written in a way that allows bi-directional I/O, despite the RDMA code it uses being capable of it.

So rather than changing this get_return_path code, IMHO, the right fix to simply improve the QIOChannelRDMA impl so that it fully supports bi-directional I/O like all the other channels do.

Hi Daniel:
Thanks for your suggestion.
I will have a try.

Quoted 7 lines

Regards,
Daniel
--

|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#7 lore raw

PATCH 3/5 migration: implement the get_return_path for RDMA iochannel

In reply to Lidong Chen

the default get_return_path function does not work for RDMA live migration, the patch implement the get_return_path for RDMA iochannel.

---
 migration/rdma.c | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)
migration/rdma.c +38 -0
index 230bd97..53773c7 100644
@@ -3638,6 +3638,40 @@ err:
     return ret;
 }
 
+static QEMUFile *qio_channel_rdma_get_return_path(void *opaque, int input)
+{
+    QIOChannel *ioc = opaque;
+    QIOChannelRDMA *rioc = QIO_CHANNEL_RDMA(ioc);
+    RDMAContext *rdma = rioc->rdma;
+
+    QIOChannelRDMA *rioc_return_path;
+    RDMAContext *rdma_return_path = rdma->return_path;
+
+    if (!rdma_return_path) {
+        return NULL;
+    }
+
+    rioc_return_path = QIO_CHANNEL_RDMA(object_new(TYPE_QIO_CHANNEL_RDMA));
+    rioc_return_path->rdma = rdma_return_path;
+    if (input) {
+        rioc_return_path->file = qemu_fopen_channel_output(
+                                 QIO_CHANNEL(rioc_return_path));
+    } else {
+        rioc_return_path->file = qemu_fopen_channel_input(
+                                 QIO_CHANNEL(rioc_return_path));
+    }
+    return rioc_return_path->file;
+}
+
+static QEMUFile *qio_channel_rdma_get_output_return_path(void *opaque)
+{
+   return qio_channel_rdma_get_return_path(opaque, 0);
+}
+
+static QEMUFile *qio_channel_rdma_get_input_return_path(void *opaque)
+{
+   return qio_channel_rdma_get_return_path(opaque, 1);
+}
 static const QEMUFileHooks rdma_read_hooks = {
     .hook_ram_load = rdma_load_hook,
 };
@@ -3700,9 +3734,13 @@ static QEMUFile *qemu_fopen_rdma(RDMAContext *rdma, const char *mode)
     if (mode[0] == 'w') {
         rioc->file = qemu_fopen_channel_output(QIO_CHANNEL(rioc));
         qemu_file_set_hooks(rioc->file, &rdma_write_hooks);
+        qemu_file_set_return_path(rioc->file,
+                                  qio_channel_rdma_get_output_return_path);
     } else {
         rioc->file = qemu_fopen_channel_input(QIO_CHANNEL(rioc));
         qemu_file_set_hooks(rioc->file, &rdma_read_hooks);
+        qemu_file_set_return_path(rioc->file,
+                                  qio_channel_rdma_get_input_return_path);
     }
 
     return rioc->file;
Signature · 1 line
1.8.3.1
#8 lore raw

PATCH 4/5 migration: fix qemu carsh when RDMA live migration

In reply to Lidong Chen

After postcopy, the destination qemu work in the dedicated thread, so only invoke yield_until_fd_readable before postcopy migration.

---
 migration/rdma.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
migration/rdma.c +3 -1
index 53773c7..81be482 100644
@@ -1489,11 +1489,13 @@ static int qemu_rdma_wait_comp_channel(RDMAContext *rdma)
      * Coroutine doesn't start until migration_fd_process_incoming()
      * so don't yield unless we know we're running inside of a coroutine.
      */
-    if (rdma->migration_started_on_destination) {
+    if (rdma->migration_started_on_destination &&
+        migration_incoming_get_current()->state == MIGRATION_STATUS_ACTIVE) {
         yield_until_fd_readable(rdma->comp_channel->fd);
     } else {
         /* This is the source side, we're in a separate thread
          * or destination prior to migration_fd_process_incoming()
+         * after postcopy, the destination also in a seprate thread.
          * we can't yield; so we have to poll the fd.
          * But we need to be able to handle 'cancel' or an error
          * without hanging forever.
Signature · 1 line
1.8.3.1
Reviewed-by on v1 4/5
#9 lore raw

Re: [Qemu-devel] [PATCH 4/5] migration: fix qemu carsh when RDMA live migration

Quoted 3 lines · * Lidong Chen ([email protected]) wrote:

After postcopy, the destination qemu work in the dedicated thread, so only invoke yield_until_fd_readable before postcopy migration.

The subject line needs to be more discriptive:
migration: Stop rdma yielding during incoming postcopy

I think.
(Also please check the subject spellings)

Quoted 10 lines
---
 migration/rdma.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
migration/rdma.c +0 -0
index 53773c7..81be482 100644

migration/rdma.c static int qemu_rdma_wait_comp_channel(RDMAContext *rdma) · line 1493

Quoted 6 lines
migration/rdma.c +2 -1
@@ -1489,11 +1489,13 @@ static int qemu_rdma_wait_comp_channel(RDMAContext *rdma)
      * Coroutine doesn't start until migration_fd_process_incoming()
      * so don't yield unless we know we're running inside of a coroutine.
      */
-    if (rdma->migration_started_on_destination) {
+    if (rdma->migration_started_on_destination &&
+        migration_incoming_get_current()->state == MIGRATION_STATUS_ACTIVE) {

OK, that's a bit delicate; watch if it ever gets called in a failure case or similar - and also wathc out if we make more use of the status on the destination, but otherwise, and with a fix for the subject;

Quoted 11 lines
migration/rdma.c +1 -0
         yield_until_fd_readable(rdma->comp_channel->fd);
     } else {
         /* This is the source side, we're in a separate thread
          * or destination prior to migration_fd_process_incoming()
+         * after postcopy, the destination also in a seprate thread.
          * we can't yield; so we have to poll the fd.
          * But we need to be able to handle 'cancel' or an error
          * without hanging forever.
Signature · 1 line
1.8.3.1

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#10 lore raw

Re: [Qemu-devel] [PATCH 4/5] migration: fix qemu carsh when RDMA live migration

Quoted 16 lines · Dr. David Alan Gilbert
Quoted 3 lines · * Lidong Chen ([email protected]) wrote:

After postcopy, the destination qemu work in the dedicated thread, so only invoke yield_until_fd_readable before postcopy migration.

The subject line needs to be more discriptive:
migration: Stop rdma yielding during incoming postcopy

I think.
(Also please check the subject spellings)

Quoted 5 lines
---
 migration/rdma.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Quoted 15 lines

migration/rdma.c static int qemu_rdma_wait_comp_channel(RDMAContext *rdma) · line 1493

Quoted 11 lines
migration/rdma.c +2 -1
index 53773c7..81be482 100644
@@ -1489,11 +1489,13 @@ static int qemu_rdma_wait_comp_channel(RDMAContext *rdma)
      * Coroutine doesn't start until migration_fd_process_incoming()
      * so don't yield unless we know we're running inside of a coroutine.
      */
-    if (rdma->migration_started_on_destination) {
+    if (rdma->migration_started_on_destination &&
+        migration_incoming_get_current()->state == MIGRATION_STATUS_ACTIVE) {

OK, that's a bit delicate; watch if it ever gets called in a failure case or similar - and also wathc out if we make more use of the status on the destination, but otherwise, and with a fix for the subject;

How about use migration_incoming_get_current()->have_listen_thread?

    if (rdma->migration_started_on_destination &&
        migration_incoming_get_current()->have_listen_thread == false) {
        yield_until_fd_readable(rdma->comp_channel->fd);
    }
Quoted 17 lines
Quoted 11 lines
migration/rdma.c +1 -1
         yield_until_fd_readable(rdma->comp_channel->fd);
     } else {
         /* This is the source side, we're in a separate thread
          * or destination prior to migration_fd_process_incoming()
+         * after postcopy, the destination also in a seprate thread.
          * we can't yield; so we have to poll the fd.
          * But we need to be able to handle 'cancel' or an error
          * without hanging forever.
--

1.8.3.1

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#11 lore raw

Re: [Qemu-devel] [PATCH 4/5] migration: fix qemu carsh when RDMA live migration

Quoted 34 lines · * 858585 jemmy ([email protected]) wrote:
Quoted 16 lines · Dr. David Alan Gilbert
Quoted 3 lines · * Lidong Chen ([email protected]) wrote:

After postcopy, the destination qemu work in the dedicated thread, so only invoke yield_until_fd_readable before postcopy migration.

The subject line needs to be more discriptive:
migration: Stop rdma yielding during incoming postcopy

I think.
(Also please check the subject spellings)

Quoted 5 lines
---
 migration/rdma.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Quoted 15 lines

migration/rdma.c static int qemu_rdma_wait_comp_channel(RDMAContext *rdma) · line 1493

Quoted 11 lines
migration/rdma.c +2 -1
index 53773c7..81be482 100644
@@ -1489,11 +1489,13 @@ static int qemu_rdma_wait_comp_channel(RDMAContext *rdma)
      * Coroutine doesn't start until migration_fd_process_incoming()
      * so don't yield unless we know we're running inside of a coroutine.
      */
-    if (rdma->migration_started_on_destination) {
+    if (rdma->migration_started_on_destination &&
+        migration_incoming_get_current()->state == MIGRATION_STATUS_ACTIVE) {

OK, that's a bit delicate; watch if it ever gets called in a failure case or similar - and also wathc out if we make more use of the status on the destination, but otherwise, and with a fix for the subject;

Quoted 1 line

How about use migration_incoming_get_current()->have_listen_thread?

That's supposed to be pretty internal to the postcopy code, so I prefer the status check.

Dave

Quoted 22 lines
    if (rdma->migration_started_on_destination &&
        migration_incoming_get_current()->have_listen_thread == false) {
        yield_until_fd_readable(rdma->comp_channel->fd);
    }
Quoted 17 lines
Quoted 11 lines
migration/rdma.c +1 -1
         yield_until_fd_readable(rdma->comp_channel->fd);
     } else {
         /* This is the source side, we're in a separate thread
          * or destination prior to migration_fd_process_incoming()
+         * after postcopy, the destination also in a seprate thread.
          * we can't yield; so we have to poll the fd.
          * But we need to be able to handle 'cancel' or an error
          * without hanging forever.
--

1.8.3.1

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#12 lore raw

PATCH 5/5 migration: disable RDMA WRITR after postcopy started.

In reply to Lidong Chen

RDMA write operations are performed with no notification to the destination qemu, then the destination qemu can not wakeup. So disable RDMA WRITE after postcopy started.

---
 migration/qemu-file.c |  3 ++-
 migration/rdma.c      | 12 ++++++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)
migration/qemu-file.c +2 -1
index 8acb574..a64ac3a 100644
@@ -260,7 +260,8 @@ size_t ram_control_save_page(QEMUFile *f, ram_addr_t block_offset,
         int ret = f->hooks->save_page(f, f->opaque, block_offset,
                                       offset, size, bytes_sent);
         f->bytes_xfer += size;
-        if (ret != RAM_SAVE_CONTROL_DELAYED) {
+        if (ret != RAM_SAVE_CONTROL_DELAYED &&
+            ret != RAM_SAVE_CONTROL_NOT_SUPP) {
             if (bytes_sent && *bytes_sent > 0) {
                 qemu_update_position(f, *bytes_sent);
             } else if (ret < 0) {
migration/rdma.c +12 -0
index 81be482..8529ddd 100644
@@ -2964,6 +2964,10 @@ static size_t qemu_rdma_save_page(QEMUFile *f, void *opaque,
 
     CHECK_ERROR_STATE();
 
+    if (migrate_get_current()->state == MIGRATION_STATUS_POSTCOPY_ACTIVE) {
+        return RAM_SAVE_CONTROL_NOT_SUPP;
+    }
+
     qemu_fflush(f);
 
     if (size > 0) {
@@ -3528,6 +3532,10 @@ static int qemu_rdma_registration_start(QEMUFile *f, void *opaque,
 
     CHECK_ERROR_STATE();
 
+    if (migrate_get_current()->state == MIGRATION_STATUS_POSTCOPY_ACTIVE) {
+        return 0;
+    }
+
     trace_qemu_rdma_registration_start(flags);
     qemu_put_be64(f, RAM_SAVE_FLAG_HOOK);
     qemu_fflush(f);
@@ -3550,6 +3558,10 @@ static int qemu_rdma_registration_stop(QEMUFile *f, void *opaque,
 
     CHECK_ERROR_STATE();
 
+    if (migrate_get_current()->state == MIGRATION_STATUS_POSTCOPY_ACTIVE) {
+        return 0;
+    }
+
     qemu_fflush(f);
     ret = qemu_rdma_drain_cq(f, rdma);
 
Signature · 1 line
1.8.3.1
#13 lore raw

Re: [Qemu-devel] [PATCH 5/5] migration: disable RDMA WRITR after postcopy started.

Quoted 5 lines · * Lidong Chen ([email protected]) wrote:

RDMA write operations are performed with no notification to the destination qemu, then the destination qemu can not wakeup. So disable RDMA WRITE after postcopy started.

This patch needs to be near the beginning of the series; at the moment a bisect would lead you to the middle of the series which had return paths, but then would fail to work properly because it would try and use the RDMA code.

Quoted 10 lines
---
 migration/qemu-file.c |  3 ++-
 migration/rdma.c      | 12 ++++++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)
migration/qemu-file.c +0 -0
index 8acb574..a64ac3a 100644

migration/qemu-file.c size_t ram_control_save_page(QEMUFile *f, ram_addr_t block_offset, · line 264

Quoted 6 lines
migration/qemu-file.c +2 -1
@@ -260,7 +260,8 @@ size_t ram_control_save_page(QEMUFile *f, ram_addr_t block_offset,
         int ret = f->hooks->save_page(f, f->opaque, block_offset,
                                       offset, size, bytes_sent);
         f->bytes_xfer += size;
-        if (ret != RAM_SAVE_CONTROL_DELAYED) {
+        if (ret != RAM_SAVE_CONTROL_DELAYED &&
+            ret != RAM_SAVE_CONTROL_NOT_SUPP) {

What about f->bytes_xfer in this case?

Is there anything we have to do at the switchover into postcopy to make sure that all pages have been received?

Dave

Quoted 43 lines
migration/qemu-file.c +0 -0
             if (bytes_sent && *bytes_sent > 0) {
                 qemu_update_position(f, *bytes_sent);
             } else if (ret < 0) {
migration/rdma.c +12 -0
index 81be482..8529ddd 100644
@@ -2964,6 +2964,10 @@ static size_t qemu_rdma_save_page(QEMUFile *f, void *opaque,
 
     CHECK_ERROR_STATE();
 
+    if (migrate_get_current()->state == MIGRATION_STATUS_POSTCOPY_ACTIVE) {
+        return RAM_SAVE_CONTROL_NOT_SUPP;
+    }
+
     qemu_fflush(f);
 
     if (size > 0) {
@@ -3528,6 +3532,10 @@ static int qemu_rdma_registration_start(QEMUFile *f, void *opaque,
 
     CHECK_ERROR_STATE();
 
+    if (migrate_get_current()->state == MIGRATION_STATUS_POSTCOPY_ACTIVE) {
+        return 0;
+    }
+
     trace_qemu_rdma_registration_start(flags);
     qemu_put_be64(f, RAM_SAVE_FLAG_HOOK);
     qemu_fflush(f);
@@ -3550,6 +3558,10 @@ static int qemu_rdma_registration_stop(QEMUFile *f, void *opaque,
 
     CHECK_ERROR_STATE();
 
+    if (migrate_get_current()->state == MIGRATION_STATUS_POSTCOPY_ACTIVE) {
+        return 0;
+    }
+
     qemu_fflush(f);
     ret = qemu_rdma_drain_cq(f, rdma);
 
Signature · 1 line
1.8.3.1

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#14 lore raw

Re: [Qemu-devel] [PATCH 5/5] migration: disable RDMA WRITR after postcopy started.

Quoted 11 lines · Dr. David Alan Gilbert
Quoted 5 lines · * Lidong Chen ([email protected]) wrote:

RDMA write operations are performed with no notification to the destination qemu, then the destination qemu can not wakeup. So disable RDMA WRITE after postcopy started.

This patch needs to be near the beginning of the series; at the moment a bisect would lead you to the middle of the series which had return paths, but then would fail to work properly because it would try and use the RDMA code.

I will fix this problem in next version.

Quoted 6 lines
Quoted 6 lines
---
 migration/qemu-file.c |  3 ++-
 migration/rdma.c      | 12 ++++++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)
Quoted 13 lines

migration/qemu-file.c size_t ram_control_save_page(QEMUFile *f, ram_addr_t block_offset, · line 264

Quoted 11 lines
migration/qemu-file.c +2 -1
index 8acb574..a64ac3a 100644
@@ -260,7 +260,8 @@ size_t ram_control_save_page(QEMUFile *f, ram_addr_t block_offset,
         int ret = f->hooks->save_page(f, f->opaque, block_offset,
                                       offset, size, bytes_sent);
         f->bytes_xfer += size;
-        if (ret != RAM_SAVE_CONTROL_DELAYED) {
+        if (ret != RAM_SAVE_CONTROL_DELAYED &&
+            ret != RAM_SAVE_CONTROL_NOT_SUPP) {

What about f->bytes_xfer in this case?

f->bytes_xfer should not update when RAM_SAVE_CONTROL_NOT_SUPP. I will fix this problem in next version.

Quoted 3 lines

Is there anything we have to do at the switchover into postcopy to make sure that all pages have been received?

ram_save_iterate invoke ram_control_after_iterate(f, RAM_CONTROL_ROUND), so before next iteration which switchover into postcopy, all the pages sent by previous
iteration have been received.

Quoted 48 lines

Dave

Quoted 41 lines
migration/qemu-file.c +0 -0
             if (bytes_sent && *bytes_sent > 0) {
                 qemu_update_position(f, *bytes_sent);
             } else if (ret < 0) {
migration/rdma.c +12 -1
index 81be482..8529ddd 100644
@@ -2964,6 +2964,10 @@ static size_t qemu_rdma_save_page(QEMUFile *f, void *opaque,
 
     CHECK_ERROR_STATE();
 
+    if (migrate_get_current()->state == MIGRATION_STATUS_POSTCOPY_ACTIVE) {
+        return RAM_SAVE_CONTROL_NOT_SUPP;
+    }
+
     qemu_fflush(f);
 
     if (size > 0) {
@@ -3528,6 +3532,10 @@ static int qemu_rdma_registration_start(QEMUFile *f, void *opaque,
 
     CHECK_ERROR_STATE();
 
+    if (migrate_get_current()->state == MIGRATION_STATUS_POSTCOPY_ACTIVE) {
+        return 0;
+    }
+
     trace_qemu_rdma_registration_start(flags);
     qemu_put_be64(f, RAM_SAVE_FLAG_HOOK);
     qemu_fflush(f);
@@ -3550,6 +3558,10 @@ static int qemu_rdma_registration_stop(QEMUFile *f, void *opaque,
 
     CHECK_ERROR_STATE();
 
+    if (migrate_get_current()->state == MIGRATION_STATUS_POSTCOPY_ACTIVE) {
+        return 0;
+    }
+
     qemu_fflush(f);
     ret = qemu_rdma_drain_cq(f, rdma);
 
--
Quoted 2 lines

1.8.3.1

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#15 lore raw

Re: [Qemu-devel] [PATCH 5/5] migration: disable RDMA WRITR after postcopy started.

Quoted 40 lines · * 858585 jemmy ([email protected]) wrote:
Quoted 11 lines · Dr. David Alan Gilbert
Quoted 5 lines · * Lidong Chen ([email protected]) wrote:

RDMA write operations are performed with no notification to the destination qemu, then the destination qemu can not wakeup. So disable RDMA WRITE after postcopy started.

This patch needs to be near the beginning of the series; at the moment a bisect would lead you to the middle of the series which had return paths, but then would fail to work properly because it would try and use the RDMA code.

I will fix this problem in next version.

Quoted 6 lines
Quoted 6 lines
---
 migration/qemu-file.c |  3 ++-
 migration/rdma.c      | 12 ++++++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)
Quoted 13 lines

migration/qemu-file.c size_t ram_control_save_page(QEMUFile *f, ram_addr_t block_offset, · line 264

Quoted 11 lines
migration/qemu-file.c +2 -1
index 8acb574..a64ac3a 100644
@@ -260,7 +260,8 @@ size_t ram_control_save_page(QEMUFile *f, ram_addr_t block_offset,
         int ret = f->hooks->save_page(f, f->opaque, block_offset,
                                       offset, size, bytes_sent);
         f->bytes_xfer += size;
-        if (ret != RAM_SAVE_CONTROL_DELAYED) {
+        if (ret != RAM_SAVE_CONTROL_DELAYED &&
+            ret != RAM_SAVE_CONTROL_NOT_SUPP) {

What about f->bytes_xfer in this case?

f->bytes_xfer should not update when RAM_SAVE_CONTROL_NOT_SUPP. I will fix this problem in next version.

Quoted 1 line
Quoted 7 lines
Quoted 2 lines

Is there anything we have to do at the switchover into postcopy to make sure that all pages have been received?

ram_save_iterate invoke ram_control_after_iterate(f, RAM_CONTROL_ROUND), so before next iteration which switchover into postcopy, all the pages sent by previous
iteration have been received.

OK, great.

Dave

Quoted 43 lines
Quoted 43 lines

Dave

Quoted 40 lines
migration/qemu-file.c +0 -0
             if (bytes_sent && *bytes_sent > 0) {
                 qemu_update_position(f, *bytes_sent);
             } else if (ret < 0) {
migration/rdma.c +12 -0
index 81be482..8529ddd 100644
@@ -2964,6 +2964,10 @@ static size_t qemu_rdma_save_page(QEMUFile *f, void *opaque,
 
     CHECK_ERROR_STATE();
 
+    if (migrate_get_current()->state == MIGRATION_STATUS_POSTCOPY_ACTIVE) {
+        return RAM_SAVE_CONTROL_NOT_SUPP;
+    }
+
     qemu_fflush(f);
 
     if (size > 0) {
@@ -3528,6 +3532,10 @@ static int qemu_rdma_registration_start(QEMUFile *f, void *opaque,
 
     CHECK_ERROR_STATE();
 
+    if (migrate_get_current()->state == MIGRATION_STATUS_POSTCOPY_ACTIVE) {
+        return 0;
+    }
+
     trace_qemu_rdma_registration_start(flags);
     qemu_put_be64(f, RAM_SAVE_FLAG_HOOK);
     qemu_fflush(f);
@@ -3550,6 +3558,10 @@ static int qemu_rdma_registration_stop(QEMUFile *f, void *opaque,
 
     CHECK_ERROR_STATE();
 
+    if (migrate_get_current()->state == MIGRATION_STATUS_POSTCOPY_ACTIVE) {
+        return 0;
+    }
+
     qemu_fflush(f);
     ret = qemu_rdma_drain_cq(f, rdma);
 
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines

--
1.8.3.1

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#16 lore raw
In reply to Lidong Chen

ping.

Quoted 22 lines · Lidong Chen

Current Qemu RDMA communication does not support send and receive data at the same time, so when RDMA live migration with postcopy enabled, the source qemu return path thread get qemu file error.

Those patch add the postcopy support for RDMA live migration.

Lidong Chen (5):
migration: create a dedicated connection for rdma return path
migration: add the interface to set get_return_path
migration: implement the get_return_path for RDMA iochannel
migration: fix qemu carsh when RDMA live migration
migration: disable RDMA WRITR after postcopy started.

 migration/qemu-file-channel.c |  12 ++--
 migration/qemu-file.c         |  13 +++-
 migration/qemu-file.h         |   2 +-
 migration/rdma.c              | 148 ++++++++++++++++++++++++++++++++++++++++--
 4 files changed, 163 insertions(+), 12 deletions(-)

--
1.8.3.1

#17 lore raw
In reply to Lidong Chen
Quoted 5 lines · * Lidong Chen ([email protected]) wrote:

Current Qemu RDMA communication does not support send and receive data at the same time, so when RDMA live migration with postcopy enabled, the source qemu return path thread get qemu file error.

Those patch add the postcopy support for RDMA live migration.

This description is a little misleading; it doesn't really do RDMA during the postcopy phase - what it really does is disable the RDMA page sending during the postcopy phase, relying on the RDMA codes stream emulation to send the page.

That's not necessarily a bad fix; you get the nice performance of RDMA during the precopy phase, but how bad are you finding the performance during the postcopy phase - the RDMA code we have was only really designed for sending small commands over the stream?

Dave

Quoted 7 lines

Lidong Chen (5):
migration: create a dedicated connection for rdma return path
migration: add the interface to set get_return_path
migration: implement the get_return_path for RDMA iochannel
migration: fix qemu carsh when RDMA live migration
migration: disable RDMA WRITR after postcopy started.

Quoted 9 lines
 migration/qemu-file-channel.c |  12 ++--
 migration/qemu-file.c         |  13 +++-
 migration/qemu-file.h         |   2 +-
 migration/rdma.c              | 148 ++++++++++++++++++++++++++++++++++++++++--
 4 files changed, 163 insertions(+), 12 deletions(-)
Signature · 1 line
1.8.3.1

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#18 lore raw
Quoted 11 lines · Dr. David Alan Gilbert
Quoted 5 lines · * Lidong Chen ([email protected]) wrote:

Current Qemu RDMA communication does not support send and receive data at the same time, so when RDMA live migration with postcopy enabled, the source qemu return path thread get qemu file error.

Those patch add the postcopy support for RDMA live migration.

This description is a little misleading; it doesn't really do RDMA during the postcopy phase - what it really does is disable the RDMA page sending during the postcopy phase, relying on the RDMA codes stream emulation to send the page.

Hi Dave:
I will modify the description in next version patch.

Quoted 5 lines

That's not necessarily a bad fix; you get the nice performance of RDMA during the precopy phase, but how bad are you finding the performance during the postcopy phase - the RDMA code we have was only really designed for sending small commands over the stream?

I have not finished the performance test. There are three choices for RDMA migration during the postcopy phase.

1. RDMA SEND operation from the source qemu
2. RDMA Write with Immediate from the source qemu
3. RDMA READ from the destination qemu

In theory, RDMA READ from the destination qemu is the best way. But I think it's better to make choice base on the performance result. I will send the performance result later.

If use another way during the postcopy phase, it will a big change for the code. This patch just make postcopy works, and i will send another patch to improve the performance.

Thanks.

Quoted 21 lines

Dave

Quoted 7 lines

Lidong Chen (5):
migration: create a dedicated connection for rdma return path
migration: add the interface to set get_return_path
migration: implement the get_return_path for RDMA iochannel
migration: fix qemu carsh when RDMA live migration
migration: disable RDMA WRITR after postcopy started.

Quoted 9 lines
 migration/qemu-file-channel.c |  12 ++--
 migration/qemu-file.c         |  13 +++-
 migration/qemu-file.h         |   2 +-
 migration/rdma.c              | 148 ++++++++++++++++++++++++++++++++++++++++--
 4 files changed, 163 insertions(+), 12 deletions(-)

--
1.8.3.1

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#19 lore raw
Quoted 26 lines · * 858585 jemmy ([email protected]) wrote:
Quoted 11 lines · Dr. David Alan Gilbert
Quoted 5 lines · * Lidong Chen ([email protected]) wrote:

Current Qemu RDMA communication does not support send and receive data at the same time, so when RDMA live migration with postcopy enabled, the source qemu return path thread get qemu file error.

Those patch add the postcopy support for RDMA live migration.

This description is a little misleading; it doesn't really do RDMA during the postcopy phase - what it really does is disable the RDMA page sending during the postcopy phase, relying on the RDMA codes stream emulation to send the page.

Hi Dave:
I will modify the description in next version patch.

Quoted 5 lines

That's not necessarily a bad fix; you get the nice performance of RDMA during the precopy phase, but how bad are you finding the performance during the postcopy phase - the RDMA code we have was only really designed for sending small commands over the stream?

I have not finished the performance test. There are three choices for RDMA migration during the postcopy phase.

Quoted 7 lines

1. RDMA SEND operation from the source qemu
2. RDMA Write with Immediate from the source qemu
3. RDMA READ from the destination qemu

In theory, RDMA READ from the destination qemu is the best way. But I think it's better to make choice base on the performance result. I will send the performance result later.

An RDMA read certainly sounds like an interesting way for postcopy, since it means the destination would be in control; so it can RDMA into temporaries that it could then atomically place. An interesting thought.

Quoted 3 lines

If use another way during the postcopy phase, it will a big change for the code. This patch just make postcopy works, and i will send another patch to improve the performance.

Sure; I just wanted to check that, because the existing code wasn't designed for sending pages, that it wasn't really terribly slow.

Dave

Quoted 23 lines

Thanks.

Quoted 21 lines

Dave

Quoted 7 lines

Lidong Chen (5):
migration: create a dedicated connection for rdma return path
migration: add the interface to set get_return_path
migration: implement the get_return_path for RDMA iochannel
migration: fix qemu carsh when RDMA live migration
migration: disable RDMA WRITR after postcopy started.

Quoted 9 lines
 migration/qemu-file-channel.c |  12 ++--
 migration/qemu-file.c         |  13 +++-
 migration/qemu-file.h         |   2 +-
 migration/rdma.c              | 148 ++++++++++++++++++++++++++++++++++++++++--
 4 files changed, 163 insertions(+), 12 deletions(-)

--
1.8.3.1

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK