lkml.org 
[lkml]   [2015]   [Dec]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC][PATCH v2] timekeeping: Cap adjustments so they don't exceed the maxadj value
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


\
 
 \ /
  Last update: 2015-12-14 14:01    [W:0.176 / U:0.280 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site