diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2011-01-11 11:23:04 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2011-01-11 11:23:04 -0500 |
commit | 211baa7016894c02fc18693e21ca479cd08ac0c0 (patch) | |
tree | 0fea398c6288b46542fc1640adff697f9b1e07a5 | |
parent | 1aa023b8fda8096caf41c20427a0ef396d88eb0f (diff) |
ARM: sched_clock: allow init_sched_clock() to be called early
sched_clock is supposed to be initialized early - in the recently added
init_early platform hook. However, in doing so we end up calling
mod_timer() before the timer lists are initialized, resulting in an
oops.
Split the initialization in two - the part which the platform calls
early which starts things off. The addition of the timer can be
delayed until after we have more of the kernel initialized - when the
normal time sources are initialized.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r-- | arch/arm/include/asm/sched_clock.h | 2 | ||||
-rw-r--r-- | arch/arm/kernel/sched_clock.c | 7 | ||||
-rw-r--r-- | arch/arm/kernel/time.c | 4 |
3 files changed, 12 insertions, 1 deletions
diff --git a/arch/arm/include/asm/sched_clock.h b/arch/arm/include/asm/sched_clock.h index a84628be1a7b..c8e6ddf3e860 100644 --- a/arch/arm/include/asm/sched_clock.h +++ b/arch/arm/include/asm/sched_clock.h | |||
@@ -115,4 +115,6 @@ static inline void init_fixed_sched_clock(struct clock_data *cd, | |||
115 | } | 115 | } |
116 | } | 116 | } |
117 | 117 | ||
118 | extern void sched_clock_postinit(void); | ||
119 | |||
118 | #endif | 120 | #endif |
diff --git a/arch/arm/kernel/sched_clock.c b/arch/arm/kernel/sched_clock.c index 2cdcc9287c74..784464a21c1c 100644 --- a/arch/arm/kernel/sched_clock.c +++ b/arch/arm/kernel/sched_clock.c | |||
@@ -60,10 +60,15 @@ void __init init_sched_clock(struct clock_data *cd, void (*update)(void), | |||
60 | * sets the initial epoch. | 60 | * sets the initial epoch. |
61 | */ | 61 | */ |
62 | sched_clock_timer.data = msecs_to_jiffies(w - (w / 10)); | 62 | sched_clock_timer.data = msecs_to_jiffies(w - (w / 10)); |
63 | sched_clock_poll(sched_clock_timer.data); | 63 | update(); |
64 | 64 | ||
65 | /* | 65 | /* |
66 | * Ensure that sched_clock() starts off at 0ns | 66 | * Ensure that sched_clock() starts off at 0ns |
67 | */ | 67 | */ |
68 | cd->epoch_ns = 0; | 68 | cd->epoch_ns = 0; |
69 | } | 69 | } |
70 | |||
71 | void __init sched_clock_postinit(void) | ||
72 | { | ||
73 | sched_clock_poll(sched_clock_timer.data); | ||
74 | } | ||
diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c index f1e2eb19a67d..3d76bf233734 100644 --- a/arch/arm/kernel/time.c +++ b/arch/arm/kernel/time.c | |||
@@ -29,6 +29,7 @@ | |||
29 | 29 | ||
30 | #include <asm/leds.h> | 30 | #include <asm/leds.h> |
31 | #include <asm/thread_info.h> | 31 | #include <asm/thread_info.h> |
32 | #include <asm/sched_clock.h> | ||
32 | #include <asm/stacktrace.h> | 33 | #include <asm/stacktrace.h> |
33 | #include <asm/mach/arch.h> | 34 | #include <asm/mach/arch.h> |
34 | #include <asm/mach/time.h> | 35 | #include <asm/mach/time.h> |
@@ -163,5 +164,8 @@ void __init time_init(void) | |||
163 | { | 164 | { |
164 | system_timer = machine_desc->timer; | 165 | system_timer = machine_desc->timer; |
165 | system_timer->init(); | 166 | system_timer->init(); |
167 | #ifdef CONFIG_HAVE_SCHED_CLOCK | ||
168 | sched_clock_postinit(); | ||
169 | #endif | ||
166 | } | 170 | } |
167 | 171 | ||