aboutsummaryrefslogtreecommitdiff
path: root/arch/um/kernel
diff options
context:
space:
mode:
authorJeff Dike <jdike@addtoit.com>2007-10-16 01:27:25 -0700
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-16 09:43:08 -0700
commitd2753a6d199791a6abc75d9f657e3457fe61705f (patch)
treec4cda30f216d6c045ca2b83bee1fa6bc4dfc3de3 /arch/um/kernel
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/kernel')
-rw-r--r--arch/um/kernel/process.c3
-rw-r--r--arch/um/kernel/time.c45
2 files changed, 13 insertions, 35 deletions
diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c
index 56d75afedbf..aef494b6b81 100644
--- a/arch/um/kernel/process.c
+++ b/arch/um/kernel/process.c
@@ -13,6 +13,7 @@
#include "linux/ptrace.h"
#include "linux/random.h"
#include "linux/sched.h"
+#include "linux/tick.h"
#include "linux/threads.h"
#include "asm/pgtable.h"
#include "asm/uaccess.h"
@@ -244,9 +245,11 @@ void default_idle(void)
if (need_resched())
schedule();
+ tick_nohz_stop_sched_tick();
switch_timers(1);
idle_sleep(10);
switch_timers(0);
+ tick_nohz_restart_sched_tick();
}
}
diff --git a/arch/um/kernel/time.c b/arch/um/kernel/time.c
index 3cb7135e5c4..2acdc7efb2a 100644
--- a/arch/um/kernel/time.c
+++ b/arch/um/kernel/time.c
@@ -20,41 +20,12 @@ unsigned long long sched_clock(void)
return (unsigned long long)jiffies_64 * (1000000000 / HZ);
}
-#ifdef CONFIG_UML_REAL_TIME_CLOCK
-static unsigned long long prev_nsecs[NR_CPUS];
-static long long delta[NR_CPUS]; /* Deviation per interval */
-#endif
-
void timer_handler(int sig, struct uml_pt_regs *regs)
{
- unsigned long long ticks = 0;
unsigned long flags;
-#ifdef CONFIG_UML_REAL_TIME_CLOCK
- int c = cpu();
- if (prev_nsecs[c]) {
- /* We've had 1 tick */
- unsigned long long nsecs = os_nsecs();
-
- delta[c] += nsecs - prev_nsecs[c];
- prev_nsecs[c] = nsecs;
-
- /* Protect against the host clock being set backwards */
- if (delta[c] < 0)
- delta[c] = 0;
-
- ticks += (delta[c] * HZ) / BILLION;
- delta[c] -= (ticks * BILLION) / HZ;
- }
- else prev_nsecs[c] = os_nsecs();
-#else
- ticks = 1;
-#endif
local_irq_save(flags);
- while (ticks > 0) {
- do_IRQ(TIMER_IRQ, regs);
- ticks--;
- }
+ do_IRQ(TIMER_IRQ, regs);
local_irq_restore(flags);
}
@@ -68,10 +39,8 @@ static void itimer_set_mode(enum clock_event_mode mode,
case CLOCK_EVT_MODE_SHUTDOWN:
case CLOCK_EVT_MODE_UNUSED:
- disable_timer();
- break;
case CLOCK_EVT_MODE_ONESHOT:
- BUG();
+ disable_timer();
break;
case CLOCK_EVT_MODE_RESUME:
@@ -79,13 +48,19 @@ static void itimer_set_mode(enum clock_event_mode mode,
}
}
+static int itimer_next_event(unsigned long delta,
+ struct clock_event_device *evt)
+{
+ return timer_one_shot(delta + 1);
+}
+
static struct clock_event_device itimer_clockevent = {
.name = "itimer",
.rating = 250,
.cpumask = CPU_MASK_ALL,
- .features = CLOCK_EVT_FEAT_PERIODIC,
+ .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
.set_mode = itimer_set_mode,
- .set_next_event = NULL,
+ .set_next_event = itimer_next_event,
.shift = 32,
.irq = 0,
};