direct-io.hg

changeset 854:0cd58ce5a503

bitkeeper revision 1.531 (3f9da0175ZA8nMoVtg9tCQeXL4osyw)

time.c, xen_log.c, xen_cpuperf.c:
Add 'independent_wallclock' cmdline and sysctl options to xenolinux.
author kaf24@scramble.cl.cam.ac.uk
date Mon Oct 27 22:45:43 2003 +0000 (2003-10-27)
parents a8685755bf95
children 21376a12e008
files tools/misc/xen_cpuperf.c tools/misc/xen_log.c xenolinux-2.4.22-sparse/arch/xeno/kernel/time.c
line diff
     1.1 --- a/tools/misc/xen_cpuperf.c	Mon Oct 27 16:55:56 2003 +0000
     1.2 +++ b/tools/misc/xen_cpuperf.c	Mon Oct 27 22:45:43 2003 +0000
     1.3 @@ -16,7 +16,6 @@
     1.4  #include <string.h>
     1.5  
     1.6  #include "p4perf.h"
     1.7 -#include "hypervisor-ifs/dom0_ops.h"
     1.8  #include "dom0_defs.h"
     1.9  
    1.10  void dom0_wrmsr( int cpu_mask, int msr, unsigned int low, unsigned int high )
     2.1 --- a/tools/misc/xen_log.c	Mon Oct 27 16:55:56 2003 +0000
     2.2 +++ b/tools/misc/xen_log.c	Mon Oct 27 22:45:43 2003 +0000
     2.3 @@ -13,7 +13,6 @@
     2.4  #include <sys/wait.h>
     2.5  #include <string.h>
     2.6  
     2.7 -#include "hypervisor-ifs/dom0_ops.h"
     2.8  #include "dom0_defs.h"
     2.9  #include "mem_defs.h"
    2.10  
     3.1 --- a/xenolinux-2.4.22-sparse/arch/xeno/kernel/time.c	Mon Oct 27 16:55:56 2003 +0000
     3.2 +++ b/xenolinux-2.4.22-sparse/arch/xeno/kernel/time.c	Mon Oct 27 22:45:43 2003 +0000
     3.3 @@ -61,6 +61,7 @@
     3.4  #include <linux/init.h>
     3.5  #include <linux/smp.h>
     3.6  #include <linux/irq.h>
     3.7 +#include <linux/sysctl.h>
     3.8  
     3.9  spinlock_t rtc_lock = SPIN_LOCK_UNLOCKED;
    3.10  extern rwlock_t xtime_lock;
    3.11 @@ -103,6 +104,16 @@ static u64 processed_system_time;
    3.12      } while ( 0 )
    3.13  
    3.14  
    3.15 +/* Does this guest OS track Xen time, or set its wall clock independently? */
    3.16 +static int independent_wallclock = 0;
    3.17 +static int __init __independent_wallclock(char *str)
    3.18 +{
    3.19 +    independent_wallclock = 1;
    3.20 +    return 1;
    3.21 +}
    3.22 +__setup("independent_wallclock", __independent_wallclock);
    3.23 +
    3.24 +
    3.25  #ifdef CONFIG_XENO_PRIV
    3.26  /*
    3.27   * In order to set the CMOS clock precisely, set_rtc_mmss has to be
    3.28 @@ -248,11 +259,9 @@ void do_gettimeofday(struct timeval *tv)
    3.29  
    3.30  void do_settimeofday(struct timeval *tv)
    3.31  {
    3.32 -#ifdef CONFIG_XENO_PRIV
    3.33      struct timeval newtv;
    3.34 -    dom0_op_t op;
    3.35      
    3.36 -    if ( start_info.dom_id != 0 )
    3.37 +    if ( !independent_wallclock && (start_info.dom_id != 0) )
    3.38          return;
    3.39      
    3.40      write_lock_irq(&xtime_lock);
    3.41 @@ -283,17 +292,23 @@ void do_settimeofday(struct timeval *tv)
    3.42      time_maxerror = NTP_PHASE_LIMIT;
    3.43      time_esterror = NTP_PHASE_LIMIT;
    3.44  
    3.45 -    last_rtc_update = last_xen_update = 0;
    3.46 -
    3.47 -    op.cmd = DOM0_SETTIME;
    3.48 -    op.u.settime.secs        = newtv.tv_sec;
    3.49 -    op.u.settime.usecs       = newtv.tv_usec;
    3.50 -    op.u.settime.system_time = shadow_system_time;
    3.51 -
    3.52 -    write_unlock_irq(&xtime_lock);
    3.53 -
    3.54 -    HYPERVISOR_dom0_op(&op);
    3.55 +#ifdef CONFIG_XENO_PRIV
    3.56 +    if ( start_info.dom_id == 0 )
    3.57 +    {
    3.58 +        dom0_op_t op;
    3.59 +        last_rtc_update = last_xen_update = 0;
    3.60 +        op.cmd = DOM0_SETTIME;
    3.61 +        op.u.settime.secs        = newtv.tv_sec;
    3.62 +        op.u.settime.usecs       = newtv.tv_usec;
    3.63 +        op.u.settime.system_time = shadow_system_time;
    3.64 +        write_unlock_irq(&xtime_lock);
    3.65 +        HYPERVISOR_dom0_op(&op);
    3.66 +    }
    3.67 +    else
    3.68  #endif
    3.69 +    {
    3.70 +        write_unlock_irq(&xtime_lock);
    3.71 +    }
    3.72  }
    3.73  
    3.74  asmlinkage long sys_stime(int *tptr)
    3.75 @@ -336,7 +351,7 @@ static inline void do_timer_interrupt(in
    3.76          processed_system_time += NS_PER_TICK;
    3.77      }
    3.78      
    3.79 -    if ( (time_status & STA_UNSYNC) != 0 )
    3.80 +    if ( !independent_wallclock && ((time_status & STA_UNSYNC) != 0) )
    3.81      {
    3.82          /* Adjust shadow timeval for jiffies that haven't updated xtime yet. */
    3.83          shadow_tv.tv_usec -= (jiffies - wall_jiffies) * (1000000/HZ);
    3.84 @@ -439,3 +454,24 @@ void __init time_init(void)
    3.85  
    3.86      clear_bit(_EVENT_TIMER, &HYPERVISOR_shared_info->events);
    3.87  }
    3.88 +
    3.89 +
    3.90 +/*
    3.91 + * /proc/sys/xeno: This really belongs in another file. It can stay here for
    3.92 + * now however.
    3.93 + */
    3.94 +static ctl_table xeno_subtable[] = {
    3.95 +    {1, "independent_wallclock", &independent_wallclock,
    3.96 +     sizeof(independent_wallclock), 0644, NULL, proc_dointvec},
    3.97 +    {0}
    3.98 +};
    3.99 +static ctl_table xeno_table[] = {
   3.100 +    {123, "xeno", NULL, 0, 0555, xeno_subtable},
   3.101 +    {0}
   3.102 +};
   3.103 +static int __init xeno_sysctl_init(void)
   3.104 +{
   3.105 +    (void)register_sysctl_table(xeno_table, 0);
   3.106 +    return 0;
   3.107 +}
   3.108 +__initcall(xeno_sysctl_init);