bitkeeper revision 1.1236.12.7 (422dacdcZEjp_SXRvSpRKap0KtkBag)
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Tue, 8 Mar 2005 13:47:08 +0000 (13:47 +0000)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Tue, 8 Mar 2005 13:47:08 +0000 (13:47 +0000)
Must always send VIRQ_TIMER to a blocked guest.
Signed-off-by: Keir Fraser <keir.fraser@cl.cam.ac.uk>
xen/arch/x86/time.c
xen/common/schedule.c
xen/include/xen/time.h

index 0bd051954fc2ae7f14b45940b099018c33711fdf..208945ca3390d2c4a4a1031b70019c9da406bdfa 100644 (file)
@@ -296,17 +296,18 @@ static inline void __update_dom_time(struct exec_domain *ed)
     spin_unlock(&d->time_lock);
 }
 
-void update_dom_time(struct exec_domain *ed)
+int update_dom_time(struct exec_domain *ed)
 {
     unsigned long flags;
 
-    if ( ed->domain->shared_info->tsc_timestamp != full_tsc_irq )
-    {
-        read_lock_irqsave(&time_lock, flags);
-        __update_dom_time(ed);
-        read_unlock_irqrestore(&time_lock, flags);
-        send_guest_virq(ed, VIRQ_TIMER);
-    }
+    if ( ed->domain->shared_info->tsc_timestamp == full_tsc_irq )
+        return 0;
+
+    read_lock_irqsave(&time_lock, flags);
+    __update_dom_time(ed);
+    read_unlock_irqrestore(&time_lock, flags);
+
+    return 1;
 }
 
 /* Set clock to <secs,usecs> after 00:00:00 UTC, 1 January, 1970. */
index a0cd4303c28ca223c31b42d3c498df8b8299d38f..be85ec9a8985a016e20ddf6c80a0fde0099d8cd5 100644 (file)
@@ -457,8 +457,8 @@ void __enter_scheduler(void)
     clear_bit(EDF_RUNNING, &prev->ed_flags);
 
     /* Ensure that the domain has an up-to-date time base. */
-    if ( !is_idle_task(next->domain) )
-        update_dom_time(next);
+    if ( !is_idle_task(next->domain) && update_dom_time(next) )
+        send_guest_virq(next, VIRQ_TIMER);
 
     schedule_tail(next);
 
@@ -495,8 +495,8 @@ static void t_timer_fn(unsigned long unused)
 
     TRACE_0D(TRC_SCHED_T_TIMER_FN);
 
-    if ( !is_idle_task(ed->domain) )
-        update_dom_time(ed);
+    if ( !is_idle_task(ed->domain) && update_dom_time(ed) )
+        send_guest_virq(ed, VIRQ_TIMER);
 
     t_timer[ed->processor].expires = NOW() + MILLISECS(10);
     add_ac_timer(&t_timer[ed->processor]);
@@ -508,7 +508,8 @@ static void dom_timer_fn(unsigned long data)
     struct exec_domain *ed = (struct exec_domain *)data;
 
     TRACE_0D(TRC_SCHED_DOM_TIMER_FN);
-    update_dom_time(ed);
+    (void)update_dom_time(ed);
+    send_guest_virq(ed, VIRQ_TIMER);
 }
 
 /* Initialise the data structures. */
index 1e7ba6657ebf0e26feece34cf11f935014ca90d8..b1eeade753e06dea257db1f484236ebd1502df6d 100644 (file)
@@ -54,7 +54,7 @@ s_time_t get_s_time(void);
 #define MILLISECS(_ms)  (((s_time_t)(_ms)) * 1000000ULL )
 #define MICROSECS(_us)  (((s_time_t)(_us)) * 1000ULL )
 
-extern void update_dom_time(struct exec_domain *ed);
+extern int update_dom_time(struct exec_domain *ed);
 extern void do_settime(unsigned long secs, unsigned long usecs, 
                        u64 system_time_base);