aboutsummaryrefslogtreecommitdiff
path: root/migration/migration.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2017-06-07 15:06:42 +0100
committerPeter Maydell <peter.maydell@linaro.org>2017-06-07 15:06:42 +0100
commitb55a69fe5f0a504dac6359bb7e99a72b130c3661 (patch)
treee9c0896f1aa5baf5336f98cd363777079a8a0656 /migration/migration.c
parent0db1851becbefe3e50cfc03776fb1f75817376af (diff)
parenteefff991d059d299b917627d2a95bce34d2f97f3 (diff)
Merge remote-tracking branch 'remotes/juanquintela/tags/migration/20170607' into staging
migration/next for 20170607 # gpg: Signature made Wed 07 Jun 2017 10:02:01 BST # gpg: using RSA key 0xF487EF185872D723 # gpg: Good signature from "Juan Quintela <quintela@redhat.com>" # gpg: aka "Juan Quintela <quintela@trasno.org>" # Primary key fingerprint: 1899 FF8E DEBF 58CC EE03 4B82 F487 EF18 5872 D723 * remotes/juanquintela/tags/migration/20170607: qemu/migration: fix the double free problem on from_src_file ram: Make RAMState dynamic ram: Use MigrationStats for statistics ram: Move ZERO_TARGET_PAGE inside XBZRLE ram: Call migration_page_queue_free() at ram_migration_cleanup() ram: We only print throttling information sometimes ram: Unfold get_xbzrle_cache_stats() into populate_ram_info() Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'migration/migration.c')
-rw-r--r--migration/migration.c59
1 files changed, 25 insertions, 34 deletions
diff --git a/migration/migration.c b/migration/migration.c
index 48c94c9ca1..6f0705af1e 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -588,40 +588,42 @@ static bool migration_is_setup_or_active(int state)
}
}
-static void get_xbzrle_cache_stats(MigrationInfo *info)
-{
- if (migrate_use_xbzrle()) {
- info->has_xbzrle_cache = true;
- info->xbzrle_cache = g_malloc0(sizeof(*info->xbzrle_cache));
- info->xbzrle_cache->cache_size = migrate_xbzrle_cache_size();
- info->xbzrle_cache->bytes = xbzrle_mig_bytes_transferred();
- info->xbzrle_cache->pages = xbzrle_mig_pages_transferred();
- info->xbzrle_cache->cache_miss = xbzrle_mig_pages_cache_miss();
- info->xbzrle_cache->cache_miss_rate = xbzrle_mig_cache_miss_rate();
- info->xbzrle_cache->overflow = xbzrle_mig_pages_overflow();
- }
-}
-
static void populate_ram_info(MigrationInfo *info, MigrationState *s)
{
info->has_ram = true;
info->ram = g_malloc0(sizeof(*info->ram));
- info->ram->transferred = ram_bytes_transferred();
+ info->ram->transferred = ram_counters.transferred;
info->ram->total = ram_bytes_total();
- info->ram->duplicate = dup_mig_pages_transferred();
+ info->ram->duplicate = ram_counters.duplicate;
/* legacy value. It is not used anymore */
info->ram->skipped = 0;
- info->ram->normal = norm_mig_pages_transferred();
- info->ram->normal_bytes = norm_mig_pages_transferred() *
+ info->ram->normal = ram_counters.normal;
+ info->ram->normal_bytes = ram_counters.normal *
qemu_target_page_size();
info->ram->mbps = s->mbps;
- info->ram->dirty_sync_count = ram_dirty_sync_count();
- info->ram->postcopy_requests = ram_postcopy_requests();
+ info->ram->dirty_sync_count = ram_counters.dirty_sync_count;
+ info->ram->postcopy_requests = ram_counters.postcopy_requests;
info->ram->page_size = qemu_target_page_size();
+ if (migrate_use_xbzrle()) {
+ info->has_xbzrle_cache = true;
+ info->xbzrle_cache = g_malloc0(sizeof(*info->xbzrle_cache));
+ info->xbzrle_cache->cache_size = migrate_xbzrle_cache_size();
+ info->xbzrle_cache->bytes = xbzrle_counters.bytes;
+ info->xbzrle_cache->pages = xbzrle_counters.pages;
+ info->xbzrle_cache->cache_miss = xbzrle_counters.cache_miss;
+ info->xbzrle_cache->cache_miss_rate = xbzrle_counters.cache_miss_rate;
+ info->xbzrle_cache->overflow = xbzrle_counters.overflow;
+ }
+
+ if (cpu_throttle_active()) {
+ info->has_cpu_throttle_percentage = true;
+ info->cpu_throttle_percentage = cpu_throttle_get_percentage();
+ }
+
if (s->state != MIGRATION_STATUS_COMPLETED) {
info->ram->remaining = ram_bytes_remaining();
- info->ram->dirty_pages_rate = ram_dirty_pages_rate();
+ info->ram->dirty_pages_rate = ram_counters.dirty_pages_rate;
}
}
@@ -659,12 +661,6 @@ MigrationInfo *qmp_query_migrate(Error **errp)
info->disk->total = blk_mig_bytes_total();
}
- if (cpu_throttle_active()) {
- info->has_cpu_throttle_percentage = true;
- info->cpu_throttle_percentage = cpu_throttle_get_percentage();
- }
-
- get_xbzrle_cache_stats(info);
break;
case MIGRATION_STATUS_POSTCOPY_ACTIVE:
/* Mostly the same as active; TODO add some postcopy stats */
@@ -687,15 +683,12 @@ MigrationInfo *qmp_query_migrate(Error **errp)
info->disk->total = blk_mig_bytes_total();
}
- get_xbzrle_cache_stats(info);
break;
case MIGRATION_STATUS_COLO:
info->has_status = true;
/* TODO: display COLO specific information (checkpoint info etc.) */
break;
case MIGRATION_STATUS_COMPLETED:
- get_xbzrle_cache_stats(info);
-
info->has_status = true;
info->has_total_time = true;
info->total_time = s->total_time;
@@ -955,8 +948,6 @@ static void migrate_fd_cleanup(void *opaque)
qemu_bh_delete(s->cleanup_bh);
s->cleanup_bh = NULL;
- migration_page_queue_free();
-
if (s->to_dst_file) {
trace_migrate_fd_cleanup();
qemu_mutex_unlock_iothread();
@@ -2027,8 +2018,8 @@ static void *migration_thread(void *opaque)
bandwidth, threshold_size);
/* if we haven't sent anything, we don't want to recalculate
10000 is a small enough number for our purposes */
- if (ram_dirty_pages_rate() && transferred_bytes > 10000) {
- s->expected_downtime = ram_dirty_pages_rate() *
+ if (ram_counters.dirty_pages_rate && transferred_bytes > 10000) {
+ s->expected_downtime = ram_counters.dirty_pages_rate *
qemu_target_page_size() / bandwidth;
}