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
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;
* 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>
}
-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();
si->time_version2++;
read_unlock_irqrestore(&time_lock, flags);
+
+ send_guest_virq(d, VIRQ_TIMER);
}
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);
}
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:
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;
*/
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();
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]);
{
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. */
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;
#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);