Commit bd967e05da8cbb2c863b0c75632530966cafcc11

Authored by pbrook
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
... ... @@ -6298,13 +6298,16 @@ int main_loop(void)
6298 6298 #ifdef CONFIG_PROFILER
6299 6299 qemu_time += profile_getclock() - ti;
6300 6300 #endif
  6301 + if (ret == EXCP_HLT) {
  6302 + /* Give the next CPU a chance to run. */
  6303 + cur_cpu = env;
  6304 + continue;
  6305 + }
6301 6306 if (ret != EXCP_HALTED)
6302 6307 break;
6303 6308 /* all CPUs are halted ? */
6304   - if (env == cur_cpu) {
6305   - ret = EXCP_HLT;
  6309 + if (env == cur_cpu)
6306 6310 break;
6307   - }
6308 6311 }
6309 6312 cur_cpu = env;
6310 6313  
... ... @@ -6325,9 +6328,9 @@ int main_loop(void)
6325 6328 if (ret == EXCP_DEBUG) {
6326 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 6332 /* XXX: use timeout computed from timers */
6330   - if (ret == EXCP_HLT)
  6333 + if (ret == EXCP_HALTED)
6331 6334 timeout = 10;
6332 6335 else
6333 6336 timeout = 0;
... ...