public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Miroslav Lichvar <mlichvar@redhat.com>
To: John Stultz <john.stultz@linaro.org>
Cc: lkml <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 v2] timekeeping: Cap adjustments so they don't exceed the maxadj value
Date: Mon, 14 Dec 2015 13:39:58 +0100	[thread overview]
Message-ID: <20151214123958.GB21828@localhost> (raw)
In-Reply-To: <1449777241-22051-1-git-send-email-john.stultz@linaro.org>

On Thu, Dec 10, 2015 at 11:54:01AM -0800, John Stultz wrote:
> Thus its been occasionally noted that users have seen
> confusing warnings like:
> 
>     Adjusting tsc more than 11% (5941981 vs 7759439)

> @@ -1612,13 +1615,32 @@ static __always_inline void timekeeping_freqadjust(struct timekeeper *tk,
>  	/* preserve the direction of correction */
>  	negative = (tick_error < 0);
>  
> -	/* Sort out the magnitude of the correction */
> +	/* If any adjustment would pass the max, just return */
> +	if (negative && (cur_adj - 1) < (base - max))
> +		return;
> +	if (!negative && (cur_adj + 1) > (base + max))
> +		return;

I ran the test that triggered the warning previously and it was silent
now.

But it looks like timekeeping_adjust() should check the adjustment too
before calling timekeeping_apply_adjustment(). In linux-tktest I was
able to find a configuration (-t 10 -n 150 -p 10000000) that triggered
the warning again. I'm not sure how likely it is to happen in real
world and if it's worth fixing though.

To avoid adding even more code, maybe the check could be moved to
timekeeping_apply_adjustment()? It would try decreasing adj_scale
until the check passes. When it reached -1, the function would return
immediately with no adjustment of the multiplier.

-- 
Miroslav Lichvar

      reply	other threads:[~2015-12-14 12:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-10 19:54 [RFC][PATCH v2] timekeeping: Cap adjustments so they don't exceed the maxadj value John Stultz
2015-12-14 12:39 ` Miroslav Lichvar [this message]

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=20151214123958.GB21828@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