Skip to contentSkip to conversation

migration/rdma: set the REUSEADDR option for destination

PATCH Superseded Jack Wang 3 participants 4 messages Feb 8, 2022 – Mar 2, 2022

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Jack Wang

author
#0 lore raw

PATCH v2 1/1 migration/rdma: set the REUSEADDR option for destination

We hit following error during testing RDMA transport:
in case of migration error, mgmt daemon pick one migration port, incoming rdma:[::]:8089: RDMA ERROR: Error: could not rdma_bind_addr

Then try another -incoming rdma:[::]:8103, sometime it worked, sometimes need another try with other ports number.

Set the REUSEADDR option for destination, This allow address could be reused to avoid rdma_bind_addr error out.

---
v2: extend commit message as discussed with Pankaj and David

---
 migration/rdma.c | 7 +++++++
 1 file changed, 7 insertions(+)
migration/rdma.c +7 -0
index c7c7a384875b..663e1fbb096d 100644
@@ -2705,6 +2705,7 @@ static int qemu_rdma_dest_init(RDMAContext *rdma, Error **errp)
     char ip[40] = "unknown";
     struct rdma_addrinfo *res, *e;
     char port_str[16];
+    int reuse = 1;
 
     for (idx = 0; idx < RDMA_WRID_MAX; idx++) {
         rdma->wr_data[idx].control_len = 0;
@@ -2740,6 +2741,12 @@ static int qemu_rdma_dest_init(RDMAContext *rdma, Error **errp)
         goto err_dest_init_bind_addr;
     }
 
+    ret = rdma_set_option(listen_id, RDMA_OPTION_ID, RDMA_OPTION_ID_REUSEADDR,
+			  &reuse, sizeof reuse);
+    if (ret) {
+        ERROR(errp, "Error: could not set REUSEADDR option");
+        goto err_dest_init_bind_addr;
+    }
     for (e = res; e != NULL; e = e->ai_next) {
         inet_ntop(e->ai_family,
             &((struct sockaddr_in *) e->ai_dst_addr)->sin_addr, ip, sizeof ip);
Signature · 1 line
2.25.1
Reviewed-by on v2 1/1
#1 lore raw
Quoted 11 lines · * Jack Wang ([email protected]) wrote:

We hit following error during testing RDMA transport:
in case of migration error, mgmt daemon pick one migration port, incoming rdma:[::]:8089: RDMA ERROR: Error: could not rdma_bind_addr

Then try another -incoming rdma:[::]:8103, sometime it worked, sometimes need another try with other ports number.

Set the REUSEADDR option for destination, This allow address could be reused to avoid rdma_bind_addr error out.

Quoted 34 lines

---
v2: extend commit message as discussed with Pankaj and David

---
 migration/rdma.c | 7 +++++++
 1 file changed, 7 insertions(+)
migration/rdma.c +7 -0
index c7c7a384875b..663e1fbb096d 100644
@@ -2705,6 +2705,7 @@ static int qemu_rdma_dest_init(RDMAContext *rdma, Error **errp)
     char ip[40] = "unknown";
     struct rdma_addrinfo *res, *e;
     char port_str[16];
+    int reuse = 1;
 
     for (idx = 0; idx < RDMA_WRID_MAX; idx++) {
         rdma->wr_data[idx].control_len = 0;
@@ -2740,6 +2741,12 @@ static int qemu_rdma_dest_init(RDMAContext *rdma, Error **errp)
         goto err_dest_init_bind_addr;
     }
 
+    ret = rdma_set_option(listen_id, RDMA_OPTION_ID, RDMA_OPTION_ID_REUSEADDR,
+			  &reuse, sizeof reuse);
+    if (ret) {
+        ERROR(errp, "Error: could not set REUSEADDR option");
+        goto err_dest_init_bind_addr;
+    }
     for (e = res; e != NULL; e = e->ai_next) {
         inet_ntop(e->ai_family,
             &((struct sockaddr_in *) e->ai_dst_addr)->sin_addr, ip, sizeof ip);
Signature · 1 line
2.25.1
Signature · 1 line
Dr. David Alan Gilbert / [email protected] / Manchester, UK
Reviewed-by on v2 1/1
#2 lore raw
In reply to Jack Wang
Quoted 32 lines

We hit following error during testing RDMA transport:
in case of migration error, mgmt daemon pick one migration port, incoming rdma:[::]:8089: RDMA ERROR: Error: could not rdma_bind_addr

Then try another -incoming rdma:[::]:8103, sometime it worked, sometimes need another try with other ports number.

Set the REUSEADDR option for destination, This allow address could be reused to avoid rdma_bind_addr error out.

---
v2: extend commit message as discussed with Pankaj and David

---
 migration/rdma.c | 7 +++++++
 1 file changed, 7 insertions(+)
migration/rdma.c +1 -0
index c7c7a384875b..663e1fbb096d 100644
@@ -2705,6 +2705,7 @@ static int qemu_rdma_dest_init(RDMAContext *rdma, Error **errp)
     char ip[40] = "unknown";
     struct rdma_addrinfo *res, *e;
     char port_str[16];
+    int reuse = 1;
 
     for (idx = 0; idx < RDMA_WRID_MAX; idx++) {
         rdma->wr_data[idx].control_len = 0;
@@ -2740,6 +2741,12 @@ static int qemu_rdma_dest_init(RDMAContext *rdma, Error **errp)
         goto err_dest_init_bind_addr;
     }

migration/rdma.c static int qemu_rdma_dest_init(RDMAContext *rdma, Error **errp) · line 2752

Quoted 10 lines
migration/rdma.c +6 -0
 
+    ret = rdma_set_option(listen_id, RDMA_OPTION_ID, RDMA_OPTION_ID_REUSEADDR,
+                         &reuse, sizeof reuse);
+    if (ret) {
+        ERROR(errp, "Error: could not set REUSEADDR option");
+        goto err_dest_init_bind_addr;
+    }
     for (e = res; e != NULL; e = e->ai_next) {
         inet_ntop(e->ai_family,
             &((struct sockaddr_in *) e->ai_dst_addr)->sin_addr, ip, sizeof ip);
#3 lore raw
In reply to Jack Wang
Quoted 11 lines · * Jack Wang ([email protected]) wrote:

We hit following error during testing RDMA transport:
in case of migration error, mgmt daemon pick one migration port, incoming rdma:[::]:8089: RDMA ERROR: Error: could not rdma_bind_addr

Then try another -incoming rdma:[::]:8103, sometime it worked, sometimes need another try with other ports number.

Set the REUSEADDR option for destination, This allow address could be reused to avoid rdma_bind_addr error out.

Queued

Quoted 35 lines

---
v2: extend commit message as discussed with Pankaj and David

---
 migration/rdma.c | 7 +++++++
 1 file changed, 7 insertions(+)
migration/rdma.c +7 -0
index c7c7a384875b..663e1fbb096d 100644
@@ -2705,6 +2705,7 @@ static int qemu_rdma_dest_init(RDMAContext *rdma, Error **errp)
     char ip[40] = "unknown";
     struct rdma_addrinfo *res, *e;
     char port_str[16];
+    int reuse = 1;
 
     for (idx = 0; idx < RDMA_WRID_MAX; idx++) {
         rdma->wr_data[idx].control_len = 0;
@@ -2740,6 +2741,12 @@ static int qemu_rdma_dest_init(RDMAContext *rdma, Error **errp)
         goto err_dest_init_bind_addr;
     }
 
+    ret = rdma_set_option(listen_id, RDMA_OPTION_ID, RDMA_OPTION_ID_REUSEADDR,
+			  &reuse, sizeof reuse);
+    if (ret) {
+        ERROR(errp, "Error: could not set REUSEADDR option");
+        goto err_dest_init_bind_addr;
+    }
     for (e = res; e != NULL; e = e->ai_next) {
         inet_ntop(e->ai_family,
             &((struct sockaddr_in *) e->ai_dst_addr)->sin_addr, ip, sizeof ip);
Signature · 1 line
2.25.1
Signature · 1 line
Dr. David Alan Gilbert / [email protected] / Manchester, UK