diff options
author | kaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk> | 2003-10-27 22:45:43 +0000 |
---|---|---|
committer | kaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk> | 2003-10-27 22:45:43 +0000 |
commit | 34d223c4f89d97dc8a830838efbb1c7cc6cec5b0 (patch) | |
tree | 5614de0c03f2130ec03a75f3303251818da316e3 | |
parent | ff1c5555ae4eda35e996459de44804839aab4779 (diff) | |
download | xen-34d223c4f89d97dc8a830838efbb1c7cc6cec5b0.tar.gz xen-34d223c4f89d97dc8a830838efbb1c7cc6cec5b0.tar.bz2 xen-34d223c4f89d97dc8a830838efbb1c7cc6cec5b0.zip |
bitkeeper revision 1.531 (3f9da0175ZA8nMoVtg9tCQeXL4osyw)
time.c, xen_log.c, xen_cpuperf.c:
Add 'independent_wallclock' cmdline and sysctl options to xenolinux.
-rw-r--r-- | tools/misc/xen_cpuperf.c | 1 | ||||
-rw-r--r-- | tools/misc/xen_log.c | 1 | ||||
-rw-r--r-- | xenolinux-2.4.22-sparse/arch/xeno/kernel/time.c | 64 |
3 files changed, 50 insertions, 16 deletions
diff --git a/tools/misc/xen_cpuperf.c b/tools/misc/xen_cpuperf.c index 293997b755..e023a648a7 100644 --- a/tools/misc/xen_cpuperf.c +++ b/tools/misc/xen_cpuperf.c @@ -16,7 +16,6 @@ #include <string.h> #include "p4perf.h" -#include "hypervisor-ifs/dom0_ops.h" #include "dom0_defs.h" void dom0_wrmsr( int cpu_mask, int msr, unsigned int low, unsigned int high ) diff --git a/tools/misc/xen_log.c b/tools/misc/xen_log.c index ed7d570e1c..012b934030 100644 --- a/tools/misc/xen_log.c +++ b/tools/misc/xen_log.c @@ -13,7 +13,6 @@ #include <sys/wait.h> #include <string.h> -#include "hypervisor-ifs/dom0_ops.h" #include "dom0_defs.h" #include "mem_defs.h" diff --git a/xenolinux-2.4.22-sparse/arch/xeno/kernel/time.c b/xenolinux-2.4.22-sparse/arch/xeno/kernel/time.c index 65280df6ce..5b31e7fcf5 100644 --- a/xenolinux-2.4.22-sparse/arch/xeno/kernel/time.c +++ b/xenolinux-2.4.22-sparse/arch/xeno/kernel/time.c @@ -61,6 +61,7 @@ #include <linux/init.h> #include <linux/smp.h> #include <linux/irq.h> +#include <linux/sysctl.h> spinlock_t rtc_lock = SPIN_LOCK_UNLOCKED; extern rwlock_t xtime_lock; @@ -103,6 +104,16 @@ static u64 processed_system_time; } while ( 0 ) +/* Does this guest OS track Xen time, or set its wall clock independently? */ +static int independent_wallclock = 0; +static int __init __independent_wallclock(char *str) +{ + independent_wallclock = 1; + return 1; +} +__setup("independent_wallclock", __independent_wallclock); + + #ifdef CONFIG_XENO_PRIV /* * In order to set the CMOS clock precisely, set_rtc_mmss has to be @@ -248,11 +259,9 @@ void do_gettimeofday(struct timeval *tv) void do_settimeofday(struct timeval *tv) { -#ifdef CONFIG_XENO_PRIV struct timeval newtv; - dom0_op_t op; - if ( start_info.dom_id != 0 ) + if ( !independent_wallclock && (start_info.dom_id != 0) ) return; write_lock_irq(&xtime_lock); @@ -283,17 +292,23 @@ void do_settimeofday(struct timeval *tv) time_maxerror = NTP_PHASE_LIMIT; time_esterror = NTP_PHASE_LIMIT; - last_rtc_update = last_xen_update = 0; - - op.cmd = DOM0_SETTIME; - op.u.settime.secs = newtv.tv_sec; - op.u.settime.usecs = newtv.tv_usec; - op.u.settime.system_time = shadow_system_time; - - write_unlock_irq(&xtime_lock); - - HYPERVISOR_dom0_op(&op); +#ifdef CONFIG_XENO_PRIV + if ( start_info.dom_id == 0 ) + { + dom0_op_t op; + last_rtc_update = last_xen_update = 0; + op.cmd = DOM0_SETTIME; + op.u.settime.secs = newtv.tv_sec; + op.u.settime.usecs = newtv.tv_usec; + op.u.settime.system_time = shadow_system_time; + write_unlock_irq(&xtime_lock); + HYPERVISOR_dom0_op(&op); + } + else #endif + { + write_unlock_irq(&xtime_lock); + } } asmlinkage long sys_stime(int *tptr) @@ -336,7 +351,7 @@ static inline void do_timer_interrupt(int irq, void *dev_id, processed_system_time += NS_PER_TICK; } - if ( (time_status & STA_UNSYNC) != 0 ) + if ( !independent_wallclock && ((time_status & STA_UNSYNC) != 0) ) { /* Adjust shadow timeval for jiffies that haven't updated xtime yet. */ shadow_tv.tv_usec -= (jiffies - wall_jiffies) * (1000000/HZ); @@ -439,3 +454,24 @@ void __init time_init(void) clear_bit(_EVENT_TIMER, &HYPERVISOR_shared_info->events); } + + +/* + * /proc/sys/xeno: This really belongs in another file. It can stay here for + * now however. + */ +static ctl_table xeno_subtable[] = { + {1, "independent_wallclock", &independent_wallclock, + sizeof(independent_wallclock), 0644, NULL, proc_dointvec}, + {0} +}; +static ctl_table xeno_table[] = { + {123, "xeno", NULL, 0, 0555, xeno_subtable}, + {0} +}; +static int __init xeno_sysctl_init(void) +{ + (void)register_sysctl_table(xeno_table, 0); + return 0; +} +__initcall(xeno_sysctl_init); |