From: Avi Kivity <[email protected]>

Since kvm_arch_pre_run() can modify state (and does with
kvm tpr patching), this will cause inconsistent state.

Signed-off-by: Avi Kivity <[email protected]>

diff --git a/qemu-kvm.c b/qemu-kvm.c
index c7fbce8..44e8b75 100644
--- a/qemu-kvm.c
+++ b/qemu-kvm.c
@@ -860,6 +860,11 @@ int pre_kvm_run(kvm_context_t kvm, CPUState *env)
 {
     kvm_arch_pre_run(env, env->kvm_run);
 
+    if (env->kvm_cpu_state.regs_modified) {
+        kvm_arch_put_registers(env);
+        env->kvm_cpu_state.regs_modified = 0;
+    }
+
     pthread_mutex_unlock(&qemu_mutex);
     return 0;
 }
@@ -906,11 +911,6 @@ int kvm_run(CPUState *env)
         run->request_interrupt_window = kvm_arch_try_push_interrupts(env);
 #endif
 
-    if (env->kvm_cpu_state.regs_modified) {
-        kvm_arch_put_registers(env);
-        env->kvm_cpu_state.regs_modified = 0;
-    }
-
     r = pre_kvm_run(kvm, env);
     if (r)
         return r;
--
To unsubscribe from this list: send the line "unsubscribe kvm-commits" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to