Add page flipping support on unix outgoing part by stopping VM with the new RunState RUN_STATE_FLIPPING_MIGRATE before invoking migration if unix_page_flipping enabled.
Signed-off-by: Lei Li <li...@linux.vnet.ibm.com> --- migration-unix.c | 13 ++++++++++++- 1 files changed, 12 insertions(+), 1 deletions(-) diff --git a/migration-unix.c b/migration-unix.c index d3a151a..f2bfd38 100644 --- a/migration-unix.c +++ b/migration-unix.c @@ -19,6 +19,7 @@ #include "migration/migration.h" #include "migration/qemu-file.h" #include "block/block.h" +#include "sysemu/sysemu.h" //#define DEBUG_MIGRATION_UNIX @@ -33,11 +34,12 @@ static void unix_wait_for_connect(int fd, void *opaque) { MigrationState *s = opaque; + int ret; if (fd < 0) { DPRINTF("migrate connect error\n"); s->file = NULL; - goto fails; + goto fail; } else { DPRINTF("migrate connect success\n"); @@ -47,6 +49,15 @@ static void unix_wait_for_connect(int fd, void *opaque) goto fail; } + /* Stop VM before invoking migration if unix_page_flipping enabled */ + if (migrate_unix_page_flipping()) { + ret = vm_stop_force_state(RUN_STATE_FLIPPING_MIGRATE); + if (ret < 0) { + DPRINTF("failed to stop VM\n"); + goto fail; + } + } + migrate_fd_connect(s); return; } -- 1.7.7.6