From: Avi Kivity <[EMAIL PROTECTED]>

Reset processing moved to the iothread, which can take too long to process.
Move it back to whatever vcpu is executing.

Signed-off-by: Avi Kivity <[EMAIL PROTECTED]>

diff --git a/qemu/qemu-kvm.c b/qemu/qemu-kvm.c
index 89e267c..7a88cdd 100644
--- a/qemu/qemu-kvm.c
+++ b/qemu/qemu-kvm.c
@@ -52,6 +52,7 @@ struct vcpu_info {
     int signalled;
     int stop;
     int stopped;
+    int reload_regs;
 } vcpu_info[256];
 
 pthread_t io_thread;
@@ -307,6 +308,17 @@ static void setup_kernel_sigmask(CPUState *env)
     kvm_set_signal_mask(kvm_context, env->cpu_index, &set);
 }
 
+void qemu_kvm_system_reset_request(void)
+{
+    int i;
+
+    for (i = 0; i < smp_cpus; ++i) {
+       vcpu_info[i].reload_regs = 1;
+       pthread_kill(vcpu_info[i].thread, SIG_IPI);
+    }
+    qemu_system_reset();
+}
+
 static int kvm_main_loop_cpu(CPUState *env)
 {
     struct vcpu_info *info = &vcpu_info[env->cpu_index];
@@ -334,11 +346,10 @@ static int kvm_main_loop_cpu(CPUState *env)
            kvm_cpu_exec(env);
        env->interrupt_request &= ~CPU_INTERRUPT_EXIT;
        kvm_main_loop_wait(env, 0);
-        if (qemu_kvm_reset_requested && env->cpu_index == 0) {
-           qemu_kvm_reset_requested = 0;
-           env->interrupt_request = 0;
-           qemu_system_reset();
-           kvm_arch_load_regs(env);
+        if (info->reload_regs) {
+           info->reload_regs = 0;
+           if (env->cpu_index == 0) /* ap needs to be placed in INIT */
+               kvm_arch_load_regs(env);
        }
     }
     pthread_mutex_unlock(&qemu_mutex);
diff --git a/qemu/qemu-kvm.h b/qemu/qemu-kvm.h
index cae20bc..024a653 100644
--- a/qemu/qemu-kvm.h
+++ b/qemu/qemu-kvm.h
@@ -72,6 +72,8 @@ void kvm_tpr_vcpu_start(CPUState *env);
 
 int qemu_kvm_get_dirty_pages(unsigned long phys_addr, void *buf);
 
+void qemu_kvm_system_reset_request(void);
+
 #ifdef TARGET_PPC
 int handle_powerpc_dcr_read(int vcpu, uint32_t dcrn, uint32_t *data);
 int handle_powerpc_dcr_write(int vcpu,uint32_t dcrn, uint32_t data);
diff --git a/qemu/vl.c b/qemu/vl.c
index e544f7c..b425ab5 100644
--- a/qemu/vl.c
+++ b/qemu/vl.c
@@ -7804,6 +7804,11 @@ void qemu_system_reset_request(void)
     }
     if (cpu_single_env)
         cpu_interrupt(cpu_single_env, CPU_INTERRUPT_EXIT);
+#ifdef USE_KVM
+    if (kvm_allowed)
+        if (!no_reboot)
+            qemu_kvm_system_reset_request();
+#endif
 }
 
 void qemu_system_shutdown_request(void)

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
kvm-commits mailing list
kvm-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-commits

Reply via email to