[PATCH 9/9] clocksource: Sanity check watchdog clocksource

From: John Stultz
Date: Mon Aug 17 2015 - 16:41:48 EST


From: Shaohua Li <shli@xxxxxx>

Add a sanity check to make sure watchdog clocksource doesn't wrap too
quickly.

Cc: Prarit Bhargava <prarit@xxxxxxxxxx>
Cc: Richard Cochran <richardcochran@xxxxxxxxx>
Cc: Daniel Lezcano <daniel.lezcano@xxxxxxxxxx>
Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxxxxx>
Signed-off-by: Shaohua Li <shli@xxxxxx>
Signed-off-by: John Stultz <john.stultz@xxxxxxxxxx>
---
kernel/time/clocksource.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index 8417c83..64e4629 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -327,7 +327,8 @@ static void clocksource_enqueue_watchdog(struct clocksource *cs)
if (cs->flags & CLOCK_SOURCE_IS_CONTINUOUS)
cs->flags |= CLOCK_SOURCE_VALID_FOR_HRES;
/* Pick the best watchdog. */
- if (!watchdog || cs->rating > watchdog->rating) {
+ if (cs->max_idle_ns > WATCHDOG_MAX_INTERVAL_NS &&
+ (!watchdog || cs->rating > watchdog->rating)) {
watchdog = cs;
/* Reset watchdog cycles */
clocksource_reset_watchdog();
--
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/