migration.c (7dcb3c87d87cbf3359c9bbef8066e5195ee92f4d) migration.c (3a6813b68cf21a366522564f83f885bf2657dcc8)
1/*
2 * QEMU live migration
3 *
4 * Copyright IBM, Corp. 2008
5 *
6 * Authors:
7 * Anthony Liguori <aliguori@us.ibm.com>
8 *

--- 1392 unchanged lines hidden (view full) ---

1401 /*
1402 * Close the file handle without the lock to make sure the
1403 * critical section won't block for long.
1404 */
1405 migration_ioc_unregister_yank_from_file(tmp);
1406 qemu_fclose(tmp);
1407 }
1408
1/*
2 * QEMU live migration
3 *
4 * Copyright IBM, Corp. 2008
5 *
6 * Authors:
7 * Anthony Liguori <aliguori@us.ibm.com>
8 *

--- 1392 unchanged lines hidden (view full) ---

1401 /*
1402 * Close the file handle without the lock to make sure the
1403 * critical section won't block for long.
1404 */
1405 migration_ioc_unregister_yank_from_file(tmp);
1406 qemu_fclose(tmp);
1407 }
1408
1409 assert(!migration_is_active(s));
1409 assert(!migration_is_active());
1410
1411 if (s->state == MIGRATION_STATUS_CANCELLING) {
1412 migrate_set_state(&s->state, MIGRATION_STATUS_CANCELLING,
1413 MIGRATION_STATUS_CANCELLED);
1414 }
1415
1416 if (s->error) {
1417 /* It is used on info migrate. We can't free it */

--- 214 unchanged lines hidden (view full) ---

1632 return false;
1633 case MIGRATION_STATUS__MAX:
1634 g_assert_not_reached();
1635 }
1636
1637 return false;
1638}
1639
1410
1411 if (s->state == MIGRATION_STATUS_CANCELLING) {
1412 migrate_set_state(&s->state, MIGRATION_STATUS_CANCELLING,
1413 MIGRATION_STATUS_CANCELLED);
1414 }
1415
1416 if (s->error) {
1417 /* It is used on info migrate. We can't free it */

--- 214 unchanged lines hidden (view full) ---

1632 return false;
1633 case MIGRATION_STATUS__MAX:
1634 g_assert_not_reached();
1635 }
1636
1637 return false;
1638}
1639
1640bool migration_is_active(MigrationState *s)
1640bool migration_is_active(void)
1641{
1641{
1642 MigrationState *s = current_migration;
1643
1642 return (s->state == MIGRATION_STATUS_ACTIVE ||
1643 s->state == MIGRATION_STATUS_POSTCOPY_ACTIVE);
1644}
1645
1646bool migrate_mode_is_cpr(MigrationState *s)
1647{
1648 return s->parameters.mode == MIG_MODE_CPR_REBOOT;
1649}

--- 1806 unchanged lines hidden (view full) ---

3456
3457 qemu_savevm_wait_unplug(s, MIGRATION_STATUS_SETUP,
3458 MIGRATION_STATUS_ACTIVE);
3459
3460 s->setup_time = qemu_clock_get_ms(QEMU_CLOCK_HOST) - setup_start;
3461
3462 trace_migration_thread_setup_complete();
3463
1644 return (s->state == MIGRATION_STATUS_ACTIVE ||
1645 s->state == MIGRATION_STATUS_POSTCOPY_ACTIVE);
1646}
1647
1648bool migrate_mode_is_cpr(MigrationState *s)
1649{
1650 return s->parameters.mode == MIG_MODE_CPR_REBOOT;
1651}

--- 1806 unchanged lines hidden (view full) ---

3458
3459 qemu_savevm_wait_unplug(s, MIGRATION_STATUS_SETUP,
3460 MIGRATION_STATUS_ACTIVE);
3461
3462 s->setup_time = qemu_clock_get_ms(QEMU_CLOCK_HOST) - setup_start;
3463
3464 trace_migration_thread_setup_complete();
3465
3464 while (migration_is_active(s)) {
3466 while (migration_is_active()) {
3465 if (urgent || !migration_rate_exceeded(s->to_dst_file)) {
3466 MigIterateState iter_state = migration_iteration_run(s);
3467 if (iter_state == MIG_ITERATE_SKIP) {
3468 continue;
3469 } else if (iter_state == MIG_ITERATE_BREAK) {
3470 break;
3471 }
3472 }

--- 129 unchanged lines hidden (view full) ---

3602 * Start VM from BH handler to avoid write-fault lock here.
3603 * UFFD-WP protection for the whole RAM is already enabled so
3604 * calling VM state change notifiers from vm_start() would initiate
3605 * writes to virtio VQs memory which is in write-protected region.
3606 */
3607 migration_bh_schedule(bg_migration_vm_start_bh, s);
3608 bql_unlock();
3609
3467 if (urgent || !migration_rate_exceeded(s->to_dst_file)) {
3468 MigIterateState iter_state = migration_iteration_run(s);
3469 if (iter_state == MIG_ITERATE_SKIP) {
3470 continue;
3471 } else if (iter_state == MIG_ITERATE_BREAK) {
3472 break;
3473 }
3474 }

--- 129 unchanged lines hidden (view full) ---

3604 * Start VM from BH handler to avoid write-fault lock here.
3605 * UFFD-WP protection for the whole RAM is already enabled so
3606 * calling VM state change notifiers from vm_start() would initiate
3607 * writes to virtio VQs memory which is in write-protected region.
3608 */
3609 migration_bh_schedule(bg_migration_vm_start_bh, s);
3610 bql_unlock();
3611
3610 while (migration_is_active(s)) {
3612 while (migration_is_active()) {
3611 MigIterateState iter_state = bg_migration_iteration_run(s);
3612 if (iter_state == MIG_ITERATE_SKIP) {
3613 continue;
3614 } else if (iter_state == MIG_ITERATE_BREAK) {
3615 break;
3616 }
3617
3618 /*

--- 217 unchanged lines hidden ---
3613 MigIterateState iter_state = bg_migration_iteration_run(s);
3614 if (iter_state == MIG_ITERATE_SKIP) {
3615 continue;
3616 } else if (iter_state == MIG_ITERATE_BREAK) {
3617 break;
3618 }
3619
3620 /*

--- 217 unchanged lines hidden ---