diff options
author | Jan Kiszka <jan.kiszka@siemens.com> | 2010-05-04 09:45:23 -0300 |
---|---|---|
committer | Marcelo Tosatti <mtosatti@redhat.com> | 2010-05-11 14:02:22 -0300 |
commit | e2bb6f764f395d49c894885b6e4792e105f8d294 (patch) | |
tree | 95c33a7acfb882d07f817c23db80fbb22afb6216 /kvm-all.c | |
parent | f3ff6949966a45ffe3a38aabaef168f3399b82b7 (diff) | |
download | qemu-e2bb6f764f395d49c894885b6e4792e105f8d294.tar.gz qemu-e2bb6f764f395d49c894885b6e4792e105f8d294.tar.bz2 qemu-e2bb6f764f395d49c894885b6e4792e105f8d294.zip |
kvm: synchronize state from cpu context
It is not safe to retrieve the KVM internal state of a given cpu
while its potentially modifying it.
Queue the request to run on cpu context, similarly to qemu-kvm.
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'kvm-all.c')
-rw-r--r-- | kvm-all.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -796,14 +796,22 @@ void kvm_flush_coalesced_mmio_buffer(void) #endif } -void kvm_cpu_synchronize_state(CPUState *env) +static void do_kvm_cpu_synchronize_state(void *_env) { + CPUState *env = _env; + if (!env->kvm_vcpu_dirty) { kvm_arch_get_registers(env); env->kvm_vcpu_dirty = 1; } } +void kvm_cpu_synchronize_state(CPUState *env) +{ + if (!env->kvm_vcpu_dirty) + run_on_cpu(env, do_kvm_cpu_synchronize_state, env); +} + void kvm_cpu_synchronize_post_reset(CPUState *env) { kvm_arch_put_registers(env, KVM_PUT_RESET_STATE); |