ia64/xen-unstable

changeset 9592:08aede767c63

Rename update_dom_time() to update_vcpu_system_time().
Introduce new generic function update_domain_wallclock_time().

Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Wed Apr 05 15:00:42 2006 +0100 (2006-04-05)
parents bb316b4df46f
children c1d53788a25e
files xen/arch/ia64/xen/xentime.c xen/arch/x86/domain.c xen/arch/x86/domain_build.c xen/arch/x86/time.c xen/common/schedule.c xen/include/asm-x86/time.h xen/include/xen/time.h
line diff
     1.1 --- a/xen/arch/ia64/xen/xentime.c	Wed Apr 05 13:38:54 2006 +0100
     1.2 +++ b/xen/arch/ia64/xen/xentime.c	Wed Apr 05 15:00:42 2006 +0100
     1.3 @@ -84,7 +84,13 @@ s_time_t get_s_time(void)
     1.4      return now; 
     1.5  }
     1.6  
     1.7 -void update_dom_time(struct vcpu *v)
     1.8 +void update_vcpu_system_time(struct vcpu *v)
     1.9 +{
    1.10 +    /* N-op here, and let dom0 to manage system time directly */
    1.11 +    return;
    1.12 +}
    1.13 +
    1.14 +void update_domain_wallclock_time(struct domain *d)
    1.15  {
    1.16      /* N-op here, and let dom0 to manage system time directly */
    1.17      return;
     2.1 --- a/xen/arch/x86/domain.c	Wed Apr 05 13:38:54 2006 +0100
     2.2 +++ b/xen/arch/x86/domain.c	Wed Apr 05 15:00:42 2006 +0100
     2.3 @@ -363,7 +363,7 @@ int arch_set_info_guest(
     2.4      update_pagetables(v);
     2.5  
     2.6      if ( v->vcpu_id == 0 )
     2.7 -        init_domain_time(d);
     2.8 +        update_domain_wallclock_time(d);
     2.9  
    2.10      /* Don't redo final setup */
    2.11      set_bit(_VCPUF_initialised, &v->vcpu_flags);
     3.1 --- a/xen/arch/x86/domain_build.c	Wed Apr 05 13:38:54 2006 +0100
     3.2 +++ b/xen/arch/x86/domain_build.c	Wed Apr 05 15:00:42 2006 +0100
     3.3 @@ -773,7 +773,7 @@ int construct_dom0(struct domain *d,
     3.4      zap_low_mappings(idle_pg_table_l2);
     3.5  #endif
     3.6  
     3.7 -    init_domain_time(d);
     3.8 +    update_domain_wallclock_time(d);
     3.9  
    3.10      set_bit(_VCPUF_initialised, &v->vcpu_flags);
    3.11  
     4.1 --- a/xen/arch/x86/time.c	Wed Apr 05 13:38:54 2006 +0100
     4.2 +++ b/xen/arch/x86/time.c	Wed Apr 05 15:00:42 2006 +0100
     4.3 @@ -670,7 +670,7 @@ static inline void version_update_end(u3
     4.4      (*version)++;
     4.5  }
     4.6  
     4.7 -static inline void __update_dom_time(struct vcpu *v)
     4.8 +static inline void __update_vcpu_system_time(struct vcpu *v)
     4.9  {
    4.10      struct cpu_time       *t;
    4.11      struct vcpu_time_info *u;
    4.12 @@ -688,11 +688,21 @@ static inline void __update_dom_time(str
    4.13      version_update_end(&u->version);
    4.14  }
    4.15  
    4.16 -void update_dom_time(struct vcpu *v)
    4.17 +void update_vcpu_system_time(struct vcpu *v)
    4.18  {
    4.19      if ( v->domain->shared_info->vcpu_info[v->vcpu_id].time.tsc_timestamp != 
    4.20           cpu_time[smp_processor_id()].local_tsc_stamp )
    4.21 -        __update_dom_time(v);
    4.22 +        __update_vcpu_system_time(v);
    4.23 +}
    4.24 +
    4.25 +void update_domain_wallclock_time(struct domain *d)
    4.26 +{
    4.27 +    spin_lock(&wc_lock);
    4.28 +    version_update_begin(&d->shared_info->wc_version);
    4.29 +    d->shared_info->wc_sec  = wc_sec;
    4.30 +    d->shared_info->wc_nsec = wc_nsec;
    4.31 +    version_update_end(&d->shared_info->wc_version);
    4.32 +    spin_unlock(&wc_lock);
    4.33  }
    4.34  
    4.35  /* Set clock to <secs,usecs> after 00:00:00 UTC, 1 January, 1970. */
    4.36 @@ -701,40 +711,21 @@ void do_settime(unsigned long secs, unsi
    4.37      u64 x;
    4.38      u32 y, _wc_sec, _wc_nsec;
    4.39      struct domain *d;
    4.40 -    shared_info_t *s;
    4.41  
    4.42      x = (secs * 1000000000ULL) + (u64)nsecs - system_time_base;
    4.43      y = do_div(x, 1000000000);
    4.44  
    4.45 +    spin_lock(&wc_lock);
    4.46      wc_sec  = _wc_sec  = (u32)x;
    4.47      wc_nsec = _wc_nsec = (u32)y;
    4.48 +    spin_unlock(&wc_lock);
    4.49  
    4.50      read_lock(&domlist_lock);
    4.51 -    spin_lock(&wc_lock);
    4.52 -
    4.53      for_each_domain ( d )
    4.54 -    {
    4.55 -        s = d->shared_info;
    4.56 -        version_update_begin(&s->wc_version);
    4.57 -        s->wc_sec  = _wc_sec;
    4.58 -        s->wc_nsec = _wc_nsec;
    4.59 -        version_update_end(&s->wc_version);
    4.60 -    }
    4.61 -
    4.62 -    spin_unlock(&wc_lock);
    4.63 +        update_domain_wallclock_time(d);
    4.64      read_unlock(&domlist_lock);
    4.65  }
    4.66  
    4.67 -void init_domain_time(struct domain *d)
    4.68 -{
    4.69 -    spin_lock(&wc_lock);
    4.70 -    version_update_begin(&d->shared_info->wc_version);
    4.71 -    d->shared_info->wc_sec  = wc_sec;
    4.72 -    d->shared_info->wc_nsec = wc_nsec;
    4.73 -    version_update_end(&d->shared_info->wc_version);
    4.74 -    spin_unlock(&wc_lock);
    4.75 -}
    4.76 -
    4.77  static void local_time_calibration(void *unused)
    4.78  {
    4.79      unsigned int cpu = smp_processor_id();
     5.1 --- a/xen/common/schedule.c	Wed Apr 05 13:38:54 2006 +0100
     5.2 +++ b/xen/common/schedule.c	Wed Apr 05 15:00:42 2006 +0100
     5.3 @@ -572,7 +572,7 @@ static void __enter_scheduler(void)
     5.4      /* Ensure that the domain has an up-to-date time base. */
     5.5      if ( !is_idle_vcpu(next) )
     5.6      {
     5.7 -        update_dom_time(next);
     5.8 +        update_vcpu_system_time(next);
     5.9          if ( next->sleep_tick != schedule_data[cpu].tick )
    5.10              send_timer_event(next);
    5.11      }
    5.12 @@ -609,7 +609,7 @@ static void t_timer_fn(void *unused)
    5.13  
    5.14      if ( !is_idle_vcpu(v) )
    5.15      {
    5.16 -        update_dom_time(v);
    5.17 +        update_vcpu_system_time(v);
    5.18          send_timer_event(v);
    5.19      }
    5.20  
    5.21 @@ -623,7 +623,7 @@ static void dom_timer_fn(void *data)
    5.22  {
    5.23      struct vcpu *v = data;
    5.24  
    5.25 -    update_dom_time(v);
    5.26 +    update_vcpu_system_time(v);
    5.27      send_timer_event(v);
    5.28  }
    5.29  
     6.1 --- a/xen/include/asm-x86/time.h	Wed Apr 05 13:38:54 2006 +0100
     6.2 +++ b/xen/include/asm-x86/time.h	Wed Apr 05 15:00:42 2006 +0100
     6.3 @@ -7,9 +7,6 @@
     6.4  extern void calibrate_tsc_bp(void);
     6.5  extern void calibrate_tsc_ap(void);
     6.6  
     6.7 -struct domain;
     6.8 -extern void init_domain_time(struct domain *d);
     6.9 -
    6.10  typedef u64 cycles_t;
    6.11  
    6.12  static inline cycles_t get_cycles(void)
     7.1 --- a/xen/include/xen/time.h	Wed Apr 05 13:38:54 2006 +0100
     7.2 +++ b/xen/include/xen/time.h	Wed Apr 05 15:00:42 2006 +0100
     7.3 @@ -55,7 +55,9 @@ 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(struct vcpu *v);
     7.8 +extern void update_vcpu_system_time(struct vcpu *v);
     7.9 +extern void update_domain_wallclock_time(struct domain *d);
    7.10 +
    7.11  extern void do_settime(
    7.12      unsigned long secs, unsigned long nsecs, u64 system_time_base);
    7.13