qemu/migration
David Gibson 75e972dab5 migration: Mark CPU states dirty before incoming migration/loadvm
As a rule, CPU internal state should never be updated when
!cpu->kvm_vcpu_dirty (or the HAX equivalent).  If that is done, then
subsequent calls to cpu_synchronize_state() - usually safe and idempotent -
will clobber state.

However, we routinely do this during a loadvm or incoming migration.
Usually this is called shortly after a reset, which will clear all the cpu
dirty flags with cpu_synchronize_all_post_reset().  Nothing is expected
to set the dirty flags again before the cpu state is loaded from the
incoming stream.

This means that it isn't safe to call cpu_synchronize_state() from a
post_load handler, which is non-obvious and potentially inconvenient.

We could cpu_synchronize_all_state() before the loadvm, but that would be
overkill since a) we expect the state to already be synchronized from the
reset and b) we expect to completely rewrite the state with a call to
cpu_synchronize_all_post_init() at the end of qemu_loadvm_state().

To clear this up, this patch introduces cpu_synchronize_pre_loadvm() and
associated helpers, which simply marks the cpu state as dirty without
actually changing anything.  i.e. it says we want to discard any existing
KVM (or HAX) state and replace it with what we're going to load.

Cc: Juan Quintela <quintela@redhat.com>
Cc: Dave Gilbert <dgilbert@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Juan Quintela <quintela@redhat.com>
2017-06-06 08:53:24 +10:00
..
Makefile.objs migration: Make savevm.c target independent 2017-05-18 19:21:00 +02:00
block.c migration: Move include/migration/block.h into migration/ 2017-06-01 18:49:24 +02:00
block.h migration: Move include/migration/block.h into migration/ 2017-06-01 18:49:24 +02:00
channel.c migration: Export tls.c functions in its own file 2017-06-01 18:49:23 +02:00
channel.h migration: Split migration/channel.c for channel operations 2017-05-18 19:20:24 +02:00
colo-comm.c migration: Remove vmstate.h from migration.h 2017-05-18 19:20:59 +02:00
colo-failover.c COLO: Implement the process of failover for primary VM 2016-10-30 15:17:39 +05:30
colo.c migration: Move include/migration/block.h into migration/ 2017-06-01 18:49:24 +02:00
exec.c migration: Export exec.c functions in its own file 2017-06-01 18:49:22 +02:00
exec.h migration: Export exec.c functions in its own file 2017-06-01 18:49:22 +02:00
fd.c migration: Export fd.c functions in its own file 2017-06-01 18:49:22 +02:00
fd.h migration: Export fd.c functions in its own file 2017-06-01 18:49:22 +02:00
migration.c migration: Move include/migration/block.h into migration/ 2017-06-01 18:49:24 +02:00
page_cache.c migration: Move page_cache.c to migration/ 2017-05-17 12:04:59 +02:00
page_cache.h migration: Move page_cache.c to migration/ 2017-05-17 12:04:59 +02:00
postcopy-ram.c migration: Export ram.c functions in its own file 2017-06-01 18:49:23 +02:00
postcopy-ram.h migration: Move postcopy stuff to postcopy-ram.c 2017-05-17 12:04:59 +02:00
qemu-file-channel.c migration: Split qemu-file.h 2017-06-01 18:49:22 +02:00
qemu-file-channel.h migration: Export qemu-file-channel.c functions in its own file 2017-05-18 19:20:50 +02:00
qemu-file.c migration: Split qemu-file.h 2017-06-01 18:49:22 +02:00
qemu-file.h migration: Split qemu-file.h 2017-06-01 18:49:22 +02:00
qjson.c migration: Move qjson.h to migration/ 2017-05-18 19:20:59 +02:00
qjson.h migration: Move qjson.h to migration/ 2017-05-18 19:20:59 +02:00
ram.c migration: Export ram.c functions in its own file 2017-06-01 18:49:23 +02:00
ram.h migration: Export ram.c functions in its own file 2017-06-01 18:49:23 +02:00
rdma.c migration: Export ram.c functions in its own file 2017-06-01 18:49:23 +02:00
rdma.h migration: Export rdma.c functions in its own file 2017-06-01 18:49:23 +02:00
savevm.c migration: Mark CPU states dirty before incoming migration/loadvm 2017-06-06 08:53:24 +10:00
savevm.h migration: Create savevm.h for functions exported from savevm.c 2017-05-31 09:39:19 +02:00
socket.c migration: Export socket.c functions in its own file 2017-06-01 18:49:23 +02:00
socket.h migration: Export socket.c functions in its own file 2017-06-01 18:49:23 +02:00
tls.c migration: Export tls.c functions in its own file 2017-06-01 18:49:23 +02:00
tls.h migration: Export tls.c functions in its own file 2017-06-01 18:49:23 +02:00
trace-events migration: Extra tracing 2017-05-04 10:41:23 +02:00
vmstate-types.c migration: Split qemu-file.h 2017-06-01 18:49:22 +02:00
vmstate.c migration: Split qemu-file.h 2017-06-01 18:49:22 +02:00
xbzrle.c migration: Create migration/xbzrle.h 2017-05-18 18:04:54 +02:00
xbzrle.h migration: Create migration/xbzrle.h 2017-05-18 18:04:54 +02:00