qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [5796] Revert r5636 to fix icount on hosts w/o high-res clocks
@ 2008-11-25 17:26 Anthony Liguori
  0 siblings, 0 replies; only message in thread
From: Anthony Liguori @ 2008-11-25 17:26 UTC (permalink / raw)
  To: qemu-devel

Revision: 5796
          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5796
Author:   aliguori
Date:     2008-11-25 17:26:09 +0000 (Tue, 25 Nov 2008)

Log Message:
-----------
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>

Modified Paths:
--------------
    trunk/vl.c

Modified: trunk/vl.c
===================================================================
--- trunk/vl.c	2008-11-25 17:19:45 UTC (rev 5795)
+++ trunk/vl.c	2008-11-25 17:26:09 UTC (rev 5796)
@@ -1624,15 +1624,6 @@
     } while ((len == -1 && errno == EINTR) || len > 0);
 #endif
 
-    /* vm time timers */
-    if (vm_running && likely(!(cur_cpu->singlestep_enabled & SSTEP_NOTIMER)))
-        qemu_run_timers(&active_timers[QEMU_TIMER_VIRTUAL],
-                        qemu_get_clock(vm_clock));
-
-    /* real time timers */
-    qemu_run_timers(&active_timers[QEMU_TIMER_REALTIME],
-                    qemu_get_clock(rt_clock));
-
     if (t->flags & ALARM_FLAG_EXPIRED) {
         alarm_timer->flags &= ~ALARM_FLAG_EXPIRED;
         qemu_rearm_alarm_timer(alarm_timer);
@@ -3629,6 +3620,15 @@
     }
 #endif
 
+    /* vm time timers */
+    if (vm_running && likely(!(cur_cpu->singlestep_enabled & SSTEP_NOTIMER)))
+        qemu_run_timers(&active_timers[QEMU_TIMER_VIRTUAL],
+                        qemu_get_clock(vm_clock));
+
+    /* real time timers */
+    qemu_run_timers(&active_timers[QEMU_TIMER_REALTIME],
+                    qemu_get_clock(rt_clock));
+
     /* Check bottom-halves last in case any of the earlier events triggered
        them.  */
     qemu_bh_poll();

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-11-25 17:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-25 17:26 [Qemu-devel] [5796] Revert r5636 to fix icount on hosts w/o high-res clocks Anthony Liguori

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).