Skip to content

Commit

Permalink
migration: implement bi-directional RDMA QIOChannel
Browse files Browse the repository at this point in the history
This patch implements bi-directional RDMA QIOChannel. Because different
threads may access RDMAQIOChannel currently, this patch use RCU to protect it.

Signed-off-by: Lidong Chen <[email protected]>
Reviewed-by: Dr. David Alan Gilbert <[email protected]>
Reviewed-by: Juan Quintela <[email protected]>
Signed-off-by: Juan Quintela <[email protected]>
  • Loading branch information
jemmy858585 authored and Juan Quintela committed Aug 22, 2018
1 parent 55cc1b5 commit 74637e6
Show file tree
Hide file tree
Showing 6 changed files with 183 additions and 26 deletions.
2 changes: 2 additions & 0 deletions migration/colo.c
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,7 @@ void *colo_process_incoming_thread(void *opaque)
uint64_t value;
Error *local_err = NULL;

rcu_register_thread();
qemu_sem_init(&mis->colo_incoming_sem, 0);

migrate_set_state(&mis->state, MIGRATION_STATUS_ACTIVE,
Expand Down Expand Up @@ -666,5 +667,6 @@ void *colo_process_incoming_thread(void *opaque)
}
migration_incoming_exit_colo();

rcu_unregister_thread();
return NULL;
}
2 changes: 2 additions & 0 deletions migration/migration.c
Original file line number Diff line number Diff line change
Expand Up @@ -2121,6 +2121,7 @@ static void *source_return_path_thread(void *opaque)
int res;

trace_source_return_path_thread_entry();
rcu_register_thread();

retry:
while (!ms->rp_state.error && !qemu_file_get_error(rp) &&
Expand Down Expand Up @@ -2260,6 +2261,7 @@ static void *source_return_path_thread(void *opaque)
trace_source_return_path_thread_end();
ms->rp_state.from_dst_file = NULL;
qemu_fclose(rp);
rcu_unregister_thread();
return NULL;
}

Expand Down
2 changes: 2 additions & 0 deletions migration/postcopy-ram.c
Original file line number Diff line number Diff line change
Expand Up @@ -853,6 +853,7 @@ static void *postcopy_ram_fault_thread(void *opaque)
RAMBlock *rb = NULL;

trace_postcopy_ram_fault_thread_entry();
rcu_register_thread();
mis->last_rb = NULL; /* last RAMBlock we sent part of */
qemu_sem_post(&mis->fault_thread_sem);

Expand Down Expand Up @@ -1059,6 +1060,7 @@ static void *postcopy_ram_fault_thread(void *opaque)
}
}
}
rcu_unregister_thread();
trace_postcopy_ram_fault_thread_exit();
g_free(pfd);
return NULL;
Expand Down
4 changes: 4 additions & 0 deletions migration/ram.c
Original file line number Diff line number Diff line change
Expand Up @@ -989,6 +989,7 @@ static void *multifd_send_thread(void *opaque)
int ret;

trace_multifd_send_thread_start(p->id);
rcu_register_thread();

if (multifd_send_initial_packet(p, &local_err) < 0) {
goto out;
Expand Down Expand Up @@ -1051,6 +1052,7 @@ static void *multifd_send_thread(void *opaque)
p->running = false;
qemu_mutex_unlock(&p->mutex);

rcu_unregister_thread();
trace_multifd_send_thread_end(p->id, p->num_packets, p->num_pages);

return NULL;
Expand Down Expand Up @@ -1220,6 +1222,7 @@ static void *multifd_recv_thread(void *opaque)
int ret;

trace_multifd_recv_thread_start(p->id);
rcu_register_thread();

while (true) {
uint32_t used;
Expand Down Expand Up @@ -1266,6 +1269,7 @@ static void *multifd_recv_thread(void *opaque)
p->running = false;
qemu_mutex_unlock(&p->mutex);

rcu_unregister_thread();
trace_multifd_recv_thread_end(p->id, p->num_packets, p->num_pages);

return NULL;
Expand Down
Loading

0 comments on commit 74637e6

Please sign in to comment.