Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754987AbYAWQGK (ORCPT ); Wed, 23 Jan 2008 11:06:10 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754136AbYAWQEy (ORCPT ); Wed, 23 Jan 2008 11:04:54 -0500 Received: from ms-smtp-01.nyroc.rr.com ([24.24.2.55]:63058 "EHLO ms-smtp-01.nyroc.rr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752695AbYAWQEu (ORCPT ); Wed, 23 Jan 2008 11:04:50 -0500 Message-Id: <20080123160442.383241528@goodmis.org> References: <20080123160236.969334052@goodmis.org> User-Agent: quilt/0.46-1 Date: Wed, 23 Jan 2008 11:02:44 -0500 From: Steven Rostedt To: LKML Cc: Ingo Molnar , Linus Torvalds , Andrew Morton , Peter Zijlstra , Christoph Hellwig , Mathieu Desnoyers , Gregory Haskins , Arnaldo Carvalho de Melo , Thomas Gleixner , Tim Bird , Sam Ravnborg , "Frank Ch. Eigler" , Jan Kiszka , John Stultz , Arjan van de Ven Subject: [PATCH 08/20 -v5] initialize the clock source to jiffies clock. Content-Disposition: inline; filename=initialize-clocksource-to-jiffies.patch Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2331 Lines: 56 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 points to NULL. This patch simply initializes the clock to use clocksource_jiffies, so that any early user of clocksource_read will not crash. Signed-off-by: Steven Rostedt Acked-by: John Stultz --- include/linux/clocksource.h | 3 +++ kernel/time/timekeeping.c | 9 +++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) Index: linux-mcount.git/include/linux/clocksource.h =================================================================== --- linux-mcount.git.orig/include/linux/clocksource.h 2008-01-23 10:26:57.000000000 -0500 +++ linux-mcount.git/include/linux/clocksource.h 2008-01-23 10:27:04.000000000 -0500 @@ -273,6 +273,9 @@ extern struct clocksource* clocksource_g extern void clocksource_change_rating(struct clocksource *cs, int rating); extern void clocksource_resume(void); +/* used to initialize clock */ +extern struct clocksource clocksource_jiffies; + #ifdef CONFIG_GENERIC_TIME_VSYSCALL extern void update_vsyscall(struct timespec *ts, struct clocksource *c); extern void update_vsyscall_tz(void); Index: linux-mcount.git/kernel/time/timekeeping.c =================================================================== --- linux-mcount.git.orig/kernel/time/timekeeping.c 2008-01-23 10:26:57.000000000 -0500 +++ linux-mcount.git/kernel/time/timekeeping.c 2008-01-23 10:27:04.000000000 -0500 @@ -53,8 +53,13 @@ static inline void update_xtime_cache(u6 timespec_add_ns(&xtime_cache, nsec); } -static struct clocksource *clock; /* pointer to current clocksource */ - +/* + * 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 /** -- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/