Skip to contentSkip to conversation

initialize the clock source to jiffies clock.

PATCH In review Steven Rostedt 1 participant 1 message Aug 24, 2007 Timekeeping, clocksource core, NTP, alarmtimer

lore
Share & tools
lore
#0 lore raw

PATCH 2/3 initialize the clock source to jiffies clock.

The latency tracer can call clocksource_read very early in bootup and before the clock source variable has been initialized. This results in a crash at boot up (even before earlyprintk is initialized). Since the clock->read variable is points to NULL.

This patch simply initializes the clock to use clocksource_jiffies, so that any early user of clocksource_read will not crash.

kernel/time/timekeeping.c +9 -1
Index: linux-2.6-rt/kernel/time/timekeeping.c
===================================================================
@@ -43,7 +43,15 @@ struct timespec wall_to_monotonic __attr
 EXPORT_SYMBOL(xtime);
 
 
-static struct clocksource *clock; /* pointer to current clocksource */
+extern struct clocksource clocksource_jiffies;
+
+/*
+ * pointer to current clocksource
+ *  Just in case we use clocksource_read before we initialize
+ *  the actual clock source. Instead of calling a NULL read pointer
+ *  we return jiffies.
+ */
+static struct clocksource *clock = &clocksource_jiffies;
 
 
 #ifdef CONFIG_GENERIC_TIME