[patch] clocksource: add verification (watchdog) helper, fix

Ingo Molnar
2007-01-24T15:44:01Z

one out of my 10 testsystems didnt properly enter high-res mode (but
safely fell back to low-res mode), the patch below fixes this.

Ingo

---------------------------->
Subject: [patch] clocksource: add verification (watchdog) helper, fix
From: Ingo Molnar <mingo@elte.hu>

if a clocksource is being verified by the watchdog, but the watchdog
clocksource is registered /after/ the possibly-unstable clocksource has
been registered, then when we switch that clocksource into high-res
capable mode we also need to propagate this fact to the rest of the
system - so that it properly switches into high-res mode.

this solves one particular system not entering high-res mode (but
falling back to low-res mode) - with this patch it properly enters
high-res mode:

Switched to high resolution mode on CPU 0
Switched to high resolution mode on CPU 1
Switched to high resolution mode on CPU 2
Switched to high resolution mode on CPU 3

Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
kernel/time/clocksource.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)

Index: linux/kernel/time/clocksource.c
===================================================================
--- linux.orig/kernel/time/clocksource.c
+++ linux/kernel/time/clocksource.c
@@ -28,6 +28,7 @@
#include <linux/sysdev.h>
#include <linux/init.h>
#include <linux/module.h>
+#include <linux/tick.h>

/* XXX - Would like a better way for initializing curr_clocksource */
extern struct clocksource clocksource_jiffies;
@@ -106,8 +107,16 @@ static void clocksource_watchdog(unsigne
/* Initialized ? */
if (!(cs->flags & CLOCK_SOURCE_WATCHDOG)) {
if ((cs->flags & CLOCK_SOURCE_IS_CONTINUOUS) &&
- (watchdog->flags & CLOCK_SOURCE_IS_CONTINUOUS))
+ (watchdog->flags & CLOCK_SOURCE_IS_CONTINUOUS)) {
cs->flags |= CLOCK_SOURCE_VALID_FOR_HRES;
+ /*
+ * We just marked the clocksource as
+ * highres-capable, notify the rest of the
+ * system as well so that we transition
+ * into high-res mode:
+ */
+ tick_clock_notify();
+ }
cs->flags |= CLOCK_SOURCE_WATCHDOG;
cs->wd_last = csnow;
} else {