Skip to content

Commit

Permalink
migration: move income process out of multifd
Browse files Browse the repository at this point in the history
Move the call to migration_incoming_process() out of multifd code.  It's
a bit strange that we can migration generic calls in multifd code.
Instead, let multifd_recv_new_channel() return a boolean showing whether
it's ready to continue the incoming migration.

Signed-off-by: Peter Xu <[email protected]>
Message-Id: <[email protected]>
Reviewed-by: Juan Quintela <[email protected]>
Signed-off-by: Dr. David Alan Gilbert <[email protected]>
  • Loading branch information
xzpeter authored and dagrh committed Jul 10, 2018
1 parent eed1cc7 commit 81e6205
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
5 changes: 4 additions & 1 deletion migration/migration.c
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,10 @@ void migration_ioc_process_incoming(QIOChannel *ioc)
migration_incoming_setup(f);
return;
}
multifd_recv_new_channel(ioc);

if (multifd_recv_new_channel(ioc)) {
migration_incoming_process();
}
}

/**
Expand Down
11 changes: 5 additions & 6 deletions migration/ram.c
Original file line number Diff line number Diff line change
Expand Up @@ -1311,7 +1311,8 @@ bool multifd_recv_all_channels_created(void)
return thread_count == atomic_read(&multifd_recv_state->count);
}

void multifd_recv_new_channel(QIOChannel *ioc)
/* Return true if multifd is ready for the migration, otherwise false */
bool multifd_recv_new_channel(QIOChannel *ioc)
{
MultiFDRecvParams *p;
Error *local_err = NULL;
Expand All @@ -1320,15 +1321,15 @@ void multifd_recv_new_channel(QIOChannel *ioc)
id = multifd_recv_initial_packet(ioc, &local_err);
if (id < 0) {
multifd_recv_terminate_threads(local_err);
return;
return false;
}

p = &multifd_recv_state->params[id];
if (p->c != NULL) {
error_setg(&local_err, "multifd: received id '%d' already setup'",
id);
multifd_recv_terminate_threads(local_err);
return;
return false;
}
p->c = ioc;
object_ref(OBJECT(ioc));
Expand All @@ -1339,9 +1340,7 @@ void multifd_recv_new_channel(QIOChannel *ioc)
qemu_thread_create(&p->thread, p->name, multifd_recv_thread, p,
QEMU_THREAD_JOINABLE);
atomic_inc(&multifd_recv_state->count);
if (multifd_recv_state->count == migrate_multifd_channels()) {
migration_incoming_process();
}
return multifd_recv_state->count == migrate_multifd_channels();
}

/**
Expand Down
2 changes: 1 addition & 1 deletion migration/ram.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ int multifd_save_cleanup(Error **errp);
int multifd_load_setup(void);
int multifd_load_cleanup(Error **errp);
bool multifd_recv_all_channels_created(void);
void multifd_recv_new_channel(QIOChannel *ioc);
bool multifd_recv_new_channel(QIOChannel *ioc);

uint64_t ram_pagesize_summary(void);
int ram_save_queue_pages(const char *rbname, ram_addr_t start, ram_addr_t len);
Expand Down

0 comments on commit 81e6205

Please sign in to comment.