summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorpbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162>2007-03-11 18:54:57 +0000
committerpbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162>2007-03-11 18:54:57 +0000
commitbd967e05da8cbb2c863b0c75632530966cafcc11 (patch)
treebfb4a9fa69feca8a36f30b7a70092c04838c69d1
parentf3d6b95e835ba12e9cfdca76124897122c47cd1b (diff)
downloadfocaccia-qemu-bd967e05da8cbb2c863b0c75632530966cafcc11.tar.gz
focaccia-qemu-bd967e05da8cbb2c863b0c75632530966cafcc11.zip
SMP half-idle fix.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2477 c046a42c-6fe2-441c-8c8c-71466251a162
-rw-r--r--vl.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/vl.c b/vl.c
index e871c8cea9..742f9000fe 100644
--- a/vl.c
+++ b/vl.c
@@ -6298,13 +6298,16 @@ int main_loop(void)
 #ifdef CONFIG_PROFILER
                 qemu_time += profile_getclock() - ti;
 #endif
+                if (ret == EXCP_HLT) {
+                    /* Give the next CPU a chance to run.  */
+                    cur_cpu = env;
+                    continue;
+                }
                 if (ret != EXCP_HALTED)
                     break;
                 /* all CPUs are halted ? */
-                if (env == cur_cpu) {
-                    ret = EXCP_HLT;
+                if (env == cur_cpu)
                     break;
-                }
             }
             cur_cpu = env;
 
@@ -6325,9 +6328,9 @@ int main_loop(void)
             if (ret == EXCP_DEBUG) {
                 vm_stop(EXCP_DEBUG);
             }
-            /* if hlt instruction, we wait until the next IRQ */
+            /* If all cpus are halted then wait until the next IRQ */
             /* XXX: use timeout computed from timers */
-            if (ret == EXCP_HLT)
+            if (ret == EXCP_HALTED)
                 timeout = 10;
             else
                 timeout = 0;