Commit bd967e05da8cbb2c863b0c75632530966cafcc11
1 parent
f3d6b95e
SMP half-idle fix.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2477 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
8 additions
and
5 deletions
vl.c
| @@ -6298,13 +6298,16 @@ int main_loop(void) | @@ -6298,13 +6298,16 @@ int main_loop(void) | ||
| 6298 | #ifdef CONFIG_PROFILER | 6298 | #ifdef CONFIG_PROFILER |
| 6299 | qemu_time += profile_getclock() - ti; | 6299 | qemu_time += profile_getclock() - ti; |
| 6300 | #endif | 6300 | #endif |
| 6301 | + if (ret == EXCP_HLT) { | ||
| 6302 | + /* Give the next CPU a chance to run. */ | ||
| 6303 | + cur_cpu = env; | ||
| 6304 | + continue; | ||
| 6305 | + } | ||
| 6301 | if (ret != EXCP_HALTED) | 6306 | if (ret != EXCP_HALTED) |
| 6302 | break; | 6307 | break; |
| 6303 | /* all CPUs are halted ? */ | 6308 | /* all CPUs are halted ? */ |
| 6304 | - if (env == cur_cpu) { | ||
| 6305 | - ret = EXCP_HLT; | 6309 | + if (env == cur_cpu) |
| 6306 | break; | 6310 | break; |
| 6307 | - } | ||
| 6308 | } | 6311 | } |
| 6309 | cur_cpu = env; | 6312 | cur_cpu = env; |
| 6310 | 6313 | ||
| @@ -6325,9 +6328,9 @@ int main_loop(void) | @@ -6325,9 +6328,9 @@ int main_loop(void) | ||
| 6325 | if (ret == EXCP_DEBUG) { | 6328 | if (ret == EXCP_DEBUG) { |
| 6326 | vm_stop(EXCP_DEBUG); | 6329 | vm_stop(EXCP_DEBUG); |
| 6327 | } | 6330 | } |
| 6328 | - /* if hlt instruction, we wait until the next IRQ */ | 6331 | + /* If all cpus are halted then wait until the next IRQ */ |
| 6329 | /* XXX: use timeout computed from timers */ | 6332 | /* XXX: use timeout computed from timers */ |
| 6330 | - if (ret == EXCP_HLT) | 6333 | + if (ret == EXCP_HALTED) |
| 6331 | timeout = 10; | 6334 | timeout = 10; |
| 6332 | else | 6335 | else |
| 6333 | timeout = 0; | 6336 | timeout = 0; |