Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+12 -1
+2
arch/arm/include/asm/sched_clock.h
··· 115 115 } 116 116 } 117 117 118 + extern void sched_clock_postinit(void); 119 + 118 120 #endif
+6 -1
arch/arm/kernel/sched_clock.c
··· 60 60 * sets the initial epoch. 61 61 */ 62 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 66 * Ensure that sched_clock() starts off at 0ns 67 67 */ 68 68 cd->epoch_ns = 0; 69 + } 70 + 71 + void __init sched_clock_postinit(void) 72 + { 73 + sched_clock_poll(sched_clock_timer.data); 69 74 }
+4
arch/arm/kernel/time.c
··· 29 29 30 30 #include <asm/leds.h> 31 31 #include <asm/thread_info.h> 32 + #include <asm/sched_clock.h> 32 33 #include <asm/stacktrace.h> 33 34 #include <asm/mach/arch.h> 34 35 #include <asm/mach/time.h> ··· 164 163 { 165 164 system_timer = machine_desc->timer; 166 165 system_timer->init(); 166 + #ifdef CONFIG_HAVE_SCHED_CLOCK 167 + sched_clock_postinit(); 168 + #endif 167 169 } 168 170