qemu-e2k/target/i386
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
..
arch_dump.c hmp: fix "dump-quest-memory" segfault 2017-03-31 11:53:42 +01:00
arch_memory_mapping.c
bpt_helper.c
cc_helper_template.h
cc_helper.c
cpu-qom.h i386: Define static "base" CPU model 2017-02-27 13:23:27 -03:00
cpu.c qdev: Replace cannot_instantiate_with_device_add_yet with !user_creatable 2017-05-17 10:37:00 -03:00
cpu.h i386: Don't override -cpu options on -cpu host/max 2017-03-28 16:41:10 -03:00
excp_helper.c shutdown: Add source information to SHUTDOWN and RESET 2017-05-23 13:28:17 +02:00
fpu_helper.c linux-user: Add signal handling support for x86_64 2017-02-27 23:10:02 +01:00
gdbstub.c
hax-all.c migration: Mark CPU states dirty before incoming migration/loadvm 2017-06-06 08:53:24 +10:00
hax-darwin.c hax: add Darwin support 2017-01-19 22:07:46 +01:00
hax-darwin.h hax: add Darwin support 2017-01-19 22:07:46 +01:00
hax-i386.h hax: add Darwin support 2017-01-19 22:07:46 +01:00
hax-interface.h
hax-mem.c hax: Fix memory mapping de-duplication logic 2017-05-05 12:10:00 +02:00
hax-windows.c
hax-windows.h
helper.c shutdown: Add source information to SHUTDOWN and RESET 2017-05-23 13:28:17 +02:00
helper.h target-i386: correctly propagate retaddr into SVM helpers 2017-02-16 18:37:01 +01:00
hyperv.c
hyperv.h
int_helper.c
kvm_i386.h
kvm-stub.c
kvm.c shutdown: Add source information to SHUTDOWN and RESET 2017-05-23 13:28:17 +02:00
machine.c migration/i386: Remove support for pre-0.12 formats 2017-05-11 16:08:51 -03:00
Makefile.objs hax: add Darwin support 2017-01-19 22:07:46 +01:00
mem_helper.c
misc_helper.c target/i386/misc_helper: wrap BQL around another IRQ generator 2017-04-10 10:14:50 +01:00
monitor.c monitor: Fix crashes when using HMP commands without CPU 2017-02-21 18:29:01 +00:00
mpx_helper.c
ops_sse_header.h
ops_sse.h
seg_helper.c target-i386: defer VMEXIT to do_interrupt 2017-03-09 10:41:48 +00:00
shift_helper_template.h
smm_helper.c tcg: drop global lock during TCG code execution 2017-02-24 10:32:45 +00:00
svm_helper.c target-i386: defer VMEXIT to do_interrupt 2017-03-09 10:41:48 +00:00
svm.h
TODO
trace-events
translate.c tcg/i386: Check the size of instruction being translated 2017-03-24 11:49:38 +01:00