]> git.proxmox.com Git - mirror_qemu.git/commit - vl.c
vl: Move cpu_synchronize_all_states() into qemu_system_reset()
authorDavid Gibson <david@gibson.dropbear.id.au>
Mon, 4 Apr 2016 08:42:36 +0000 (18:42 +1000)
committerDavid Gibson <david@gibson.dropbear.id.au>
Tue, 5 Apr 2016 00:49:10 +0000 (10:49 +1000)
commitefdaf797de009e194db89dcd8b171fa35181a6f2
treeb54c62d7720e122644a945e036d443e339d6c0ec
parentf40eb921da78d7524f4d1d96a5c04c77c4a26a28
vl: Move cpu_synchronize_all_states() into qemu_system_reset()

There are currently 3 calls to qemu_system_reset() in vl.c.  Two of them
are immediately preceded by a cpu_synchronize_all_states9) and the
remaining one should be.

The one which doesn't is the very first reset called directly from main().
Without a cpu_synchronize_all_states(), kvm_vcpu_dirty is false at this
point from the earlier cpu_synchronize_all_post_init().  That's incorrect
because the reset path is quite likely to update the CPU state, and that
updated state should be pushed back to KVM, not overwritten with stale
data pushed to KVM immediately after init.

This patch moves the call to cpu_synchronize_all_states() into
qemu_system_reset() for safety, so it is always called.  AFAICT this should
be safe for the handful of callers outside vl.c - these all appear to be in
places where the cpu state is already synchronized so the extra call
will be a no-op.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Tested-by: Laurent Vivier <lvivier@redhat.com>
vl.c