Skip to contentSkip to conversation

migration/rdma: Fix return-path case

PATCH In review Dr. David Alan Gilbert (git) 4 participants 5 messages Mar 14, 2023 – Mar 16, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 migration/rdma: Fix return-path case

From: "Dr. David Alan Gilbert" <[email protected]>

The RDMA code has return-path handling code, but it's only enabled if postcopy is enabled; if the 'return-path' migration capability is enabled, the return path is NOT setup but the core migration code still tries to use it and breaks.

Enable the RDMA return path if either postcopy or the return-path capability is enabled.

bz: https://bugzilla.redhat.com/show_bug.cgi?id=2063615

---
 migration/rdma.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
migration/rdma.c +5 -3
index 288eadc2d2..9d70e9885b 100644
@@ -3373,7 +3373,8 @@ static int qemu_rdma_accept(RDMAContext *rdma)
      * initialize the RDMAContext for return path for postcopy after first
      * connection request reached.
      */
-    if (migrate_postcopy() && !rdma->is_return_path) {
+    if ((migrate_postcopy() || migrate_use_return_path())
+        && !rdma->is_return_path) {
         rdma_return_path = qemu_rdma_data_init(rdma->host_port, NULL);
         if (rdma_return_path == NULL) {
             rdma_ack_cm_event(cm_event);
@@ -3455,7 +3456,8 @@ static int qemu_rdma_accept(RDMAContext *rdma)
     }
 
     /* Accept the second connection request for return path */
-    if (migrate_postcopy() && !rdma->is_return_path) {
+    if ((migrate_postcopy() || migrate_use_return_path())
+        && !rdma->is_return_path) {
         qemu_set_fd_handler(rdma->channel->fd, rdma_accept_incoming_migration,
                             NULL,
                             (void *)(intptr_t)rdma->return_path);
@@ -4192,7 +4194,7 @@ void rdma_start_outgoing_migration(void *opaque,
     }
 
     /* RDMA postcopy need a separate queue pair for return path */
-    if (migrate_postcopy()) {
+    if (migrate_postcopy() || migrate_use_return_path()) {
         rdma_return_path = qemu_rdma_data_init(host_port, errp);
 
         if (rdma_return_path == NULL) {
Signature · 1 line
2.39.2
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

The RDMA code has return-path handling code, but it's only enabled if postcopy is enabled; if the 'return-path' migration capability is enabled, the return path is NOT setup but the core migration code still tries to use it and breaks.

Quoted 6 lines

Enable the RDMA return path if either postcopy or the return-path capability is enabled.

bz: https://bugzilla.redhat.com/show_bug.cgi?id=2063615

migration/rdma.c static int qemu_rdma_accept(RDMAContext *rdma) · line 3380

Quoted 10 lines
migration/rdma.c +2 -1
@@ -3373,7 +3373,8 @@ static int qemu_rdma_accept(RDMAContext *rdma)
      * initialize the RDMAContext for return path for postcopy after first
      * connection request reached.
      */
-    if (migrate_postcopy() && !rdma->is_return_path) {
+    if ((migrate_postcopy() || migrate_use_return_path())
+        && !rdma->is_return_path) {
         rdma_return_path = qemu_rdma_data_init(rdma->host_port, NULL);
         if (rdma_return_path == NULL) {
             rdma_ack_cm_event(cm_event);

It's not extremely clear to me yet on when we should use migrate_postcopy() and when to use migrate_postcopy_ram(). I think it's because I don't know enough on the dirty-bitmaps capability. Do we have some good documentation somewhere?

Not much I get from the qapi doc..

# @dirty-bitmaps: If enabled, QEMU will migrate named dirty bitmaps.
# (since 2.12)

Thanks,

Signature · 1 line
Peter Xu
#2 lore raw
Quoted 17 lines · * Peter Xu ([email protected]) wrote:
Quoted 7 lines · Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

The RDMA code has return-path handling code, but it's only enabled if postcopy is enabled; if the 'return-path' migration capability is enabled, the return path is NOT setup but the core migration code still tries to use it and breaks.

Quoted 6 lines

Enable the RDMA return path if either postcopy or the return-path capability is enabled.

bz: https://bugzilla.redhat.com/show_bug.cgi?id=2063615

Quoted 15 lines

migration/rdma.c static int qemu_rdma_accept(RDMAContext *rdma) · line 3380

Quoted 10 lines
migration/rdma.c +2 -1
@@ -3373,7 +3373,8 @@ static int qemu_rdma_accept(RDMAContext *rdma)
      * initialize the RDMAContext for return path for postcopy after first
      * connection request reached.
      */
-    if (migrate_postcopy() && !rdma->is_return_path) {
+    if ((migrate_postcopy() || migrate_use_return_path())
+        && !rdma->is_return_path) {
         rdma_return_path = qemu_rdma_data_init(rdma->host_port, NULL);
         if (rdma_return_path == NULL) {
             rdma_ack_cm_event(cm_event);

It's not extremely clear to me yet on when we should use migrate_postcopy() and when to use migrate_postcopy_ram(). I think it's because I don't know enough on the dirty-bitmaps capability. Do we have some good documentation somewhere?

Hmm that's probably a good point.

Quoted 4 lines

Not much I get from the qapi doc..

# @dirty-bitmaps: If enabled, QEMU will migrate named dirty bitmaps.
# (since 2.12)

I don't know of any good docs; I think this is a blocks mechanism; I'm not even sure if it needs the return path.

Dave

Quoted 5 lines

Thanks,

Signature · 1 line
Peter Xu
Signature · 1 line
Dr. David Alan Gilbert / [email protected] / Manchester, UK
Reviewed-by on v1 1/1
#3 lore raw
In reply to Dr. David Alan Gilbert (git)
Quoted 7 lines · Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

The RDMA code has return-path handling code, but it's only enabled if postcopy is enabled; if the 'return-path' migration capability is enabled, the return path is NOT setup but the core migration code still tries to use it and breaks.

Quoted 6 lines

Enable the RDMA return path if either postcopy or the return-path capability is enabled.

bz: https://bugzilla.redhat.com/show_bug.cgi?id=2063615

LGTM.

Quoted 37 lines
---
  migration/rdma.c | 8 +++++---
  1 file changed, 5 insertions(+), 3 deletions(-)
migration/rdma.c +5 -3
index 288eadc2d2..9d70e9885b 100644
@@ -3373,7 +3373,8 @@ static int qemu_rdma_accept(RDMAContext *rdma)
       * initialize the RDMAContext for return path for postcopy after first
       * connection request reached.
       */
-    if (migrate_postcopy() && !rdma->is_return_path) {
+    if ((migrate_postcopy() || migrate_use_return_path())
+        && !rdma->is_return_path) {
          rdma_return_path = qemu_rdma_data_init(rdma->host_port, NULL);
          if (rdma_return_path == NULL) {
              rdma_ack_cm_event(cm_event);
@@ -3455,7 +3456,8 @@ static int qemu_rdma_accept(RDMAContext *rdma)
      }
 
      /* Accept the second connection request for return path */
-    if (migrate_postcopy() && !rdma->is_return_path) {
+    if ((migrate_postcopy() || migrate_use_return_path())
+        && !rdma->is_return_path) {
          qemu_set_fd_handler(rdma->channel->fd, rdma_accept_incoming_migration,
                              NULL,
                              (void *)(intptr_t)rdma->return_path);
@@ -4192,7 +4194,7 @@ void rdma_start_outgoing_migration(void *opaque,
      }
 
      /* RDMA postcopy need a separate queue pair for return path */
-    if (migrate_postcopy()) {
+    if (migrate_postcopy() || migrate_use_return_path()) {
          rdma_return_path = qemu_rdma_data_init(host_port, errp);
 
          if (rdma_return_path == NULL) {
Reviewed-by on v1 1/1
#4 lore raw
In reply to Dr. David Alan Gilbert (git)
Quoted 7 lines · Dr. David Alan Gilbert (git)

From: "Dr. David Alan Gilbert" <[email protected]>

The RDMA code has return-path handling code, but it's only enabled if postcopy is enabled; if the 'return-path' migration capability is enabled, the return path is NOT setup but the core migration code still tries to use it and breaks.

Quoted 6 lines

Enable the RDMA return path if either postcopy or the return-path capability is enabled.

bz: https://bugzilla.redhat.com/show_bug.cgi?id=2063615

queued.