mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Shaohua Li <shli@fb.com>
To: lkml <linux-kernel@vger.kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	John Stultz <john.stultz@linaro.org>, <calvinowens@fb.com>
Subject: [RFC 2/2] time: double check if watchdog clocksource is correct
Date: Mon, 11 Apr 2016 17:57:57 -0700	[thread overview]
Message-ID: <984ee7ee5ba91bdaa155a16e741f5b83d70233d2.1460422356.git.shli@fb.com> (raw)
In-Reply-To: <09c4f19409012995595db6fd0a12f326c292af1a.1460422356.git.shli@fb.com>

We use watchdog clocksource to detect unstable clocksource. This assumes
watchdog clocksource is correct. But it's possible watchdog clocksource
is crappy, please see previous patch. Double check if watchdog interval
is too long and bypass potential wrong watchdog clocksource.

Signed-off-by: Shaohua Li <shli@fb.com>
---
 kernel/time/clocksource.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index 56ece14..36aff4e 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -122,9 +122,10 @@ static int clocksource_watchdog_kthread(void *data);
 static void __clocksource_change_rating(struct clocksource *cs, int rating);
 
 /*
- * Interval: 0.5sec Threshold: 0.0625s
+ * Interval: 0.5sec, Max Interval: 0.75sec, Threshold: 0.0625s
  */
 #define WATCHDOG_INTERVAL (HZ >> 1)
+#define WATCHDOG_MAX_INTERVAL ((NSEC_PER_SEC >> 1) + (NSEC_PER_SEC >> 2))
 #define WATCHDOG_THRESHOLD (NSEC_PER_SEC >> 4)
 
 static void clocksource_watchdog_work(struct work_struct *work)
@@ -217,7 +218,8 @@ static void clocksource_watchdog(unsigned long data)
 			continue;
 
 		/* Check the deviation from the watchdog clocksource. */
-		if (abs(cs_nsec - wd_nsec) > WATCHDOG_THRESHOLD) {
+		if (abs(cs_nsec - wd_nsec) > WATCHDOG_THRESHOLD &&
+		    wd_nsec < WATCHDOG_MAX_INTERVAL) {
 			pr_warn("timekeeping watchdog on CPU%d: Marking clocksource '%s' as unstable because the skew is too large:\n",
 				smp_processor_id(), cs->name);
 			pr_warn("                      '%s' wd_now: %llx wd_last: %llx mask: %llx\n",
-- 
2.8.0.rc2

  reply	other threads:[~2016-04-12  0:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-12  0:57 [RFC 1/2] time: workaround crappy hpet Shaohua Li
2016-04-12  0:57 ` Shaohua Li [this message]
2016-04-18 17:31   ` [RFC 2/2] time: double check if watchdog clocksource is correct John Stultz
2016-04-18 17:05 ` [RFC 1/2] time: workaround crappy hpet John Stultz
2016-04-18 17:32   ` Shaohua Li
2016-04-18 17:42     ` John Stultz
2016-04-18 17:48       ` Shaohua Li
2016-04-18 17:54         ` John Stultz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=984ee7ee5ba91bdaa155a16e741f5b83d70233d2.1460422356.git.shli@fb.com \
    --to=shli@fb.com \
    --cc=calvinowens@fb.com \
    --cc=john.stultz@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®