From: Thomas Gleixner <tglx@linutronix.de>
To: Miroslav Lichvar <mlichvar@redhat.com>
Cc: John Stultz <jstultz@google.com>,
LKML <linux-kernel@vger.kernel.org>,
Stephen Boyd <sboyd@kernel.org>,
Anna-Maria Behnsen <anna-maria@linutronix.de>,
Frederic Weisbecker <frederic@kernel.org>,
Shuah Khan <shuah@kernel.org>,
linux-kselftest@vger.kernel.org, kernel-team@android.com,
Lei Chen <lei.chen@smartx.com>
Subject: Re: [PATCH v2 1/2] time/timekeeping: Fix possible inconsistencies in _COARSE clockids
Date: Tue, 01 Apr 2025 08:34:23 +0200 [thread overview]
Message-ID: <87o6xgwftc.ffs@tglx> (raw)
In-Reply-To: <Z-qsg6iDGlcIJulJ@localhost>
On Mon, Mar 31 2025 at 16:53, Miroslav Lichvar wrote:
> On Thu, Mar 27, 2025 at 04:42:49PM +0100, Miroslav Lichvar wrote:
>> Maybe I could simply patch the kernel to force a small clock
>> multiplier to increase the rate at which the error accumulates.
>
> I tried that and it indeed makes the issue clearly visible. The COARSE
> fix makes the clock less stable. It's barely visible with the normal
> multiplier, at least for the clocksource I tested, but a reduced
> multiplier forces a larger NTP error and raises it above the precision
> and instability of the system and reference clocks.
>
> The test was done on a machine with a TSC clocksource (3GHz CPU with
> disabled frequency scaling - normal multplier is 5592407) and tried a
> multiplier reduced by 4, 16, 64 with this COARSE-fixing patch not
> applied and applied. Each test ran for 1 minute and produced an
> average value of skew - stability of the clock frequency as reported
> by chronyd in the tracking log when synchronizing to a free-running
> PTP clock at 64, 16, and 4 updates per second. It's in parts per
> million (resolution in the chrony log is limited to 0.001 ppm).
>
> Mult reduction Updates/sec Skew before Skew after
> 1 4 0.000 0.000
> 1 16 0.001 0.002
> 1 64 0.002 0.006
> 4 4 0.001 0.001
> 4 16 0.003 0.005
> 4 64 0.005 0.015
> 16 4 0.004 0.009
> 16 16 0.011 0.069
> 16 64 0.020 0.117
> 64 4 0.013 0.012
> 64 16 0.030 0.107
> 64 64 0.058 0.879
Hrm.
Can you try the delta patch below?
Thanks,
tglx
---
kernel/time/timekeeping.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -2234,8 +2234,8 @@ static bool timekeeping_advance(enum tim
tk->tkr_mono.cycle_last, tk->tkr_mono.mask,
tk->tkr_mono.clock->max_raw_delta);
- /* Check if there's really nothing to do */
- if (offset < real_tk->cycle_interval && mode == TK_ADV_TICK)
+ /* Check if there's really something to do */
+ if (offset < real_tk->cycle_interval)
return false;
offset = timekeeping_accumulate(tk, offset, mode, &clock_set);
next prev parent reply other threads:[~2025-04-01 6:34 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-20 20:03 [PATCH v2 1/2] time/timekeeping: Fix possible inconsistencies in _COARSE clockids John Stultz
2025-03-20 20:03 ` [PATCH v2 2/2] selftests/timers: Improve skew_consistency by testing with other clockids John Stultz
2025-03-21 18:35 ` [tip: timers/core] " tip-bot2 for John Stultz
2025-03-21 18:35 ` [tip: timers/core] timekeeping: Fix possible inconsistencies in _COARSE clockids tip-bot2 for John Stultz
2025-03-25 11:32 ` [PATCH v2 1/2] time/timekeeping: " Miroslav Lichvar
2025-03-27 9:22 ` Thomas Gleixner
2025-03-27 15:42 ` Miroslav Lichvar
2025-03-27 17:32 ` Thomas Gleixner
2025-03-31 7:53 ` Miroslav Lichvar
2025-04-17 2:55 ` John Stultz
2025-03-31 14:53 ` Miroslav Lichvar
2025-04-01 6:34 ` Thomas Gleixner [this message]
2025-04-01 11:19 ` Miroslav Lichvar
2025-04-01 18:29 ` Thomas Gleixner
2025-04-03 8:32 ` Miroslav Lichvar
2025-04-03 11:29 ` Thomas Gleixner
2025-04-05 21:40 ` [PATCH] timekeeping: Prevent coarse clocks going backwards Thomas Gleixner
2025-04-17 5:29 ` John Stultz
2025-04-17 12:36 ` Thomas Gleixner
2025-04-18 0:46 ` John Stultz
2025-04-18 6:37 ` Thomas Gleixner
2025-04-18 7:00 ` Thomas Gleixner
2025-04-19 5:55 ` John Stultz
2025-04-18 18:40 ` John Stultz
2025-04-19 5:46 ` [PATCH v3] " John Stultz
2025-04-24 16:02 ` [tip: timers/urgent] " tip-bot2 for Thomas Gleixner
2025-04-28 9:28 ` tip-bot2 for Thomas Gleixner
2025-04-04 17:22 ` [tip: timers/urgent] Revert "timekeeping: Fix possible inconsistencies in _COARSE clockids" tip-bot2 for Thomas Gleixner
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=87o6xgwftc.ffs@tglx \
--to=tglx@linutronix.de \
--cc=anna-maria@linutronix.de \
--cc=frederic@kernel.org \
--cc=jstultz@google.com \
--cc=kernel-team@android.com \
--cc=lei.chen@smartx.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=mlichvar@redhat.com \
--cc=sboyd@kernel.org \
--cc=shuah@kernel.org \
/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