提交 8cf4e750 编写于 作者: M Martin Schwidefsky 提交者: Thomas Gleixner

clocksource: Delay clocksource watchdog highres enablement

The clocksource watchdog marks a clock as highres capable before it
checked the deviation from the watchdog clocksource even for a single
time. Make sure that the deviation is at least checked once before
doing the switch to highres mode.
Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Ingo Molnar <mingo@elte.hu>
Acked-by: NJohn Stultz <johnstul@us.ibm.com>
Cc: Daniel Walker <dwalker@fifo99.com>
LKML-Reference: <20090814134808.627795883@de.ibm.com>
Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
上级 f1b82746
...@@ -153,11 +153,8 @@ static unsigned long watchdog_resumed; ...@@ -153,11 +153,8 @@ static unsigned long watchdog_resumed;
#define WATCHDOG_INTERVAL (HZ >> 1) #define WATCHDOG_INTERVAL (HZ >> 1)
#define WATCHDOG_THRESHOLD (NSEC_PER_SEC >> 4) #define WATCHDOG_THRESHOLD (NSEC_PER_SEC >> 4)
static void clocksource_ratewd(struct clocksource *cs, int64_t delta) static void clocksource_unstable(struct clocksource *cs, int64_t delta)
{ {
if (delta > -WATCHDOG_THRESHOLD && delta < WATCHDOG_THRESHOLD)
return;
printk(KERN_WARNING "Clocksource %s unstable (delta = %Ld ns)\n", printk(KERN_WARNING "Clocksource %s unstable (delta = %Ld ns)\n",
cs->name, delta); cs->name, delta);
cs->flags &= ~(CLOCK_SOURCE_VALID_FOR_HRES | CLOCK_SOURCE_WATCHDOG); cs->flags &= ~(CLOCK_SOURCE_VALID_FOR_HRES | CLOCK_SOURCE_WATCHDOG);
...@@ -183,31 +180,31 @@ static void clocksource_watchdog(unsigned long data) ...@@ -183,31 +180,31 @@ static void clocksource_watchdog(unsigned long data)
list_for_each_entry_safe(cs, tmp, &watchdog_list, wd_list) { list_for_each_entry_safe(cs, tmp, &watchdog_list, wd_list) {
csnow = cs->read(cs); csnow = cs->read(cs);
if (unlikely(resumed)) { /* Clocksource initialized ? */
if (!(cs->flags & CLOCK_SOURCE_WATCHDOG)) {
cs->flags |= CLOCK_SOURCE_WATCHDOG;
cs->wd_last = csnow; cs->wd_last = csnow;
continue; continue;
} }
/* Initialized ? */ /* Check the deviation from the watchdog clocksource. */
if (!(cs->flags & CLOCK_SOURCE_WATCHDOG)) { cs_nsec = cyc2ns(cs, (csnow - cs->wd_last) & cs->mask);
if ((cs->flags & CLOCK_SOURCE_IS_CONTINUOUS) && cs->wd_last = csnow;
(watchdog->flags & CLOCK_SOURCE_IS_CONTINUOUS)) { if (abs(cs_nsec - wd_nsec) > WATCHDOG_THRESHOLD) {
cs->flags |= CLOCK_SOURCE_VALID_FOR_HRES; clocksource_unstable(cs, cs_nsec - wd_nsec);
/* continue;
* We just marked the clocksource as }
* highres-capable, notify the rest of the
* system as well so that we transition if (!(cs->flags & CLOCK_SOURCE_VALID_FOR_HRES) &&
* into high-res mode: (cs->flags & CLOCK_SOURCE_IS_CONTINUOUS) &&
*/ (watchdog->flags & CLOCK_SOURCE_IS_CONTINUOUS)) {
tick_clock_notify(); cs->flags |= CLOCK_SOURCE_VALID_FOR_HRES;
} /*
cs->flags |= CLOCK_SOURCE_WATCHDOG; * We just marked the clocksource as highres-capable,
cs->wd_last = csnow; * notify the rest of the system as well so that we
} else { * transition into high-res mode:
cs_nsec = cyc2ns(cs, (csnow - cs->wd_last) & cs->mask); */
cs->wd_last = csnow; tick_clock_notify();
/* Check the delta. Might remove from the list ! */
clocksource_ratewd(cs, cs_nsec - wd_nsec);
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册