From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751862AbbJBU1U (ORCPT ); Fri, 2 Oct 2015 16:27:20 -0400 Received: from mail-ig0-f179.google.com ([209.85.213.179]:38259 "EHLO mail-ig0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751167AbbJBU1Q (ORCPT ); Fri, 2 Oct 2015 16:27:16 -0400 MIME-Version: 1.0 In-Reply-To: References: <1441840051-20244-1-git-send-email-john.stultz@linaro.org> <1441840051-20244-2-git-send-email-john.stultz@linaro.org> <20150910120220.GV24711@localhost> <20150914144843.GB11010@localhost> Date: Fri, 2 Oct 2015 13:27:15 -0700 Message-ID: Subject: Re: [PATCH 2/2 (v2)] kselftest: timers: Add adjtick test to validate adjtimex() tick adjustments From: John Stultz To: Miroslav Lichvar Cc: LKML , =?UTF-8?Q?Nuno_Gon=C3=A7alves?= , Prarit Bhargava , Richard Cochran , Ingo Molnar , Thomas Gleixner , Shuah Khan Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 2, 2015 at 1:25 PM, John Stultz wrote: > On Mon, Sep 14, 2015 at 7:48 AM, Miroslav Lichvar wrote: >> Is there a cheap way to calculate this? >> xtime_remainder * (ntp_tick >> ntp_error_shift) / NTP_INTERVAL_LENGTH > > > > Hrm.. So > xtime_remainder = (NTP_INTERVAL_LENGTH << > tk->tkr_mono.clock->shift) - (tk->cycle_interval * > tk->tkr_mono.clock->mult) > > for simplificiation: > > And we want to scale it as you pointed out above (though slightly > fixed here) by: > (tk->ntp_tick >> tk->ntp_error_shift) / (NTP_INTERVAL_LENGTH > << tk->tkr_mono.clock->shift) > > > So this comes out to: > > > (tk->ntp_tick ) - (tk->ntp_tick ) * (tk->cycle_interval * > tk->tkr_mono.clock->mult) / (NTP_INTERVAL_LENGTH << > tk->tkr_mono.clock->shift) > tk->ntp_error_shift > > > > would: > > xtime_remainder = (tk->ntp_tick >> ntp_error_shift) - tk->xtime_interval > > After we've adjusted xtime_interval give us the equivalent? Bah.. Ignore the above here. I was still working out a calculation and accidentally hit send. -john