Commit 357c692cca6614ac3583ca39b710a9888a673785
1 parent
9c99d2ab
Revert r5636 to fix icount on hosts w/o high-res clocks
Changeset r5636 changed the timers to run in the alarm callback. The alarm callback can only be called as frequently as the host alarm timer fires. For older Linux hosts and possibly non-Linux hosts, this can be as high as a 1ms granularity. icount calculates the select timeout based on the next deadline and select is usually capable of sleeping for a short period of time than alarm timer granularity. This means that changing the timer callbacks to be based on alarm firing caused timers to fire much later than they ought to when using icount. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5796 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
9 additions
and
9 deletions
vl.c
... | ... | @@ -1624,15 +1624,6 @@ static void try_to_rearm_timer(void *opaque) |
1624 | 1624 | } while ((len == -1 && errno == EINTR) || len > 0); |
1625 | 1625 | #endif |
1626 | 1626 | |
1627 | - /* vm time timers */ | |
1628 | - if (vm_running && likely(!(cur_cpu->singlestep_enabled & SSTEP_NOTIMER))) | |
1629 | - qemu_run_timers(&active_timers[QEMU_TIMER_VIRTUAL], | |
1630 | - qemu_get_clock(vm_clock)); | |
1631 | - | |
1632 | - /* real time timers */ | |
1633 | - qemu_run_timers(&active_timers[QEMU_TIMER_REALTIME], | |
1634 | - qemu_get_clock(rt_clock)); | |
1635 | - | |
1636 | 1627 | if (t->flags & ALARM_FLAG_EXPIRED) { |
1637 | 1628 | alarm_timer->flags &= ~ALARM_FLAG_EXPIRED; |
1638 | 1629 | qemu_rearm_alarm_timer(alarm_timer); |
... | ... | @@ -3629,6 +3620,15 @@ void main_loop_wait(int timeout) |
3629 | 3620 | } |
3630 | 3621 | #endif |
3631 | 3622 | |
3623 | + /* vm time timers */ | |
3624 | + if (vm_running && likely(!(cur_cpu->singlestep_enabled & SSTEP_NOTIMER))) | |
3625 | + qemu_run_timers(&active_timers[QEMU_TIMER_VIRTUAL], | |
3626 | + qemu_get_clock(vm_clock)); | |
3627 | + | |
3628 | + /* real time timers */ | |
3629 | + qemu_run_timers(&active_timers[QEMU_TIMER_REALTIME], | |
3630 | + qemu_get_clock(rt_clock)); | |
3631 | + | |
3632 | 3632 | /* Check bottom-halves last in case any of the earlier events triggered |
3633 | 3633 | them. */ |
3634 | 3634 | qemu_bh_poll(); | ... | ... |