debuggers.hg

view linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/time.c @ 2623:9d1a7223d45e

bitkeeper revision 1.1159.1.198 (415d8662Q0wZZexKh1EdIwW80jQLLg)

Rearrange time init so that xtime and processed_system_time don't start
out of sync. Update wall_to_monotonic when we update time from xen.
author cl349@freefall.cl.cam.ac.uk
date Fri Oct 01 16:31:30 2004 +0000 (2004-10-01)
parents f64b48547d69
children 80fce5fd8284
line source
1 /*
2 * linux/arch/i386/kernel/time.c
3 *
4 * Copyright (C) 1991, 1992, 1995 Linus Torvalds
5 *
6 * This file contains the PC-specific time handling details:
7 * reading the RTC at bootup, etc..
8 * 1994-07-02 Alan Modra
9 * fixed set_rtc_mmss, fixed time.year for >= 2000, new mktime
10 * 1995-03-26 Markus Kuhn
11 * fixed 500 ms bug at call to set_rtc_mmss, fixed DS12887
12 * precision CMOS clock update
13 * 1996-05-03 Ingo Molnar
14 * fixed time warps in do_[slow|fast]_gettimeoffset()
15 * 1997-09-10 Updated NTP code according to technical memorandum Jan '96
16 * "A Kernel Model for Precision Timekeeping" by Dave Mills
17 * 1998-09-05 (Various)
18 * More robust do_fast_gettimeoffset() algorithm implemented
19 * (works with APM, Cyrix 6x86MX and Centaur C6),
20 * monotonic gettimeofday() with fast_get_timeoffset(),
21 * drift-proof precision TSC calibration on boot
22 * (C. Scott Ananian <cananian@alumni.princeton.edu>, Andrew D.
23 * Balsa <andrebalsa@altern.org>, Philip Gladstone <philip@raptor.com>;
24 * ported from 2.0.35 Jumbo-9 by Michael Krause <m.krause@tu-harburg.de>).
25 * 1998-12-16 Andrea Arcangeli
26 * Fixed Jumbo-9 code in 2.1.131: do_gettimeofday was missing 1 jiffy
27 * because was not accounting lost_ticks.
28 * 1998-12-24 Copyright (C) 1998 Andrea Arcangeli
29 * Fixed a xtime SMP race (we need the xtime_lock rw spinlock to
30 * serialize accesses to xtime/lost_ticks).
31 */
33 #include <linux/errno.h>
34 #include <linux/sched.h>
35 #include <linux/kernel.h>
36 #include <linux/param.h>
37 #include <linux/string.h>
38 #include <linux/mm.h>
39 #include <linux/interrupt.h>
40 #include <linux/time.h>
41 #include <linux/delay.h>
42 #include <linux/init.h>
43 #include <linux/smp.h>
44 #include <linux/module.h>
45 #include <linux/sysdev.h>
46 #include <linux/bcd.h>
47 #include <linux/efi.h>
48 #include <linux/sysctl.h>
50 #include <asm/io.h>
51 #include <asm/smp.h>
52 #include <asm/irq.h>
53 #include <asm/msr.h>
54 #include <asm/delay.h>
55 #include <asm/mpspec.h>
56 #include <asm/uaccess.h>
57 #include <asm/processor.h>
58 #include <asm/timer.h>
60 #include "mach_time.h"
62 #include <linux/timex.h>
63 #include <linux/config.h>
65 #include <asm/hpet.h>
67 #include <asm/arch_hooks.h>
69 #include "io_ports.h"
71 extern spinlock_t i8259A_lock;
72 int pit_latch_buggy; /* extern */
74 #include "do_timer.h"
76 u64 jiffies_64 = INITIAL_JIFFIES;
78 EXPORT_SYMBOL(jiffies_64);
80 unsigned long cpu_khz; /* Detected as we calibrate the TSC */
82 extern unsigned long wall_jiffies;
84 spinlock_t rtc_lock = SPIN_LOCK_UNLOCKED;
86 spinlock_t i8253_lock = SPIN_LOCK_UNLOCKED;
87 EXPORT_SYMBOL(i8253_lock);
89 struct timer_opts *cur_timer = &timer_none;
91 /* These are peridically updated in shared_info, and then copied here. */
92 u32 shadow_tsc_stamp;
93 u64 shadow_system_time;
94 static u32 shadow_time_version;
95 static struct timeval shadow_tv;
96 extern u64 processed_system_time;
98 /*
99 * We use this to ensure that gettimeofday() is monotonically increasing. We
100 * only break this guarantee if the wall clock jumps backwards "a long way".
101 */
102 static struct timeval last_seen_tv = {0,0};
104 #ifdef CONFIG_XEN_PRIVILEGED_GUEST
105 /* Periodically propagate synchronised time base to the RTC and to Xen. */
106 static long last_rtc_update, last_update_to_xen;
107 #endif
109 /* Periodically take synchronised time base from Xen, if we need it. */
110 static long last_update_from_xen; /* UTC seconds when last read Xen clock. */
112 /* Keep track of last time we did processing/updating of jiffies and xtime. */
113 u64 processed_system_time; /* System time (ns) at last processing. */
115 #define NS_PER_TICK (1000000000ULL/HZ)
117 #define HANDLE_USEC_UNDERFLOW(_tv) do { \
118 while ((_tv).tv_usec < 0) { \
119 (_tv).tv_usec += USEC_PER_SEC; \
120 (_tv).tv_sec--; \
121 } \
122 } while (0)
123 #define HANDLE_USEC_OVERFLOW(_tv) do { \
124 while ((_tv).tv_usec >= USEC_PER_SEC) { \
125 (_tv).tv_usec -= USEC_PER_SEC; \
126 (_tv).tv_sec++; \
127 } \
128 } while (0)
129 static inline void __normalize_time(time_t *sec, s64 *nsec)
130 {
131 while (*nsec >= NSEC_PER_SEC) {
132 (*nsec) -= NSEC_PER_SEC;
133 (*sec)++;
134 }
135 while (*nsec < 0) {
136 (*nsec) += NSEC_PER_SEC;
137 (*sec)--;
138 }
139 }
141 /* Does this guest OS track Xen time, or set its wall clock independently? */
142 static int independent_wallclock = 0;
143 static int __init __independent_wallclock(char *str)
144 {
145 independent_wallclock = 1;
146 return 1;
147 }
148 __setup("independent_wallclock", __independent_wallclock);
149 #define INDEPENDENT_WALLCLOCK() \
150 (independent_wallclock || (start_info.flags & SIF_INITDOMAIN))
152 /*
153 * Reads a consistent set of time-base values from Xen, into a shadow data
154 * area. Must be called with the xtime_lock held for writing.
155 */
156 static void __get_time_values_from_xen(void)
157 {
158 shared_info_t *s = HYPERVISOR_shared_info;
160 do {
161 shadow_time_version = s->time_version2;
162 rmb();
163 shadow_tv.tv_sec = s->wc_sec;
164 shadow_tv.tv_usec = s->wc_usec;
165 shadow_tsc_stamp = (u32)s->tsc_timestamp;
166 shadow_system_time = s->system_time;
167 rmb();
168 }
169 while (shadow_time_version != s->time_version1);
171 cur_timer->mark_offset();
172 }
174 #define TIME_VALUES_UP_TO_DATE \
175 (shadow_time_version == HYPERVISOR_shared_info->time_version2)
177 /*
178 * This version of gettimeofday has microsecond resolution
179 * and better than microsecond precision on fast x86 machines with TSC.
180 */
181 void do_gettimeofday(struct timeval *tv)
182 {
183 unsigned long seq;
184 unsigned long usec, sec;
185 unsigned long max_ntp_tick;
186 unsigned long flags;
187 s64 nsec;
189 do {
190 unsigned long lost;
192 seq = read_seqbegin(&xtime_lock);
194 usec = cur_timer->get_offset();
195 lost = jiffies - wall_jiffies;
197 /*
198 * If time_adjust is negative then NTP is slowing the clock
199 * so make sure not to go into next possible interval.
200 * Better to lose some accuracy than have time go backwards..
201 */
202 if (unlikely(time_adjust < 0)) {
203 max_ntp_tick = (USEC_PER_SEC / HZ) - tickadj;
204 usec = min(usec, max_ntp_tick);
206 if (lost)
207 usec += lost * max_ntp_tick;
208 }
209 else if (unlikely(lost))
210 usec += lost * (USEC_PER_SEC / HZ);
212 sec = xtime.tv_sec;
213 usec += (xtime.tv_nsec / NSEC_PER_USEC);
215 nsec = shadow_system_time - processed_system_time;
216 __normalize_time(&sec, &nsec);
217 usec += (long)nsec / NSEC_PER_USEC;
219 if (unlikely(!TIME_VALUES_UP_TO_DATE)) {
220 /*
221 * We may have blocked for a long time,
222 * rendering our calculations invalid
223 * (e.g. the time delta may have
224 * overflowed). Detect that and recalculate
225 * with fresh values.
226 */
227 write_seqlock_irqsave(&xtime_lock, flags);
228 __get_time_values_from_xen();
229 write_sequnlock_irqrestore(&xtime_lock, flags);
230 continue;
231 }
232 } while (read_seqretry(&xtime_lock, seq));
234 while (usec >= USEC_PER_SEC) {
235 usec -= USEC_PER_SEC;
236 sec++;
237 }
239 /* Ensure that time-of-day is monotonically increasing. */
240 if ((sec < last_seen_tv.tv_sec) ||
241 ((sec == last_seen_tv.tv_sec) && (usec < last_seen_tv.tv_usec))) {
242 sec = last_seen_tv.tv_sec;
243 usec = last_seen_tv.tv_usec;
244 } else {
245 last_seen_tv.tv_sec = sec;
246 last_seen_tv.tv_usec = usec;
247 }
249 tv->tv_sec = sec;
250 tv->tv_usec = usec;
251 }
253 EXPORT_SYMBOL(do_gettimeofday);
255 int do_settimeofday(struct timespec *tv)
256 {
257 time_t wtm_sec, sec = tv->tv_sec;
258 long wtm_nsec;
259 s64 nsec;
260 struct timespec xentime;
262 if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC)
263 return -EINVAL;
265 if (!INDEPENDENT_WALLCLOCK())
266 return 0; /* Silent failure? */
268 write_seqlock_irq(&xtime_lock);
270 /*
271 * Ensure we don't get blocked for a long time so that our time delta
272 * overflows. If that were to happen then our shadow time values would
273 * be stale, so we can retry with fresh ones.
274 */
275 again:
276 nsec = tv->tv_nsec - cur_timer->get_offset() * NSEC_PER_USEC;
277 if (unlikely(!TIME_VALUES_UP_TO_DATE)) {
278 __get_time_values_from_xen();
279 goto again;
280 }
282 __normalize_time(&sec, &nsec);
283 set_normalized_timespec(&xentime, sec, nsec);
285 /*
286 * This is revolting. We need to set "xtime" correctly. However, the
287 * value in this location is the value at the most recent update of
288 * wall time. Discover what correction gettimeofday() would have
289 * made, and then undo it!
290 */
291 nsec -= (jiffies - wall_jiffies) * TICK_NSEC;
293 nsec -= (shadow_system_time - processed_system_time);
295 __normalize_time(&sec, &nsec);
296 wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec);
297 wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec);
299 set_normalized_timespec(&xtime, sec, nsec);
300 set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec);
302 time_adjust = 0; /* stop active adjtime() */
303 time_status |= STA_UNSYNC;
304 time_maxerror = NTP_PHASE_LIMIT;
305 time_esterror = NTP_PHASE_LIMIT;
307 /* Reset all our running time counts. They make no sense now. */
308 last_seen_tv.tv_sec = 0;
309 last_update_from_xen = 0;
311 #ifdef CONFIG_XEN_PRIVILEGED_GUEST
312 if (start_info.flags & SIF_INITDOMAIN) {
313 dom0_op_t op;
314 last_rtc_update = last_update_to_xen = 0;
315 op.cmd = DOM0_SETTIME;
316 op.u.settime.secs = xentime.tv_sec;
317 op.u.settime.usecs = xentime.tv_nsec / NSEC_PER_USEC;
318 op.u.settime.system_time = shadow_system_time;
319 write_sequnlock_irq(&xtime_lock);
320 HYPERVISOR_dom0_op(&op);
321 } else
322 #endif
323 write_sequnlock_irq(&xtime_lock);
325 clock_was_set();
326 return 0;
327 }
329 EXPORT_SYMBOL(do_settimeofday);
331 #ifdef CONFIG_XEN_PRIVILEGED_GUEST
332 static int set_rtc_mmss(unsigned long nowtime)
333 {
334 int retval;
336 /* gets recalled with irq locally disabled */
337 spin_lock(&rtc_lock);
338 if (efi_enabled)
339 retval = efi_set_rtc_mmss(nowtime);
340 else
341 retval = mach_set_rtc_mmss(nowtime);
342 spin_unlock(&rtc_lock);
344 return retval;
345 }
346 #endif
348 /* monotonic_clock(): returns # of nanoseconds passed since time_init()
349 * Note: This function is required to return accurate
350 * time even in the absence of multiple timer ticks.
351 */
352 unsigned long long monotonic_clock(void)
353 {
354 return cur_timer->monotonic_clock();
355 }
356 EXPORT_SYMBOL(monotonic_clock);
359 /*
360 * timer_interrupt() needs to keep up the real-time clock,
361 * as well as call the "do_timer()" routine every clocktick
362 */
363 static inline void do_timer_interrupt(int irq, void *dev_id,
364 struct pt_regs *regs)
365 {
366 time_t wtm_sec, sec;
367 s64 delta. nsec;
368 long sec_diff, wtm_nsec;
369 long wtm_nsec;
371 __get_time_values_from_xen();
373 delta = (s64)(shadow_system_time +
374 (cur_timer->get_offset() * NSEC_PER_USEC) -
375 processed_system_time);
376 if (delta < 0) {
377 printk("Timer ISR: Time went backwards: %lld\n", delta);
378 return;
379 }
381 /* Process elapsed jiffies since last call. */
382 while (delta >= NS_PER_TICK) {
383 delta -= NS_PER_TICK;
384 processed_system_time += NS_PER_TICK;
385 do_timer_interrupt_hook(regs);
386 }
388 /*
389 * Take synchronised time from Xen once a minute if we're not
390 * synchronised ourselves, and we haven't chosen to keep an independent
391 * time base.
392 */
393 if (!INDEPENDENT_WALLCLOCK() &&
394 ((time_status & STA_UNSYNC) != 0) &&
395 (xtime.tv_sec > (last_update_from_xen + 60))) {
396 /* Adjust shadow for jiffies that haven't updated xtime yet. */
397 shadow_tv.tv_usec -=
398 (jiffies - wall_jiffies) * (USEC_PER_SEC / HZ);
399 HANDLE_USEC_UNDERFLOW(shadow_tv);
401 /*
402 * Reset our running time counts if they are invalidated by
403 * a warp backwards of more than 500ms.
404 */
405 sec_diff = xtime.tv_sec - shadow_tv.tv_sec;
406 if (unlikely(abs(sec_diff) > 1) ||
407 unlikely(((sec_diff * USEC_PER_SEC) +
408 (xtime.tv_nsec / NSEC_PER_USEC) -
409 shadow_tv.tv_usec) > 500000)) {
410 #ifdef CONFIG_XEN_PRIVILEGED_GUEST
411 last_rtc_update = last_update_to_xen = 0;
412 #endif
413 last_seen_tv.tv_sec = 0;
414 }
416 /* Update our unsynchronised xtime appropriately. */
417 sec = shadow_tv.tv_sec;
418 nsec = shadow_tv.tv_usec * NSEC_PER_USEC;
420 __normalize_time(&sec, &nsec);
421 wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec);
422 wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec);
424 set_normalized_timespec(&xtime, sec, nsec);
425 set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec);
427 last_update_from_xen = sec;
428 }
430 #ifdef CONFIG_XEN_PRIVILEGED_GUEST
431 if (!(start_info.flags & SIF_INITDOMAIN))
432 return;
434 /* Send synchronised time to Xen approximately every minute. */
435 if (((time_status & STA_UNSYNC) == 0) &&
436 (xtime.tv_sec > (last_update_to_xen + 60))) {
437 dom0_op_t op;
438 struct timeval tv;
440 tv.tv_sec = xtime.tv_sec;
441 tv.tv_usec = xtime.tv_nsec / NSEC_PER_USEC;
442 tv.tv_usec += (jiffies - wall_jiffies) * (USEC_PER_SEC/HZ);
443 HANDLE_USEC_OVERFLOW(tv);
445 op.cmd = DOM0_SETTIME;
446 op.u.settime.secs = tv.tv_sec;
447 op.u.settime.usecs = tv.tv_usec;
448 op.u.settime.system_time = shadow_system_time;
449 HYPERVISOR_dom0_op(&op);
451 last_update_to_xen = xtime.tv_sec;
452 }
454 /*
455 * If we have an externally synchronized Linux clock, then update
456 * CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be
457 * called as close as possible to 500 ms before the new second starts.
458 */
459 if ((time_status & STA_UNSYNC) == 0 &&
460 xtime.tv_sec > last_rtc_update + 660 &&
461 (xtime.tv_nsec / 1000)
462 >= USEC_AFTER - ((unsigned) TICK_SIZE) / 2 &&
463 (xtime.tv_nsec / 1000)
464 <= USEC_BEFORE + ((unsigned) TICK_SIZE) / 2) {
465 /* horrible...FIXME */
466 if (efi_enabled) {
467 if (efi_set_rtc_mmss(xtime.tv_sec) == 0)
468 last_rtc_update = xtime.tv_sec;
469 else
470 last_rtc_update = xtime.tv_sec - 600;
471 } else if (set_rtc_mmss(xtime.tv_sec) == 0)
472 last_rtc_update = xtime.tv_sec;
473 else
474 last_rtc_update = xtime.tv_sec - 600; /* do it again in 60 s */
475 }
476 #endif
477 }
479 /*
480 * This is the same as the above, except we _also_ save the current
481 * Time Stamp Counter value at the time of the timer interrupt, so that
482 * we later on can estimate the time of day more exactly.
483 */
484 irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
485 {
486 /*
487 * Here we are in the timer irq handler. We just have irqs locally
488 * disabled but we don't know if the timer_bh is running on the other
489 * CPU. We need to avoid to SMP race with it. NOTE: we don' t need
490 * the irq version of write_lock because as just said we have irq
491 * locally disabled. -arca
492 */
493 write_seqlock(&xtime_lock);
494 do_timer_interrupt(irq, NULL, regs);
495 write_sequnlock(&xtime_lock);
496 return IRQ_HANDLED;
497 }
499 /* not static: needed by APM */
500 unsigned long get_cmos_time(void)
501 {
502 unsigned long retval;
504 spin_lock(&rtc_lock);
506 if (efi_enabled)
507 retval = efi_get_time();
508 else
509 retval = mach_get_cmos_time();
511 spin_unlock(&rtc_lock);
513 return retval;
514 }
516 static long clock_cmos_diff;
518 static int __time_suspend(struct sys_device *dev, u32 state)
519 {
520 /*
521 * Estimate time zone so that set_time can update the clock
522 */
523 clock_cmos_diff = -get_cmos_time();
524 clock_cmos_diff += get_seconds();
525 return 0;
526 }
528 static int __time_resume(struct sys_device *dev)
529 {
530 unsigned long sec = get_cmos_time() + clock_cmos_diff;
531 write_seqlock_irq(&xtime_lock);
532 xtime.tv_sec = sec;
533 xtime.tv_nsec = 0;
534 write_sequnlock_irq(&xtime_lock);
535 return 0;
536 }
538 static struct sysdev_class pit_sysclass = {
539 .resume = __time_resume,
540 .suspend = __time_suspend,
541 set_kset_name("pit"),
542 };
545 /* XXX this driverfs stuff should probably go elsewhere later -john */
546 static struct sys_device device_i8253 = {
547 .id = 0,
548 .cls = &pit_sysclass,
549 };
551 static int time_init_device(void)
552 {
553 int error = sysdev_class_register(&pit_sysclass);
554 if (!error)
555 error = sysdev_register(&device_i8253);
556 return error;
557 }
559 device_initcall(time_init_device);
561 #ifdef CONFIG_HPET_TIMER
562 extern void (*late_time_init)(void);
563 /* Duplicate of time_init() below, with hpet_enable part added */
564 void __init hpet_time_init(void)
565 {
566 xtime.tv_sec = get_cmos_time();
567 wall_to_monotonic.tv_sec = -xtime.tv_sec;
568 xtime.tv_nsec = (INITIAL_JIFFIES % HZ) * (NSEC_PER_SEC / HZ);
569 wall_to_monotonic.tv_nsec = -xtime.tv_nsec;
571 if (hpet_enable() >= 0) {
572 printk("Using HPET for base-timer\n");
573 }
575 cur_timer = select_timer();
576 printk(KERN_INFO "Using %s for high-res timesource\n",cur_timer->name);
578 time_init_hook();
579 }
580 #endif
582 /* Dynamically-mapped IRQ. */
583 static int time_irq;
585 static struct irqaction irq_timer = {
586 timer_interrupt, SA_INTERRUPT, CPU_MASK_NONE, "timer",
587 NULL, NULL
588 };
590 void __init time_init(void)
591 {
592 #ifdef CONFIG_HPET_TIMER
593 if (is_hpet_capable()) {
594 /*
595 * HPET initialization needs to do memory-mapped io. So, let
596 * us do a late initialization after mem_init().
597 */
598 late_time_init = hpet_time_init;
599 return;
600 }
601 #endif
602 __get_time_values_from_xen();
603 xtime.tv_sec = shadow_tv.tv_sec;
604 wall_to_monotonic.tv_sec = -xtime.tv_sec;
605 xtime.tv_nsec = shadow_tv.tv_usec * NSEC_PER_USEC;
606 wall_to_monotonic.tv_nsec = -xtime.tv_nsec;
607 processed_system_time = shadow_system_time;
609 cur_timer = select_timer();
610 printk(KERN_INFO "Using %s for high-res timesource\n",cur_timer->name);
612 time_irq = bind_virq_to_irq(VIRQ_TIMER);
614 (void)setup_irq(time_irq, &irq_timer);
615 }
617 /* Convert jiffies to system time. Call with xtime_lock held for reading. */
618 static inline u64 __jiffies_to_st(unsigned long j)
619 {
620 return processed_system_time + ((j - jiffies) * NS_PER_TICK);
621 }
623 /*
624 * This function works out when the the next timer function has to be
625 * executed (by looking at the timer list) and sets the Xen one-shot
626 * domain timer to the appropriate value. This is typically called in
627 * cpu_idle() before the domain blocks.
628 *
629 * The function returns a non-0 value on error conditions.
630 *
631 * It must be called with interrupts disabled.
632 */
633 int set_timeout_timer(void)
634 {
635 u64 alarm = 0;
636 int ret = 0;
638 /*
639 * This is safe against long blocking (since calculations are
640 * not based on TSC deltas). It is also safe against warped
641 * system time since suspend-resume is cooperative and we
642 * would first get locked out. It is safe against normal
643 * updates of jiffies since interrupts are off.
644 */
645 alarm = __jiffies_to_st(next_timer_interrupt());
647 /* Failure is pretty bad, but we'd best soldier on. */
648 if ( HYPERVISOR_set_timer_op(alarm) != 0 )
649 ret = -1;
651 return ret;
652 }
654 void time_suspend(void)
655 {
656 }
658 void time_resume(void)
659 {
660 unsigned long flags;
661 write_lock_irqsave(&xtime_lock, flags);
662 /* Get timebases for new environment. */
663 __get_time_values_from_xen();
664 /* Reset our own concept of passage of system time. */
665 processed_system_time = shadow_system_time;
666 /* Accept a warp in UTC (wall-clock) time. */
667 last_seen_tv.tv_sec = 0;
668 /* Make sure we resync UTC time with Xen on next timer interrupt. */
669 last_update_from_xen = 0;
670 write_unlock_irqrestore(&xtime_lock, flags);
671 }
673 /*
674 * /proc/sys/xen: This really belongs in another file. It can stay here for
675 * now however.
676 */
677 static ctl_table xen_subtable[] = {
678 {1, "independent_wallclock", &independent_wallclock,
679 sizeof(independent_wallclock), 0644, NULL, proc_dointvec},
680 {0}
681 };
682 static ctl_table xen_table[] = {
683 {123, "xen", NULL, 0, 0555, xen_subtable},
684 {0}
685 };
686 static int __init xen_sysctl_init(void)
687 {
688 (void)register_sysctl_table(xen_table, 0);
689 return 0;
690 }
691 __initcall(xen_sysctl_init);