[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140207114559.GA30949@localhost>
Date: Fri, 7 Feb 2014 12:45:59 +0100
From: Miroslav Lichvar <mlichvar@...hat.com>
To: John Stultz <john.stultz@...aro.org>
Cc: LKML <linux-kernel@...r.kernel.org>,
Richard Cochran <richardcochran@...il.com>,
Prarit Bhargava <prarit@...hat.com>
Subject: Re: [PATCH] [RFC] timekeeping: Rework frequency adjustments to work
better w/ nohz
On Mon, Jan 06, 2014 at 07:57:03PM -0800, John Stultz wrote:
> Got a few cycles to take another look at this, and tried to address
> Miroslav's latest comments. Please let me know if you have further
> thoughts!
I've had finally some time to look at this, sorry for the delay.
> I also dropped the tk->ntp_error adjustments, as I've never quite
> been able to recall how that was correct, and it doesn't seem to
> have any affect in the simulator. Will have to proceed carefully
> with testing here.
I see some effect of the ntp_error correction in the simulator, but it
seems rather disruptive than helpful. Perhaps the correction was meant
to account the fact that for the ntp_error accumulation ntp_tick
should change at the time when mult is changed instead of start of the
tick. I tried to find that correction and came up with this:
(ntp_tick1 - ntp_tick2) * offset / interval + offset
That doesn't look usable. But I don't think it's really necessary to
have any correction for that and I'm for dropping that line from the
code as your patch does.
Anyway, it seems there is a different problem in the code. I modified
the simulator to see how the code works when the clocksource frequency
is not divisible by HZ. With TSC_FREQ set to 3579545 (acpi_pm freq)
ntp_error doesn't settle down and the clock has a large frequency
error.
On top of your patch, this fixes the problem for me:
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -1065,7 +1065,7 @@ static __always_inline void timekeeping_freqadjust(struct timekeeper *tk,
/* Calculate current error per tick */
tick_error = ntp_tick_length() >> tk->ntp_error_shift;
- tick_error -= tk->xtime_interval;
+ tick_error -= tk->xtime_interval + tk->xtime_remainder;
/* Don't worry about correcting it if its small */
if (likely(abs(tick_error) < 2*interval))
My patch has this problem too. The original code seems to be affected
to some extent, it's able to converge to the correct frequency, but
there is some residual ntp error. Adding xtime_remainder to
timekeeping_bigadjust() fixes that.
I've some comments on the performance of the proposed code, I'll send
them in a separate mail later.
Thanks,
--
Miroslav Lichvar
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists