Skip to contentSkip to conversation

migration/rdma: Increase the backlog from 5 to 128

PATCH In review Jack Wang 3 participants 13 messages Feb 1, 2022 – Feb 2, 2022

lore
Share & tools
lore

Jack Wang

author
#0 lore raw

PATCH 1/2 migration/rdma: Increase the backlog from 5 to 128

So it can handle more incoming requests.

---
 migration/rdma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
migration/rdma.c +1 -1
index c7c7a384875b..2e223170d06d 100644
@@ -4238,7 +4238,7 @@ void rdma_start_incoming_migration(const char *host_port, Error **errp)
 
     trace_rdma_start_incoming_migration_after_dest_init();
 
-    ret = rdma_listen(rdma->listen_id, 5);
+    ret = rdma_listen(rdma->listen_id, 128);
 
     if (ret) {
         ERROR(errp, "listening on socket!");
Signature · 1 line
2.25.1
author
#1 lore raw

PATCH 2/2 migration/rdma: set the REUSEADDR option for destination

This allow address could be reused to avoid rdma_bind_addr error out.

---
 migration/rdma.c | 7 +++++++
 1 file changed, 7 insertions(+)
migration/rdma.c +7 -0
index 2e223170d06d..b498ef013c77 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
#2 lore raw

Re: [PATCH 2/2] migration/rdma: set the REUSEADDR option for destination

Quoted 2 lines

This allow address could be reused to avoid rdma_bind_addr error out.

Seems we are proposing to allow multiple connections on same source ip port pair?

Quoted 19 lines
---
 migration/rdma.c | 7 +++++++
 1 file changed, 7 insertions(+)
migration/rdma.c +1 -0
index 2e223170d06d..b498ef013c77 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;

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

Quoted 5 lines
migration/rdma.c +2 -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);

maybe we can just write '1' directly on the argument list of 'rdma_set_option'. Assuming reuseaddr does not effect core rdma transport? change seems ok to me.

Thanks,
Pankaj

Quoted 10 lines
migration/rdma.c +4 -1
+    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);
--

2.25.1

author
#3 lore raw

Re: [PATCH 2/2] migration/rdma: set the REUSEADDR option for destination

Quoted 6 lines · Pankaj Gupta
Quoted 3 lines

This allow address could be reused to avoid rdma_bind_addr error out.

Seems we are proposing to allow multiple connections on same source ip port pair?

according to the man page, it's more about the destination side which is the incoming side.[1]
We hit the error on the migration target when there are many migration tests in parallel:
"RDMA ERROR: Error: could not rdma_bind_addr!"

[1]https://manpages.debian.org/testing/librdmacm-dev/rdma_set_option.3.en.html

Quoted 22 lines
Quoted 22 lines
---
 migration/rdma.c | 7 +++++++
 1 file changed, 7 insertions(+)
migration/rdma.c +1 -0
index 2e223170d06d..b498ef013c77 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;
     }
 
Quoted 5 lines

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

Quoted 2 lines
migration/rdma.c +2 -0
+    ret = rdma_set_option(listen_id, RDMA_OPTION_ID, RDMA_OPTION_ID_REUSEADDR,
+                         &reuse, sizeof reuse);

maybe we can just write '1' directly on the argument list of 'rdma_set_option'. Assuming reuseaddr does not effect core rdma transport? change seems ok to me.

I feel it's cleaner to do it with a variable than force conversion of 1 to void *.

It's bound to the cm_id which is newly created a few lines above, so does not affect core rdma transport.

Quoted 3 lines

Thanks,
Pankaj

Thanks for the review!

Jinpu Wang

Quoted 11 lines
Quoted 11 lines
migration/rdma.c +4 -1
+    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);
--

2.25.1

#4 lore raw

Re: [PATCH 2/2] migration/rdma: set the REUSEADDR option for destination

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

This allow address could be reused to avoid rdma_bind_addr error out.

Seems we are proposing to allow multiple connections on same source ip port pair?

according to the man page, it's more about the destination side which is the incoming side.[1]

By source here I meant generic ip port address pair binding. For this case it is at destination live migration host.

Quoted 3 lines

We hit the error on the migration target when there are many migration tests in parallel:
"RDMA ERROR: Error: could not rdma_bind_addr!"

o.k. Worth to add this in commit message.

Quoted 24 lines

[1]https://manpages.debian.org/testing/librdmacm-dev/rdma_set_option.3.en.html

Quoted 22 lines
Quoted 22 lines
---
 migration/rdma.c | 7 +++++++
 1 file changed, 7 insertions(+)
migration/rdma.c +1 -0
index 2e223170d06d..b498ef013c77 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;
     }
 
Quoted 7 lines
Quoted 5 lines

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

Quoted 2 lines
migration/rdma.c +2 -0
+    ret = rdma_set_option(listen_id, RDMA_OPTION_ID, RDMA_OPTION_ID_REUSEADDR,
+                         &reuse, sizeof reuse);

maybe we can just write '1' directly on the argument list of 'rdma_set_option'. Assuming reuseaddr does not effect core rdma transport? change seems ok to me.

I feel it's cleaner to do it with a variable than force conversion of 1 to void *.

Adding typecasted 1 seems more cleaner than adding another auto variable. Will leave this to maintainers to decide.

Quoted 3 lines

It's bound to the cm_id which is newly created a few lines above, so does not affect core rdma transport.

o.k.

Quoted 18 lines
Quoted 4 lines

Thanks,
Pankaj

Thanks for the review!

Jinpu Wang

Quoted 11 lines
Quoted 11 lines
migration/rdma.c +4 -1
+    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);
--

2.25.1

#5 lore raw

Re: [PATCH 2/2] migration/rdma: set the REUSEADDR option for destination

In reply to Jack Wang
Quoted 2 lines · * Jack Wang ([email protected]) wrote:

This allow address could be reused to avoid rdma_bind_addr error out.

In what case do you get the error - after a failed migrate and then a retry?

Dave

Quoted 33 lines
---
 migration/rdma.c | 7 +++++++
 1 file changed, 7 insertions(+)
migration/rdma.c +7 -0
index 2e223170d06d..b498ef013c77 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
author
#6 lore raw

Re: [PATCH 2/2] migration/rdma: set the REUSEADDR option for destination

Quoted 7 lines · Dr. David Alan Gilbert
Quoted 2 lines · * Jack Wang ([email protected]) wrote:

This allow address could be reused to avoid rdma_bind_addr error out.

In what case do you get the error - after a failed migrate and then a retry?

Yes, what I saw is in case of 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.

with this patch, I don't see the error anymore.

Quoted 2 lines

Dave

Thanks!

Quoted 37 lines
Quoted 32 lines
---
 migration/rdma.c | 7 +++++++
 1 file changed, 7 insertions(+)
migration/rdma.c +7 -1
index 2e223170d06d..b498ef013c77 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);
--
Quoted 2 lines

2.25.1

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

#7 lore raw
In reply to Jack Wang
Quoted 12 lines

So it can handle more incoming requests.

---
 migration/rdma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
migration/rdma.c +0 -0
index c7c7a384875b..2e223170d06d 100644

migration/rdma.c void rdma_start_incoming_migration(const char *host_port, Error **errp) · line 4241

Quoted 5 lines
migration/rdma.c +1 -1
@@ -4238,7 +4238,7 @@ void rdma_start_incoming_migration(const char *host_port, Error **errp)
 
     trace_rdma_start_incoming_migration_after_dest_init();
 
-    ret = rdma_listen(rdma->listen_id, 5);
+    ret = rdma_listen(rdma->listen_id, 128);

128 backlog seems too much to me. Any reason for choosing this number. Any rationale to choose this number?

Thanks,
Pankaj

Quoted 6 lines
migration/rdma.c +0 -1
     if (ret) {
         ERROR(errp, "listening on socket!");
--

2.25.1

author
#8 lore raw
Quoted 14 lines · Pankaj Gupta
Quoted 14 lines

So it can handle more incoming requests.

---
 migration/rdma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
migration/rdma.c +0 -0
index c7c7a384875b..2e223170d06d 100644
@@ -4238,7 +4238,7 @@ void rdma_start_incoming_migration(const char *host_port, Error **errp)
 
Quoted 8 lines

migration/rdma.c void rdma_start_incoming_migration(const char *host_port, Error **errp) · line 4241

Quoted 4 lines
migration/rdma.c +1 -1
     trace_rdma_start_incoming_migration_after_dest_init();
 
-    ret = rdma_listen(rdma->listen_id, 5);
+    ret = rdma_listen(rdma->listen_id, 128);

128 backlog seems too much to me. Any reason for choosing this number. Any rationale to choose this number?

128 is the default value of SOMAXCONN, I can use that if it is preferred.

Quoted 2 lines

Thanks,
Pankaj

Thanks!

Quoted 7 lines
Quoted 7 lines
migration/rdma.c +0 -1
     if (ret) {
         ERROR(errp, "listening on socket!");
--

2.25.1

#9 lore raw
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines

So it can handle more incoming requests.

---
 migration/rdma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
migration/rdma.c +0 -0
index c7c7a384875b..2e223170d06d 100644
@@ -4238,7 +4238,7 @@ void rdma_start_incoming_migration(const char *host_port, Error **errp)
 
     trace_rdma_start_incoming_migration_after_dest_init();
 
Quoted 7 lines
Quoted 6 lines

migration/rdma.c void rdma_start_incoming_migration(const char *host_port, Error **errp) · line 4241

Quoted 2 lines
migration/rdma.c +1 -1
-    ret = rdma_listen(rdma->listen_id, 5);
+    ret = rdma_listen(rdma->listen_id, 128);

128 backlog seems too much to me. Any reason for choosing this number. Any rationale to choose this number?

128 is the default value of SOMAXCONN, I can use that if it is preferred.

AFAICS backlog is only applicable with RDMA iWARP CM mode. Maybe we can increase it to 128.
Maybe you can also share any testing data for multiple concurrent live migrations using RDMA, please.

Thanks,
Pankaj

Thanks,
Pankaj

#10 lore raw
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines

migration/rdma.c void rdma_start_incoming_migration(const char *host_port, Error **errp) · line 4241

Quoted 13 lines
 migration/rdma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
migration/rdma.c +1 -1
index c7c7a384875b..2e223170d06d 100644
@@ -4238,7 +4238,7 @@ void rdma_start_incoming_migration(const char *host_port, Error **errp)
 
     trace_rdma_start_incoming_migration_after_dest_init();
 
-    ret = rdma_listen(rdma->listen_id, 5);
+    ret = rdma_listen(rdma->listen_id, 128);

128 backlog seems too much to me. Any reason for choosing this number. Any rationale to choose this number?

Quoted 4 lines
Quoted 1 line

128 is the default value of SOMAXCONN, I can use that if it is preferred.

AFAICS backlog is only applicable with RDMA iWARP CM mode. Maybe we can increase it to 128.these many

Or maybe we first increase it to 20 or 32? or so to avoid memory overhead if we are not
using these many connections at the same time.

Quoted 8 lines

Maybe you can also share any testing data for multiple concurrent live migrations using RDMA, please.

Thanks,
Pankaj

Thanks,
Pankaj

#11 lore raw
Quoted 17 lines · * Pankaj Gupta ([email protected]) wrote:
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines

migration/rdma.c void rdma_start_incoming_migration(const char *host_port, Error **errp) · line 4241

Quoted 13 lines
 migration/rdma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
migration/rdma.c +1 -1
index c7c7a384875b..2e223170d06d 100644
@@ -4238,7 +4238,7 @@ void rdma_start_incoming_migration(const char *host_port, Error **errp)
 
     trace_rdma_start_incoming_migration_after_dest_init();
 
-    ret = rdma_listen(rdma->listen_id, 5);
+    ret = rdma_listen(rdma->listen_id, 128);

128 backlog seems too much to me. Any reason for choosing this number. Any rationale to choose this number?

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

128 is the default value of SOMAXCONN, I can use that if it is preferred.

AFAICS backlog is only applicable with RDMA iWARP CM mode. Maybe we can increase it to 128.these many

Or maybe we first increase it to 20 or 32? or so to avoid memory overhead if we are not
using these many connections at the same time.

Can you explain why you're requiring more than 1? Is this with multifd patches?

Dave

Quoted 9 lines
Quoted 8 lines

Maybe you can also share any testing data for multiple concurrent live migrations using RDMA, please.

Thanks,
Pankaj

Thanks,
Pankaj

Signature · 1 line
Dr. David Alan Gilbert / [email protected] / Manchester, UK
author
#12 lore raw
Quoted 24 lines · Dr. David Alan Gilbert
Quoted 22 lines · * Pankaj Gupta ([email protected]) wrote:
Quoted 21 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
 migration/rdma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
migration/rdma.c +0 -0
index c7c7a384875b..2e223170d06d 100644
@@ -4238,7 +4238,7 @@ void rdma_start_incoming_migration(const char *host_port, Error **errp)
 
     trace_rdma_start_incoming_migration_after_dest_init();
 
Quoted 7 lines
Quoted 6 lines

migration/rdma.c void rdma_start_incoming_migration(const char *host_port, Error **errp) · line 4241

Quoted 2 lines
migration/rdma.c +1 -1
-    ret = rdma_listen(rdma->listen_id, 5);
+    ret = rdma_listen(rdma->listen_id, 128);

128 backlog seems too much to me. Any reason for choosing this number. Any rationale to choose this number?

128 is the default value of SOMAXCONN, I can use that if it is preferred.

AFAICS backlog is only applicable with RDMA iWARP CM mode. Maybe we can increase it to 128.these many

Quoted 6 lines
Quoted 3 lines

Or maybe we first increase it to 20 or 32? or so to avoid memory overhead if we are not
using these many connections at the same time.

Can you explain why you're requiring more than 1? Is this with multifd patches?

no, I'm not using multifs patches, just code reading, I feel 5 is too small for the backlog setting.

As Pankaj rightly mentioned, in RDMA, only iWARP CM will take some effect, it does nothing for InfiniBand
and RoCE.

Please ignore this patch, we can revisit this when we introduce multifid with RDMA.

Thanks!
Jinpu Wang

Quoted 15 lines

Dave

Quoted 9 lines
Quoted 8 lines

Maybe you can also share any testing data for multiple concurrent live migrations using RDMA, please.

Thanks,
Pankaj

Thanks,
Pankaj

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