Commit 211baa70 authored by Russell King's avatar Russell King

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: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 1aa023b8
...@@ -115,4 +115,6 @@ static inline void init_fixed_sched_clock(struct clock_data *cd, ...@@ -115,4 +115,6 @@ static inline void init_fixed_sched_clock(struct clock_data *cd,
} }
} }
extern void sched_clock_postinit(void);
#endif #endif
...@@ -60,10 +60,15 @@ void __init init_sched_clock(struct clock_data *cd, void (*update)(void), ...@@ -60,10 +60,15 @@ void __init init_sched_clock(struct clock_data *cd, void (*update)(void),
* sets the initial epoch. * sets the initial epoch.
*/ */
sched_clock_timer.data = msecs_to_jiffies(w - (w / 10)); sched_clock_timer.data = msecs_to_jiffies(w - (w / 10));
sched_clock_poll(sched_clock_timer.data); update();
/* /*
* Ensure that sched_clock() starts off at 0ns * Ensure that sched_clock() starts off at 0ns
*/ */
cd->epoch_ns = 0; cd->epoch_ns = 0;
} }
void __init sched_clock_postinit(void)
{
sched_clock_poll(sched_clock_timer.data);
}
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include <asm/leds.h> #include <asm/leds.h>
#include <asm/thread_info.h> #include <asm/thread_info.h>
#include <asm/sched_clock.h>
#include <asm/stacktrace.h> #include <asm/stacktrace.h>
#include <asm/mach/arch.h> #include <asm/mach/arch.h>
#include <asm/mach/time.h> #include <asm/mach/time.h>
...@@ -163,5 +164,8 @@ void __init time_init(void) ...@@ -163,5 +164,8 @@ void __init time_init(void)
{ {
system_timer = machine_desc->timer; system_timer = machine_desc->timer;
system_timer->init(); system_timer->init();
#ifdef CONFIG_HAVE_SCHED_CLOCK
sched_clock_postinit();
#endif
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment