ia64/xen-unstable

changeset 4008:96b17bd6c85d

bitkeeper revision 1.1236.12.5 (422da8ab_AbA2_rC_i23sDg0BY_avQ)

Time cleanup.
Signed-off-by: Keir Fraser <keir.fraser@cl.cam.ac.uk>
author kaf24@firebug.cl.cam.ac.uk
date Tue Mar 08 13:29:15 2005 +0000 (2005-03-08)
parents db2716522d86
children 48afe8809bec
files xen/arch/x86/time.c xen/include/xen/sched.h
line diff
     1.1 --- a/xen/arch/x86/time.c	Tue Mar 08 10:11:28 2005 +0000
     1.2 +++ b/xen/arch/x86/time.c	Tue Mar 08 13:29:15 2005 +0000
     1.3 @@ -274,21 +274,13 @@ s_time_t get_s_time(void)
     1.4      return now; 
     1.5  }
     1.6  
     1.7 -
     1.8 -void update_dom_time(struct exec_domain *ed)
     1.9 +static inline void __update_dom_time(struct exec_domain *ed)
    1.10  {
    1.11      struct domain *d  = ed->domain;
    1.12      shared_info_t *si = d->shared_info;
    1.13 -    unsigned long flags;
    1.14  
    1.15 -    if ( d->last_propagated_timestamp == full_tsc_irq )
    1.16 -        return;
    1.17 -
    1.18 -    read_lock_irqsave(&time_lock, flags);
    1.19      spin_lock(&d->time_lock);
    1.20  
    1.21 -    d->last_propagated_timestamp = full_tsc_irq;
    1.22 -
    1.23      si->time_version1++;
    1.24      wmb();
    1.25  
    1.26 @@ -302,11 +294,20 @@ void update_dom_time(struct exec_domain 
    1.27      si->time_version2++;
    1.28  
    1.29      spin_unlock(&d->time_lock);
    1.30 -    read_unlock_irqrestore(&time_lock, flags);
    1.31 -
    1.32 -    send_guest_virq(ed, VIRQ_TIMER);
    1.33  }
    1.34  
    1.35 +void update_dom_time(struct exec_domain *ed)
    1.36 +{
    1.37 +    unsigned long flags;
    1.38 +
    1.39 +    if ( ed->domain->shared_info->tsc_timestamp != full_tsc_irq )
    1.40 +    {
    1.41 +        read_lock_irqsave(&time_lock, flags);
    1.42 +        __update_dom_time(ed);
    1.43 +        read_unlock_irqrestore(&time_lock, flags);
    1.44 +        send_guest_virq(ed, VIRQ_TIMER);
    1.45 +    }
    1.46 +}
    1.47  
    1.48  /* Set clock to <secs,usecs> after 00:00:00 UTC, 1 January, 1970. */
    1.49  void do_settime(unsigned long secs, unsigned long usecs, u64 system_time_base)
    1.50 @@ -328,11 +329,11 @@ void do_settime(unsigned long secs, unsi
    1.51      wc_sec  = secs;
    1.52      wc_usec = _usecs;
    1.53  
    1.54 -    write_unlock_irq(&time_lock);
    1.55 +    /* Others will pick up the change at the next tick. */
    1.56 +    __update_dom_time(current);
    1.57 +    send_guest_virq(current, VIRQ_TIMER);
    1.58  
    1.59 -    /* Others will pick up the change at the next tick. */
    1.60 -    current->domain->last_propagated_timestamp = 0; /* force propagation */
    1.61 -    update_dom_time(current);
    1.62 +    write_unlock_irq(&time_lock);
    1.63  }
    1.64  
    1.65  
     2.1 --- a/xen/include/xen/sched.h	Tue Mar 08 10:11:28 2005 +0000
     2.2 +++ b/xen/include/xen/sched.h	Tue Mar 08 13:29:15 2005 +0000
     2.3 @@ -141,9 +141,6 @@ struct domain
     2.4      u16 pirq_to_evtchn[NR_PIRQS];
     2.5      u32 pirq_mask[NR_PIRQS/32];
     2.6  
     2.7 -    /* Last point at which timestamp info was propagated to the guest. */
     2.8 -    u64 last_propagated_timestamp;
     2.9 -
    2.10      /* Physical I/O */
    2.11      spinlock_t       pcidev_lock;
    2.12      struct list_head pcidev_list;