aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>2005-03-08 09:55:22 +0000
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>2005-03-08 09:55:22 +0000
commitbbebb1de83bdc97d3394aca04a8bce2b97738cf1 (patch)
treec2c1c4e1a8c1226d09d4da15bd265a162f50c8be
parent39b6d495a8198d758004156c7f5933d84286bb45 (diff)
parentb2cc8f556c6982c55ea38fb0dfa3eb2249d5b95b (diff)
downloadxen-bbebb1de83bdc97d3394aca04a8bce2b97738cf1.tar.gz
xen-bbebb1de83bdc97d3394aca04a8bce2b97738cf1.tar.bz2
xen-bbebb1de83bdc97d3394aca04a8bce2b97738cf1.zip
bitkeeper revision 1.1159.258.24 (422d768ae6_z9fpLLsp1seSXtGA5qA)
Merge firebug.cl.cam.ac.uk:/auto/groups/xeno-xenod/BK/xen-2.0-testing.bk into firebug.cl.cam.ac.uk:/local/scratch/kaf24/xen-2.0-testing.bk
-rw-r--r--BitKeeper/etc/logging_ok1
-rw-r--r--xen/arch/x86/domain.c3
-rw-r--r--xen/arch/x86/time.c16
-rw-r--r--xen/common/domain.c3
-rw-r--r--xen/common/schedule.c18
-rw-r--r--xen/include/xen/sched.h3
-rw-r--r--xen/include/xen/time.h3
7 files changed, 25 insertions, 22 deletions
diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok
index 935727fd0b..d54268186e 100644
--- a/BitKeeper/etc/logging_ok
+++ b/BitKeeper/etc/logging_ok
@@ -27,6 +27,7 @@ iap10@tetris.cl.cam.ac.uk
jws22@gauntlet.cl.cam.ac.uk
jws@cairnwell.research
kaf24@camelot.eng.3leafnetworks.com
+kaf24@firebug.cl.cam.ac.uk
kaf24@freefall.cl.cam.ac.uk
kaf24@labyrinth.cl.cam.ac.uk
kaf24@penguin.local
diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 21cfdd9515..9c81c9c718 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -869,9 +869,6 @@ int construct_dom0(struct domain *p,
l1start = l1tab = (l1_pgentry_t *)l2_pgentry_to_phys(*l2tab);
}
- /* Set up shared-info area. */
- update_dom_time(p->shared_info);
- p->shared_info->domain_time = 0;
/* Mask all upcalls... */
for ( i = 0; i < MAX_VIRT_CPUS; i++ )
p->shared_info->vcpu_data[i].evtchn_upcall_mask = 1;
diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index be9f477ba5..685160cd14 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -14,7 +14,9 @@
* Copyright (C) 1991, 1992, 1995 Linus Torvalds
*/
+#include <xen/config.h>
#include <xen/errno.h>
+#include <xen/event.h>
#include <xen/sched.h>
#include <xen/lib.h>
#include <xen/config.h>
@@ -274,12 +276,18 @@ s_time_t get_s_time(void)
}
-void update_dom_time(shared_info_t *si)
+void update_dom_time(struct domain *d)
{
+ shared_info_t *si = d->shared_info;
unsigned long flags;
+ if ( d->last_propagated_timestamp == full_tsc_irq )
+ return;
+
read_lock_irqsave(&time_lock, flags);
+ d->last_propagated_timestamp = full_tsc_irq;
+
si->time_version1++;
wmb();
@@ -293,6 +301,8 @@ void update_dom_time(shared_info_t *si)
si->time_version2++;
read_unlock_irqrestore(&time_lock, flags);
+
+ send_guest_virq(d, VIRQ_TIMER);
}
@@ -318,7 +328,9 @@ void do_settime(unsigned long secs, unsigned long usecs, u64 system_time_base)
write_unlock_irq(&time_lock);
- update_dom_time(current->shared_info);
+ /* Others will pick up the change at the next tick. */
+ current->last_propagated_timestamp = 0; /* force propagation */
+ update_dom_time(current);
}
diff --git a/xen/common/domain.c b/xen/common/domain.c
index c2fe184267..47673b21ec 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -267,9 +267,6 @@ int final_setup_guestos(struct domain *p, dom0_builddomain_t *builddomain)
if ( (rc = arch_final_setup_guestos(p,c)) != 0 )
goto out;
- /* Set up the shared info structure. */
- update_dom_time(p->shared_info);
-
set_bit(DF_CONSTRUCTED, &p->flags);
out:
diff --git a/xen/common/schedule.c b/xen/common/schedule.c
index ec215d5ed9..09c3e77ad9 100644
--- a/xen/common/schedule.c
+++ b/xen/common/schedule.c
@@ -358,10 +358,6 @@ void __enter_scheduler(void)
spin_unlock_irq(&schedule_data[cpu].schedule_lock);
- /* Ensure that the domain has an up-to-date time base. */
- if ( !is_idle_task(next) )
- update_dom_time(next->shared_info);
-
if ( unlikely(prev == next) )
return;
@@ -399,10 +395,10 @@ void __enter_scheduler(void)
*/
clear_bit(DF_RUNNING, &prev->flags);
- /* Mark a timer event for the newly-scheduled domain. */
+ /* Ensure that the domain has an up-to-date time base. */
if ( !is_idle_task(next) )
- send_guest_virq(next, VIRQ_TIMER);
-
+ update_dom_time(next);
+
schedule_tail(next);
BUG();
@@ -439,10 +435,7 @@ static void t_timer_fn(unsigned long unused)
TRACE_0D(TRC_SCHED_T_TIMER_FN);
if ( !is_idle_task(d) )
- {
- update_dom_time(d->shared_info);
- send_guest_virq(d, VIRQ_TIMER);
- }
+ update_dom_time(d);
t_timer[d->processor].expires = NOW() + MILLISECS(10);
add_ac_timer(&t_timer[d->processor]);
@@ -453,8 +446,7 @@ static void dom_timer_fn(unsigned long data)
{
struct domain *d = (struct domain *)data;
TRACE_0D(TRC_SCHED_DOM_TIMER_FN);
- update_dom_time(d->shared_info);
- send_guest_virq(d, VIRQ_TIMER);
+ update_dom_time(d);
}
/* Initialise the data structures. */
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index d7e6f0be26..254169cd9f 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -102,6 +102,9 @@ struct domain
u16 virq_to_evtchn[NR_VIRQS];
u32 pirq_mask[NR_PIRQS/32];
+ /* Last point at which timestamp info was propagated to the guest. */
+ u64 last_propagated_timestamp;
+
/* Physical I/O */
spinlock_t pcidev_lock;
struct list_head pcidev_list;
diff --git a/xen/include/xen/time.h b/xen/include/xen/time.h
index dd476f9298..e725c4ed94 100644
--- a/xen/include/xen/time.h
+++ b/xen/include/xen/time.h
@@ -52,7 +52,8 @@ 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(shared_info_t *si);
+struct domain;
+extern void update_dom_time(struct domain *d);
extern void do_settime(unsigned long secs, unsigned long usecs,
u64 system_time_base);