Skip to content

Commit

Permalink
migration: static variables will not be reset at second migration
Browse files Browse the repository at this point in the history
The static variables in migration_bitmap_sync will not be reset in
the case of a second attempted migration.

Signed-off-by: ChenLiang <[email protected]>
Signed-off-by: Gonglei <[email protected]>
Reviewed-by: Dr. David Alan Gilbert <[email protected]>
Signed-off-by: Amit Shah <[email protected]>
  • Loading branch information
ChenLiang authored and amit3s committed Nov 20, 2014
1 parent af3ff19 commit 6c1b663
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions arch_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -486,15 +486,23 @@ static void migration_bitmap_sync_range(ram_addr_t start, ram_addr_t length)


/* Needs iothread lock! */
/* Fix me: there are too many global variables used in migration process. */
static int64_t start_time;
static int64_t bytes_xfer_prev;
static int64_t num_dirty_pages_period;

static void migration_bitmap_sync_init(void)
{
start_time = 0;
bytes_xfer_prev = 0;
num_dirty_pages_period = 0;
}

static void migration_bitmap_sync(void)
{
RAMBlock *block;
uint64_t num_dirty_pages_init = migration_dirty_pages;
MigrationState *s = migrate_get_current();
static int64_t start_time;
static int64_t bytes_xfer_prev;
static int64_t num_dirty_pages_period;
int64_t end_time;
int64_t bytes_xfer_now;
static uint64_t xbzrle_cache_miss_prev;
Expand Down Expand Up @@ -774,6 +782,7 @@ static int ram_save_setup(QEMUFile *f, void *opaque)
mig_throttle_on = false;
dirty_rate_high_cnt = 0;
bitmap_sync_count = 0;
migration_bitmap_sync_init();

if (migrate_use_xbzrle()) {
XBZRLE_cache_lock();
Expand Down

0 comments on commit 6c1b663

Please sign in to comment.