From: Miroslav Lichvar <mlichvar@redhat.com>
To: John Stultz <john.stultz@linaro.org>
Cc: linux-kernel@vger.kernel.org,
Thomas Gleixner <tglx@linutronix.de>,
Richard Cochran <richardcochran@gmail.com>,
Prarit Bhargava <prarit@redhat.com>,
Andy Lutomirski <luto@kernel.org>
Subject: Re: [RFC][PATCH] timekeeping: Cap adjustments so they don't exceede the maxadj value
Date: Mon, 7 Dec 2015 15:43:19 +0100 [thread overview]
Message-ID: <20151207144319.GB1402@localhost> (raw)
In-Reply-To: <1449266274-26517-1-git-send-email-john.stultz@linaro.org>
On Fri, Dec 04, 2015 at 01:57:54PM -0800, John Stultz wrote:
> Thus its been occasionally noted that users have seen
> confusing warnings like:
>
> Adjusting tsc more than 11% (5941981 vs 7759439)
Thanks for looking into this, John.
> Thus this patch adds some extra logic to enforce the max adjustment
> cap in the internal steering.
>
> Note: This has the potential to slow corrections when the ADJ_TICK
> value is furthest away from the default value. So it would be good to
> get some testing from folks using Chrony, to make sure we don't
> cause any troubles there.
I ran few tests with chronyd, forcing it to make the largest possible
adjustment of the tick and it seems to work fine.
However, I'm still able to trigger the warning by feeding a large
offset to the NTP PLL using a short time constant. When the multiplier
is already at the maximum and it wants to move it even further, there
should be no timekeeping_apply_adjustment() call as it always adjusts
the multiplier at least by one.
> + adj_scale = 0;
> tick_error = abs(tick_error);
> - for (adj = 0; tick_error > interval; adj++)
> + while (tick_error > interval) {
> + u32 base = tk->tkr_mono.clock->mult;
> + u32 max = tk->tkr_mono.clock->maxadj;
> + u32 cur_adj = tk->tkr_mono.mult;
> + u32 adj = 1 << (adj_scale + 1);
> +
> + if (negative && (cur_adj - adj) < (base - max))
> + break;
> + if (!negative && (cur_adj + adj) > (base + max))
> + break;
> +
> + adj_scale++;
> tick_error >>= 1;
> + }
>
> /* scale the corrections */
> - timekeeping_apply_adjustment(tk, offset, negative, adj);
> + timekeeping_apply_adjustment(tk, offset, negative, adj_scale);
--
Miroslav Lichvar
next prev parent reply other threads:[~2015-12-07 14:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-04 21:57 [RFC][PATCH] timekeeping: Cap adjustments so they don't exceede the maxadj value John Stultz
2015-12-07 14:43 ` Miroslav Lichvar [this message]
2015-12-08 1:14 ` 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=20151207144319.GB1402@localhost \
--to=mlichvar@redhat.com \
--cc=john.stultz@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=prarit@redhat.com \
--cc=richardcochran@gmail.com \
--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