aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/os-Linux/time.c
diff options
context:
space:
mode:
authorJeff Dike <jdike@addtoit.com>2007-10-16 04:27:25 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-16 12:43:08 -0400
commitd2753a6d199791a6abc75d9f657e3457fe61705f (patch)
treec4cda30f216d6c045ca2b83bee1fa6bc4dfc3de3 /arch/um/os-Linux/time.c
parent791a644a8d73a9b95515f074afbb3caa0a9964fa (diff)
uml: tickless support
Enable tickless support. CONFIG_TICK_ONESHOT and CONFIG_NO_HZ are enabled. itimer_clockevent gets CLOCK_EVT_FEAT_ONESHOT and an implementation of .set_next_event. CONFIG_UML_REAL_TIME_CLOCK goes away because it only makes sense when there is a clock ticking away all the time. timer_handler now just calls do_IRQ once without trying to figure out how many ticks to emulate. The idle loop now needs to turn ticking on and off. Userspace ticks keep happening as usual. However, the userspace loop keep track of when the next wakeup should happen and suppresses process ticks until that happens. Signed-off-by: Jeff Dike <jdike@linux.intel.com> Cc: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/um/os-Linux/time.c')
-rw-r--r--arch/um/os-Linux/time.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/arch/um/os-Linux/time.c b/arch/um/os-Linux/time.c
index 6ff3d98281ba..9ffc61ac8ed6 100644
--- a/arch/um/os-Linux/time.c
+++ b/arch/um/os-Linux/time.c
@@ -26,6 +26,21 @@ int set_interval(void)
26 return 0; 26 return 0;
27} 27}
28 28
29int timer_one_shot(int ticks)
30{
31 unsigned long usec = ticks * 1000000 / UM_HZ;
32 unsigned long sec = usec / 1000000;
33 struct itimerval interval;
34
35 usec %= 1000000;
36 interval = ((struct itimerval) { { 0, 0 }, { sec, usec } });
37
38 if (setitimer(ITIMER_VIRTUAL, &interval, NULL) == -1)
39 return -errno;
40
41 return 0;
42}
43
29void disable_timer(void) 44void disable_timer(void)
30{ 45{
31 struct itimerval disable = ((struct itimerval) { { 0, 0 }, { 0, 0 }}); 46 struct itimerval disable = ((struct itimerval) { { 0, 0 }, { 0, 0 }});
@@ -74,7 +89,7 @@ unsigned long long os_nsecs(void)
74 struct timeval tv; 89 struct timeval tv;
75 90
76 gettimeofday(&tv, NULL); 91 gettimeofday(&tv, NULL);
77 return (unsigned long long) tv.tv_sec * BILLION + tv.tv_usec * 1000; 92 return timeval_to_ns(&tv);
78} 93}
79 94
80void idle_sleep(int secs) 95void idle_sleep(int secs)