Commit 5bec1d1deac8826de21081a4157e14fa48b12805
1 parent
6abfbd79
Run timers from host alarm timer callback
This further cleans up the main loop getting it a lot closer to what a main loop should be. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5636 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
9 additions
and
10 deletions
vl.c
... | ... | @@ -1700,6 +1700,15 @@ static void try_to_rearm_timer(void *opaque) |
1700 | 1700 | len = read(alarm_timer_rfd, buffer, sizeof(buffer)); |
1701 | 1701 | } while ((len == -1 && errno == EINTR) || len > 0); |
1702 | 1702 | |
1703 | + /* vm time timers */ | |
1704 | + if (vm_running && likely(!(cur_cpu->singlestep_enabled & SSTEP_NOTIMER))) | |
1705 | + qemu_run_timers(&active_timers[QEMU_TIMER_VIRTUAL], | |
1706 | + qemu_get_clock(vm_clock)); | |
1707 | + | |
1708 | + /* real time timers */ | |
1709 | + qemu_run_timers(&active_timers[QEMU_TIMER_REALTIME], | |
1710 | + qemu_get_clock(rt_clock)); | |
1711 | + | |
1703 | 1712 | if (t->flags & ALARM_FLAG_EXPIRED) { |
1704 | 1713 | alarm_timer->flags &= ~ALARM_FLAG_EXPIRED; |
1705 | 1714 | qemu_rearm_alarm_timer(alarm_timer); |
... | ... | @@ -4551,16 +4560,6 @@ void main_loop_wait(int timeout) |
4551 | 4560 | } |
4552 | 4561 | #endif |
4553 | 4562 | |
4554 | - if (vm_running) { | |
4555 | - if (likely(!(cur_cpu->singlestep_enabled & SSTEP_NOTIMER))) | |
4556 | - qemu_run_timers(&active_timers[QEMU_TIMER_VIRTUAL], | |
4557 | - qemu_get_clock(vm_clock)); | |
4558 | - } | |
4559 | - | |
4560 | - /* real time timers */ | |
4561 | - qemu_run_timers(&active_timers[QEMU_TIMER_REALTIME], | |
4562 | - qemu_get_clock(rt_clock)); | |
4563 | - | |
4564 | 4563 | /* Check bottom-halves last in case any of the earlier events triggered |
4565 | 4564 | them. */ |
4566 | 4565 | qemu_bh_poll(); | ... | ... |