direct-io.hg
changeset 4004:0a2fa97dfafc
bitkeeper revision 1.1159.264.1 (422d7683GAA5eJb-zpm3NsgvYf9Q9A)
Clean up timer upcalls to guest kernel. Only send an upcall when
timestamp info actually changes.
Signed-off-by: Keir Fraser <keir.fraser@cl.cam.ac.uk>
Clean up timer upcalls to guest kernel. Only send an upcall when
timestamp info actually changes.
Signed-off-by: Keir Fraser <keir.fraser@cl.cam.ac.uk>
author | kaf24@firebug.cl.cam.ac.uk |
---|---|
date | Tue Mar 08 09:55:15 2005 +0000 (2005-03-08) |
parents | a5bf5769c2b8 |
children | e674bd389503 |
files | BitKeeper/etc/logging_ok xen/arch/x86/domain.c xen/arch/x86/time.c xen/common/domain.c xen/common/schedule.c xen/include/xen/sched.h xen/include/xen/time.h |
line diff
1.1 --- a/BitKeeper/etc/logging_ok Mon Mar 07 14:32:50 2005 +0000 1.2 +++ b/BitKeeper/etc/logging_ok Tue Mar 08 09:55:15 2005 +0000 1.3 @@ -27,6 +27,7 @@ iap10@tetris.cl.cam.ac.uk 1.4 jws22@gauntlet.cl.cam.ac.uk 1.5 jws@cairnwell.research 1.6 kaf24@camelot.eng.3leafnetworks.com 1.7 +kaf24@firebug.cl.cam.ac.uk 1.8 kaf24@freefall.cl.cam.ac.uk 1.9 kaf24@labyrinth.cl.cam.ac.uk 1.10 kaf24@penguin.local
2.1 --- a/xen/arch/x86/domain.c Mon Mar 07 14:32:50 2005 +0000 2.2 +++ b/xen/arch/x86/domain.c Tue Mar 08 09:55:15 2005 +0000 2.3 @@ -869,9 +869,6 @@ int construct_dom0(struct domain *p, 2.4 l1start = l1tab = (l1_pgentry_t *)l2_pgentry_to_phys(*l2tab); 2.5 } 2.6 2.7 - /* Set up shared-info area. */ 2.8 - update_dom_time(p->shared_info); 2.9 - p->shared_info->domain_time = 0; 2.10 /* Mask all upcalls... */ 2.11 for ( i = 0; i < MAX_VIRT_CPUS; i++ ) 2.12 p->shared_info->vcpu_data[i].evtchn_upcall_mask = 1;
3.1 --- a/xen/arch/x86/time.c Mon Mar 07 14:32:50 2005 +0000 3.2 +++ b/xen/arch/x86/time.c Tue Mar 08 09:55:15 2005 +0000 3.3 @@ -14,7 +14,9 @@ 3.4 * Copyright (C) 1991, 1992, 1995 Linus Torvalds 3.5 */ 3.6 3.7 +#include <xen/config.h> 3.8 #include <xen/errno.h> 3.9 +#include <xen/event.h> 3.10 #include <xen/sched.h> 3.11 #include <xen/lib.h> 3.12 #include <xen/config.h> 3.13 @@ -274,12 +276,18 @@ s_time_t get_s_time(void) 3.14 } 3.15 3.16 3.17 -void update_dom_time(shared_info_t *si) 3.18 +void update_dom_time(struct domain *d) 3.19 { 3.20 + shared_info_t *si = d->shared_info; 3.21 unsigned long flags; 3.22 3.23 + if ( d->last_propagated_timestamp == full_tsc_irq ) 3.24 + return; 3.25 + 3.26 read_lock_irqsave(&time_lock, flags); 3.27 3.28 + d->last_propagated_timestamp = full_tsc_irq; 3.29 + 3.30 si->time_version1++; 3.31 wmb(); 3.32 3.33 @@ -293,6 +301,8 @@ void update_dom_time(shared_info_t *si) 3.34 si->time_version2++; 3.35 3.36 read_unlock_irqrestore(&time_lock, flags); 3.37 + 3.38 + send_guest_virq(d, VIRQ_TIMER); 3.39 } 3.40 3.41 3.42 @@ -318,7 +328,9 @@ void do_settime(unsigned long secs, unsi 3.43 3.44 write_unlock_irq(&time_lock); 3.45 3.46 - update_dom_time(current->shared_info); 3.47 + /* Others will pick up the change at the next tick. */ 3.48 + current->last_propagated_timestamp = 0; /* force propagation */ 3.49 + update_dom_time(current); 3.50 } 3.51 3.52
4.1 --- a/xen/common/domain.c Mon Mar 07 14:32:50 2005 +0000 4.2 +++ b/xen/common/domain.c Tue Mar 08 09:55:15 2005 +0000 4.3 @@ -267,9 +267,6 @@ int final_setup_guestos(struct domain *p 4.4 if ( (rc = arch_final_setup_guestos(p,c)) != 0 ) 4.5 goto out; 4.6 4.7 - /* Set up the shared info structure. */ 4.8 - update_dom_time(p->shared_info); 4.9 - 4.10 set_bit(DF_CONSTRUCTED, &p->flags); 4.11 4.12 out:
5.1 --- a/xen/common/schedule.c Mon Mar 07 14:32:50 2005 +0000 5.2 +++ b/xen/common/schedule.c Tue Mar 08 09:55:15 2005 +0000 5.3 @@ -358,10 +358,6 @@ void __enter_scheduler(void) 5.4 5.5 spin_unlock_irq(&schedule_data[cpu].schedule_lock); 5.6 5.7 - /* Ensure that the domain has an up-to-date time base. */ 5.8 - if ( !is_idle_task(next) ) 5.9 - update_dom_time(next->shared_info); 5.10 - 5.11 if ( unlikely(prev == next) ) 5.12 return; 5.13 5.14 @@ -399,10 +395,10 @@ void __enter_scheduler(void) 5.15 */ 5.16 clear_bit(DF_RUNNING, &prev->flags); 5.17 5.18 - /* Mark a timer event for the newly-scheduled domain. */ 5.19 + /* Ensure that the domain has an up-to-date time base. */ 5.20 if ( !is_idle_task(next) ) 5.21 - send_guest_virq(next, VIRQ_TIMER); 5.22 - 5.23 + update_dom_time(next); 5.24 + 5.25 schedule_tail(next); 5.26 5.27 BUG(); 5.28 @@ -439,10 +435,7 @@ static void t_timer_fn(unsigned long unu 5.29 TRACE_0D(TRC_SCHED_T_TIMER_FN); 5.30 5.31 if ( !is_idle_task(d) ) 5.32 - { 5.33 - update_dom_time(d->shared_info); 5.34 - send_guest_virq(d, VIRQ_TIMER); 5.35 - } 5.36 + update_dom_time(d); 5.37 5.38 t_timer[d->processor].expires = NOW() + MILLISECS(10); 5.39 add_ac_timer(&t_timer[d->processor]); 5.40 @@ -453,8 +446,7 @@ static void dom_timer_fn(unsigned long d 5.41 { 5.42 struct domain *d = (struct domain *)data; 5.43 TRACE_0D(TRC_SCHED_DOM_TIMER_FN); 5.44 - update_dom_time(d->shared_info); 5.45 - send_guest_virq(d, VIRQ_TIMER); 5.46 + update_dom_time(d); 5.47 } 5.48 5.49 /* Initialise the data structures. */
6.1 --- a/xen/include/xen/sched.h Mon Mar 07 14:32:50 2005 +0000 6.2 +++ b/xen/include/xen/sched.h Tue Mar 08 09:55:15 2005 +0000 6.3 @@ -102,6 +102,9 @@ struct domain 6.4 u16 virq_to_evtchn[NR_VIRQS]; 6.5 u32 pirq_mask[NR_PIRQS/32]; 6.6 6.7 + /* Last point at which timestamp info was propagated to the guest. */ 6.8 + u64 last_propagated_timestamp; 6.9 + 6.10 /* Physical I/O */ 6.11 spinlock_t pcidev_lock; 6.12 struct list_head pcidev_list;
7.1 --- a/xen/include/xen/time.h Mon Mar 07 14:32:50 2005 +0000 7.2 +++ b/xen/include/xen/time.h Tue Mar 08 09:55:15 2005 +0000 7.3 @@ -52,7 +52,8 @@ s_time_t get_s_time(void); 7.4 #define MILLISECS(_ms) (((s_time_t)(_ms)) * 1000000ULL ) 7.5 #define MICROSECS(_us) (((s_time_t)(_us)) * 1000ULL ) 7.6 7.7 -extern void update_dom_time(shared_info_t *si); 7.8 +struct domain; 7.9 +extern void update_dom_time(struct domain *d); 7.10 extern void do_settime(unsigned long secs, unsigned long usecs, 7.11 u64 system_time_base); 7.12