[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 14/20] migration: poll the cm event for destination q
From: |
Juan Quintela |
Subject: |
[Qemu-devel] [PULL 14/20] migration: poll the cm event for destination qemu |
Date: |
Wed, 22 Aug 2018 14:00:44 +0200 |
From: Lidong Chen <address@hidden>
The destination qemu only poll the comp_channel->fd in
qemu_rdma_wait_comp_channel. But when source qemu disconnnect
the rdma connection, the destination qemu should be notified.
Signed-off-by: Lidong Chen <address@hidden>
Reviewed-by: Juan Quintela <address@hidden>
Reviewed-by: Dr. David Alan Gilbert <address@hidden>
Signed-off-by: Juan Quintela <address@hidden>
---
migration/migration.c | 3 ++-
migration/rdma.c | 32 +++++++++++++++++++++++++++++++-
2 files changed, 33 insertions(+), 2 deletions(-)
diff --git a/migration/migration.c b/migration/migration.c
index 6f2b506335..4d76bee0da 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -390,6 +390,7 @@ static void process_incoming_migration_co(void *opaque)
int ret;
assert(mis->from_src_file);
+ mis->migration_incoming_co = qemu_coroutine_self();
mis->largest_page_size = qemu_ram_pagesize_largest();
postcopy_state_set(POSTCOPY_INCOMING_NONE);
migrate_set_state(&mis->state, MIGRATION_STATUS_NONE,
@@ -419,7 +420,6 @@ static void process_incoming_migration_co(void *opaque)
/* we get COLO info, and know if we are in COLO mode */
if (!ret && migration_incoming_enable_colo()) {
- mis->migration_incoming_co = qemu_coroutine_self();
qemu_thread_create(&mis->colo_incoming_thread, "COLO incoming",
colo_process_incoming_thread, mis, QEMU_THREAD_JOINABLE);
mis->have_colo_incoming_thread = true;
@@ -443,6 +443,7 @@ static void process_incoming_migration_co(void *opaque)
}
mis->bh = qemu_bh_new(process_incoming_migration_bh, mis);
qemu_bh_schedule(mis->bh);
+ mis->migration_incoming_co = NULL;
}
static void migration_incoming_setup(QEMUFile *f)
diff --git a/migration/rdma.c b/migration/rdma.c
index 1affc46937..ae07515e83 100644
--- a/migration/rdma.c
+++ b/migration/rdma.c
@@ -3226,6 +3226,35 @@ err:
static void rdma_accept_incoming_migration(void *opaque);
+static void rdma_cm_poll_handler(void *opaque)
+{
+ RDMAContext *rdma = opaque;
+ int ret;
+ struct rdma_cm_event *cm_event;
+ MigrationIncomingState *mis = migration_incoming_get_current();
+
+ ret = rdma_get_cm_event(rdma->channel, &cm_event);
+ if (ret) {
+ error_report("get_cm_event failed %d", errno);
+ return;
+ }
+ rdma_ack_cm_event(cm_event);
+
+ if (cm_event->event == RDMA_CM_EVENT_DISCONNECTED ||
+ cm_event->event == RDMA_CM_EVENT_DEVICE_REMOVAL) {
+ error_report("receive cm event, cm event is %d", cm_event->event);
+ rdma->error_state = -EPIPE;
+ if (rdma->return_path) {
+ rdma->return_path->error_state = -EPIPE;
+ }
+
+ if (mis->migration_incoming_co) {
+ qemu_coroutine_enter(mis->migration_incoming_co);
+ }
+ return;
+ }
+}
+
static int qemu_rdma_accept(RDMAContext *rdma)
{
RDMACapabilities cap;
@@ -3326,7 +3355,8 @@ static int qemu_rdma_accept(RDMAContext *rdma)
NULL,
(void *)(intptr_t)rdma->return_path);
} else {
- qemu_set_fd_handler(rdma->channel->fd, NULL, NULL, NULL);
+ qemu_set_fd_handler(rdma->channel->fd, rdma_cm_poll_handler,
+ NULL, rdma);
}
ret = rdma_accept(rdma->cm_id, &conn_param);
--
2.17.1
- [Qemu-devel] [PULL 00/20] Migration pull requset, Juan Quintela, 2018/08/22
- [Qemu-devel] [PULL 02/20] migration: Correctly handle subsections with no 'needed' function, Juan Quintela, 2018/08/22
- [Qemu-devel] [PULL 06/20] migration: create a dedicated connection for rdma return path, Juan Quintela, 2018/08/22
- [Qemu-devel] [PULL 01/20] qapi/migration.json: fix the description for "query-migrate" output, Juan Quintela, 2018/08/22
- [Qemu-devel] [PULL 03/20] docs/migration: Clarify pre_load in subsections, Juan Quintela, 2018/08/22
- [Qemu-devel] [PULL 08/20] migration: Stop rdma yielding during incoming postcopy, Juan Quintela, 2018/08/22
- [Qemu-devel] [PULL 04/20] migrate/cpu-throttle: Add max-cpu-throttle migration parameter, Juan Quintela, 2018/08/22
- [Qemu-devel] [PULL 11/20] migration: poll the cm event while wait RDMA work request completion, Juan Quintela, 2018/08/22
- [Qemu-devel] [PULL 12/20] migration: implement the shutdown for RDMA QIOChannel, Juan Quintela, 2018/08/22
- [Qemu-devel] [PULL 10/20] migration: invoke qio_channel_yield only when qemu_in_coroutine(), Juan Quintela, 2018/08/22
- [Qemu-devel] [PULL 14/20] migration: poll the cm event for destination qemu,
Juan Quintela <=
- [Qemu-devel] [PULL 05/20] migration: disable RDMA WRITE after postcopy started, Juan Quintela, 2018/08/22
- [Qemu-devel] [PULL 09/20] migration: implement io_set_aio_fd_handler function for RDMA QIOChannel, Juan Quintela, 2018/08/22
- [Qemu-devel] [PULL 07/20] migration: implement bi-directional RDMA QIOChannel, Juan Quintela, 2018/08/22
- [Qemu-devel] [PULL 16/20] migration: fix counting normal page for compression, Juan Quintela, 2018/08/22
- [Qemu-devel] [PULL 13/20] tests/migration-test: Silence the kvm_hv message by default, Juan Quintela, 2018/08/22
- [Qemu-devel] [PULL 15/20] migration: do not wait for free thread, Juan Quintela, 2018/08/22
- [Qemu-devel] [PULL 17/20] migration: introduce save_zero_page_to_file, Juan Quintela, 2018/08/22
- [Qemu-devel] [PULL 18/20] migration: drop the return value of do_compress_ram_page, Juan Quintela, 2018/08/22
- [Qemu-devel] [PULL 19/20] migration: move handle of zero page to the thread, Juan Quintela, 2018/08/22
- [Qemu-devel] [PULL 20/20] migration: hold the lock only if it is really needed, Juan Quintela, 2018/08/22