From: "Paul E. McKenney" <paulmck@kernel.org>
To: tglx@linutronix.de
Cc: linux-kernel@vger.kernel.org, john.stultz@linaro.org,
sboyd@kernel.org, corbet@lwn.net, Mark.Rutland@arm.com,
maz@kernel.org, kernel-team@meta.com, neeraju@codeaurora.org,
ak@linux.intel.com, feng.tang@intel.com, zhengjun.xing@intel.com,
"Paul E. McKenney" <paulmck@kernel.org>,
John Stultz <jstultz@google.com>
Subject: [PATCH v2 clocksource 4/7] clocksource: Improve "skew is too large" messages
Date: Tue, 24 Jan 2023 16:27:27 -0800 [thread overview]
Message-ID: <20230125002730.1471349-4-paulmck@kernel.org> (raw)
In-Reply-To: <20230125002708.GA1471122@paulmck-ThinkPad-P17-Gen-1>
When clocksource_watchdog() detects excessive clocksource skew compared
to the watchdog clocksource, it marks the clocksource under test as
unstable and prints several lines worth of message. But that message
is unclear to anyone unfamiliar with the code:
clocksource: timekeeping watchdog on CPU2: Marking clocksource 'wdtest-ktime' as unstable because the skew is too large:
clocksource: 'kvm-clock' wd_nsec: 400744390 wd_now: 612625c2c wd_last: 5fa7f7c66 mask: ffffffffffffffff
clocksource: 'wdtest-ktime' cs_nsec: 600744034 cs_now: 173081397a292d4f cs_last: 17308139565a8ced mask: ffffffffffffffff
clocksource: 'kvm-clock' (not 'wdtest-ktime') is current clocksource.
Therefore, add the following line near the end of that message:
Clocksource 'wdtest-ktime' skewed 199999644 ns (199 ms) over watchdog 'kvm-clock' interval of 400744390 ns (400 ms)
This new line clearly indicates the amount of skew between the two
clocksources, along with the duration of the time interval over which
the skew occurred, both in nanoseconds and milliseconds.
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Cc: John Stultz <jstultz@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Stephen Boyd <sboyd@kernel.org>
Cc: Feng Tang <feng.tang@intel.com>
---
kernel/time/clocksource.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index b59914953809f..fc486cd972635 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -446,12 +446,20 @@ static void clocksource_watchdog(struct timer_list *unused)
/* Check the deviation from the watchdog clocksource. */
md = cs->uncertainty_margin + watchdog->uncertainty_margin;
if (abs(cs_nsec - wd_nsec) > md) {
+ u64 cs_wd_msec;
+ u64 wd_msec;
+ u32 wd_rem;
+
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_nsec: %lld wd_now: %llx wd_last: %llx mask: %llx\n",
watchdog->name, wd_nsec, wdnow, wdlast, watchdog->mask);
pr_warn(" '%s' cs_nsec: %lld cs_now: %llx cs_last: %llx mask: %llx\n",
cs->name, cs_nsec, csnow, cslast, cs->mask);
+ cs_wd_msec = div_u64_rem(cs_nsec - wd_nsec, 1000U * 1000U, &wd_rem);
+ wd_msec = div_u64_rem(wd_nsec, 1000U * 1000U, &wd_rem);
+ pr_warn(" Clocksource '%s' skewed %lld ns (%lld ms) over watchdog '%s' interval of %lld ns (%lld ms)\n",
+ cs->name, cs_nsec - wd_nsec, cs_wd_msec, watchdog->name, wd_nsec, wd_msec);
if (curr_clocksource == cs)
pr_warn(" '%s' is current clocksource.\n", cs->name);
else if (curr_clocksource)
--
2.31.1.189.g2e36527f23
next prev parent reply other threads:[~2023-01-25 0:28 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-25 0:27 [PATCH clocksource v2 0/7] Clocksource watchdog updates for v6.3 Paul E. McKenney
2023-01-25 0:27 ` [PATCH v2 clocksource 1/7] clocksource: Print clocksource name when clocksource is tested unstable Paul E. McKenney
2023-01-25 0:27 ` [PATCH v2 clocksource 2/7] clocksource: Loosen clocksource watchdog constraints Paul E. McKenney
2023-01-25 0:27 ` [PATCH v2 clocksource 3/7] clocksource: Improve read-back-delay message Paul E. McKenney
2023-01-25 0:27 ` Paul E. McKenney [this message]
2023-01-25 0:27 ` [PATCH v2 clocksource 5/7] clocksource: Suspend the watchdog temporarily when high read latency detected Paul E. McKenney
2023-01-25 0:27 ` [PATCH v2 clocksource 6/7] clocksource: Verify HPET and PMTMR when TSC unverified Paul E. McKenney
2023-01-26 10:57 ` Daniel Lezcano
2023-02-01 0:50 ` Paul E. McKenney
2023-02-01 10:24 ` Thomas Gleixner
2023-02-01 15:10 ` Feng Tang
2023-02-01 19:26 ` Waiman Long
2023-02-01 19:55 ` Paul E. McKenney
2023-02-02 3:40 ` Waiman Long
2023-02-02 4:54 ` Paul E. McKenney
2023-02-02 7:57 ` Thomas Gleixner
2023-02-04 1:27 ` Paul E. McKenney
2023-02-01 19:51 ` Paul E. McKenney
2023-01-25 0:27 ` [PATCH v2 clocksource 7/7] x86/tsc: Add option to force frequency recalibration with HW timer Paul E. McKenney
2023-02-03 4:36 ` PATCH v2 clocksource 8/7] clocksource: Enable TSC watchdog checking of HPET and PMTMR only when requested Paul E. McKenney
2023-02-06 19:57 ` Waiman Long
2023-02-07 1:08 ` Paul E. McKenney
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=20230125002730.1471349-4-paulmck@kernel.org \
--to=paulmck@kernel.org \
--cc=Mark.Rutland@arm.com \
--cc=ak@linux.intel.com \
--cc=corbet@lwn.net \
--cc=feng.tang@intel.com \
--cc=john.stultz@linaro.org \
--cc=jstultz@google.com \
--cc=kernel-team@meta.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maz@kernel.org \
--cc=neeraju@codeaurora.org \
--cc=sboyd@kernel.org \
--cc=tglx@linutronix.de \
--cc=zhengjun.xing@intel.com \
/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