qemu-e2k/migration
Ivan Ren 87f3bd8717 migration: always initialise ram_counters for a new migration
This patch fix a multifd migration bug in migration speed calculation, this
problem can be reproduced as follows:
1. start a vm and give a heavy memory write stress to prevent the vm be
   successfully migrated to destination
2. begin a migration with multifd
3. migrate for a long time [actually, this can be measured by transferred bytes]
4. migrate cancel
5. begin a new migration with multifd, the migration will directly run into
   migration_completion phase

Reason as follows:

Migration update bandwidth and s->threshold_size in function
migration_update_counters after BUFFER_DELAY time:

    current_bytes = migration_total_bytes(s);
    transferred = current_bytes - s->iteration_initial_bytes;
    time_spent = current_time - s->iteration_start_time;
    bandwidth = (double)transferred / time_spent;
    s->threshold_size = bandwidth * s->parameters.downtime_limit;

In multifd migration, migration_total_bytes function return
qemu_ftell(s->to_dst_file) + ram_counters.multifd_bytes.
s->iteration_initial_bytes will be initialized to 0 at every new migration,
but ram_counters is a global variable, and history migration data will be
accumulated. So if the ram_counters.multifd_bytes is big enough, it may lead
pending_size >= s->threshold_size become false in migration_iteration_run
after the first migration_update_counters.

Signed-off-by: Ivan Ren <ivanren@tencent.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Wei Yang <richardw.yang@linux.intel.com>
Suggested-by: Wei Yang <richardw.yang@linux.intel.com>
Message-Id: <1564741121-1840-1-git-send-email-ivanren@tencent.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
2019-08-14 17:33:14 +01:00
..
block-dirty-bitmap.c migration/dirty-bitmaps: change bitmap enumeration method 2019-05-28 19:33:31 -04:00
block.c block: Add BlockBackend.ctx 2019-06-04 15:22:22 +02:00
block.h
channel.c
channel.h
colo-failover.c migration/colo.c: Remove redundant input parameter 2019-05-14 17:33:35 +01:00
colo.c migration/colo.c: Add missed filter notify for Xen COLO. 2019-07-02 10:21:07 +08:00
exec.c
exec.h
fd.c migration: Fix fd protocol for incoming defer 2019-06-05 12:43:55 +02:00
fd.h migration: Fix fd protocol for incoming defer 2019-06-05 12:43:55 +02:00
global_state.c
Makefile.objs
migration.c migration: always initialise ram_counters for a new migration 2019-08-14 17:33:14 +01:00
migration.h migration: remove unused field bytes_xfer 2019-08-14 17:33:14 +01:00
page_cache.c Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
page_cache.h
postcopy-ram.c migration/postcopy: make PostcopyDiscardState a static variable 2019-08-14 17:33:14 +01:00
postcopy-ram.h migration/postcopy: make PostcopyDiscardState a static variable 2019-08-14 17:33:14 +01:00
qemu-file-channel.c migration: Add error_desc for file channel errors 2019-08-14 17:33:14 +01:00
qemu-file-channel.h
qemu-file.c migration: Add error_desc for file channel errors 2019-08-14 17:33:14 +01:00
qemu-file.h migration: Add error_desc for file channel errors 2019-08-14 17:33:14 +01:00
qjson.c
qjson.h
ram.c migration/postcopy: use QEMU_IS_ALIGNED to replace host_offset 2019-08-14 17:33:14 +01:00
ram.h Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
rdma.c migration: use migration_in_postcopy() to check POSTCOPY_ACTIVE 2019-08-14 17:33:14 +01:00
rdma.h
savevm.c migration: always initialise ram_counters for a new migration 2019-08-14 17:33:14 +01:00
savevm.h
socket.c Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
socket.h
tls.c
tls.h
trace-events migration: Split log_clear() into smaller chunks 2019-07-15 15:39:03 +02:00
vmstate-types.c Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
vmstate.c Include qemu-common.h exactly where needed 2019-06-12 13:20:20 +02:00
xbzrle.c
xbzrle.h