[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC PATCH RDMA support v2: 5/6] connection-setup code betw
From: |
Michael R. Hines |
Subject: |
[Qemu-devel] [RFC PATCH RDMA support v2: 5/6] connection-setup code between client/server |
Date: |
Mon, 11 Feb 2013 17:49:56 -0500 |
From: "Michael R. Hines" <address@hidden>
Signed-off-by: Michael R. Hines <address@hidden>
---
migration-tcp.c | 19 +++++++++++++++++++
migration.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 71 insertions(+), 1 deletion(-)
diff --git a/migration-tcp.c b/migration-tcp.c
index e78a296..113576e 100644
--- a/migration-tcp.c
+++ b/migration-tcp.c
@@ -14,6 +14,7 @@
*/
#include "qemu-common.h"
+#include "qemu/rdma.h"
#include "qemu/sockets.h"
#include "migration/migration.h"
#include "migration/qemu-file.h"
@@ -55,6 +56,9 @@ static void tcp_wait_for_connect(int fd, void *opaque)
if (fd < 0) {
DPRINTF("migrate connect error\n");
+ if (migration_use_rdma()) {
+ rdma_cleanup(&rdma_mdata);
+ }
s->fd = -1;
migrate_fd_error(s);
} else {
@@ -62,6 +66,10 @@ static void tcp_wait_for_connect(int fd, void *opaque)
s->fd = fd;
socket_set_block(s->fd);
migrate_fd_connect(s);
+
+ if (migration_use_rdma() && rdma_wait_for_connect(fd, opaque)) {
+ migrate_fd_error(s);
+ }
}
}
@@ -101,6 +109,12 @@ static void tcp_accept_incoming_migration(void *opaque)
goto out;
}
+ if (migration_use_rdma() &&
+ rdma_accept_incoming_migration(&rdma_mdata)) {
+ close(s);
+ return;
+ }
+
process_incoming_migration(f);
return;
@@ -117,6 +131,11 @@ void tcp_start_incoming_migration(const char *host_port,
Error **errp)
return;
}
+ if (migration_use_rdma() && rdma_start_incoming_migration(s)) {
+ close(s);
+ return;
+ }
+
qemu_set_fd_handler2(s, NULL, tcp_accept_incoming_migration, NULL,
(void *)(intptr_t)s);
}
diff --git a/migration.c b/migration.c
index 77c1971..5ef923d 100644
--- a/migration.c
+++ b/migration.c
@@ -22,6 +22,7 @@
#include "qemu/sockets.h"
#include "migration/block.h"
#include "qemu/thread.h"
+#include "qemu/rdma.h"
#include "qmp-commands.h"
//#define DEBUG_MIGRATION
@@ -262,6 +263,16 @@ void
qmp_migrate_set_capabilities(MigrationCapabilityStatusList *params,
}
for (cap = params; cap; cap = cap->next) {
+ if (cap->value->capability == MIGRATION_CAPABILITY_RDMA) {
+#ifndef CONFIG_RDMA
+ error_set(errp, QERR_MIGRATION_RDMA_NOT_ENABLED);
+ continue;
+#endif
+ if (!migration_use_rdma()) {
+ error_set(errp, QERR_MIGRATION_RDMA_NOT_CONFIGURED,
rdma_mdata.host, rdma_mdata.port);
+ continue;
+ }
+ }
s->enabled_capabilities[cap->value->capability] = cap->value->state;
}
}
@@ -279,6 +290,11 @@ static int migrate_fd_cleanup(MigrationState *s)
}
assert(s->fd == -1);
+
+ if (migrate_rdma_enabled()) {
+ rdma_cleanup(&rdma_mdata);
+ }
+
return ret;
}
@@ -386,6 +402,9 @@ static MigrationState *migrate_init(const MigrationParams
*params)
s->params = *params;
memcpy(s->enabled_capabilities, enabled_capabilities,
sizeof(enabled_capabilities));
+
+ rdma_update_capability(s);
+
s->xbzrle_cache_size = xbzrle_cache_size;
s->bandwidth_limit = bandwidth_limit;
@@ -481,6 +500,29 @@ int64_t qmp_query_migrate_cache_size(Error **errp)
return migrate_xbzrle_cache_size();
}
+void qmp_migrate_set_rdma_port(int64_t port, Error **errp)
+{
+ MigrationState *s = migrate_get_current();
+ if (s && (s->state == MIG_STATE_ACTIVE)) {
+ return;
+ }
+ DPRINTF("rdma migration port: %" PRId64 "\n", port);
+ rdma_mdata.port = port;
+ rdma_update_capability(s);
+}
+
+void qmp_migrate_set_rdma_host(const char *host, Error **errp)
+{
+ MigrationState *s = migrate_get_current();
+ if (s && (s->state == MIG_STATE_ACTIVE)) {
+ return;
+ }
+ DPRINTF("rdma migration host name: %s\n", host);
+ strncpy(rdma_mdata.host, host, 64);
+ rdma_mdata.host[63] = '\0';
+ rdma_update_capability(s);
+}
+
void qmp_migrate_set_speed(int64_t value, Error **errp)
{
MigrationState *s;
@@ -505,6 +547,15 @@ int migrate_use_xbzrle(void)
{
MigrationState *s;
+ /*
+ * RFC RDMA: time(run-length encoding) +
+ * time(communication) is too big. RDMA throughput tanks
+ * when this feature is enabled. But there's no need
+ * to change the code since the feature is optional.
+ */
+ if (migrate_rdma_enabled())
+ return 0;
+
s = migrate_get_current();
return s->enabled_capabilities[MIGRATION_CAPABILITY_XBZRLE];
@@ -571,7 +622,7 @@ static int buffered_put_buffer(void *opaque, const uint8_t
*buf,
}
if (size > (s->buffer_capacity - s->buffer_size)) {
- DPRINTF("increasing buffer capacity from %zu by %zu\n",
+ DPRINTF("increasing buffer capacity from %zu by %d\n",
s->buffer_capacity, size + 1024);
s->buffer_capacity += size + 1024;
--
1.7.10.4
- Re: [Qemu-devel] [RFC PATCH RDMA support v2: 3/6] install new monitor commands and setup RDMA capabilities, (continued)
[Qemu-devel] [RFC PATCH RDMA support v2: 2/6] create migration-rdma.c for core RDMA migration code, Michael R. Hines, 2013/02/11
[Qemu-devel] [RFC PATCH RDMA support v2: 5/6] connection-setup code between client/server,
Michael R. Hines <=
- Re: [Qemu-devel] [RFC PATCH RDMA support v2: 5/6] connection-setup code between client/server, Orit Wasserman, 2013/02/13
- Re: [Qemu-devel] [RFC PATCH RDMA support v2: 5/6] connection-setup code between client/server, Michael R. Hines, 2013/02/14
- Re: [Qemu-devel] [RFC PATCH RDMA support v2: 5/6] connection-setup code between client/server, Orit Wasserman, 2013/02/18
- Re: [Qemu-devel] [RFC PATCH RDMA support v2: 5/6] connection-setup code between client/server, Michael R. Hines, 2013/02/19
- Re: [Qemu-devel] [RFC PATCH RDMA support v2: 5/6] connection-setup code between client/server, Orit Wasserman, 2013/02/19
- Re: [Qemu-devel] [RFC PATCH RDMA support v2: 5/6] connection-setup code between client/server, Michael R. Hines, 2013/02/19
- Re: [Qemu-devel] [RFC PATCH RDMA support v2: 5/6] connection-setup code between client/server, Paolo Bonzini, 2013/02/19
Re: [Qemu-devel] [RFC PATCH RDMA support v2: 5/6] connection-setup code between client/server, Michael S. Tsirkin, 2013/02/21
Re: [Qemu-devel] [RFC PATCH RDMA support v2: 5/6] connection-setup code between client/server, Paolo Bonzini, 2013/02/18
Re: [Qemu-devel] [RFC PATCH RDMA support v2: 5/6] connection-setup code between client/server, Michael R. Hines, 2013/02/19