qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

migration: use migration_is_active to represent active state

Wrap the check into a function to make it easy to read.

Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
Message-Id: <20190717005341.14140-1-richardw.yang@linux.intel.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

authored by

Wei Yang and committed by
Dr. David Alan Gilbert
8f8d528e 98b2e3c9

+9 -4
+1
include/migration/misc.h
··· 60 60 void migration_shutdown(void); 61 61 void qemu_start_incoming_migration(const char *uri, Error **errp); 62 62 bool migration_is_idle(void); 63 + bool migration_is_active(MigrationState *); 63 64 void add_migration_state_change_notifier(Notifier *notify); 64 65 void remove_migration_state_change_notifier(Notifier *notify); 65 66 bool migration_in_setup(MigrationState *);
+8 -4
migration/migration.c
··· 1533 1533 qemu_fclose(tmp); 1534 1534 } 1535 1535 1536 - assert((s->state != MIGRATION_STATUS_ACTIVE) && 1537 - (s->state != MIGRATION_STATUS_POSTCOPY_ACTIVE)); 1536 + assert(!migration_is_active(s)); 1538 1537 1539 1538 if (s->state == MIGRATION_STATUS_CANCELLING) { 1540 1539 migrate_set_state(&s->state, MIGRATION_STATUS_CANCELLING, ··· 1701 1700 } 1702 1701 1703 1702 return false; 1703 + } 1704 + 1705 + bool migration_is_active(MigrationState *s) 1706 + { 1707 + return (s->state == MIGRATION_STATUS_ACTIVE || 1708 + s->state == MIGRATION_STATUS_POSTCOPY_ACTIVE); 1704 1709 } 1705 1710 1706 1711 void migrate_init(MigrationState *s) ··· 3266 3271 3267 3272 trace_migration_thread_setup_complete(); 3268 3273 3269 - while (s->state == MIGRATION_STATUS_ACTIVE || 3270 - s->state == MIGRATION_STATUS_POSTCOPY_ACTIVE) { 3274 + while (migration_is_active(s)) { 3271 3275 int64_t current_time; 3272 3276 3273 3277 if (urgent || !qemu_file_rate_limit(s->to_dst_file)) {