Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752656AbbG2Blj (ORCPT ); Tue, 28 Jul 2015 21:41:39 -0400 Received: from mga11.intel.com ([192.55.52.93]:24427 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752379AbbG2Blh (ORCPT ); Tue, 28 Jul 2015 21:41:37 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,568,1432623600"; d="scan'208";a="771863540" From: "Hall, Christopher S" To: "'John Stultz'" CC: Thomas Gleixner , Richard Cochran , Ingo Molnar , "Kirsher, Jeffrey T" , "Ronciak, John" , "H. Peter Anvin" , "x86@kernel.org" , lkml , "netdev@vger.kernel.org" Subject: RE: [PATCH 1/5] Add functions producing system time given a backing counter value Thread-Topic: [PATCH 1/5] Add functions producing system time given a backing counter value Thread-Index: AQHQyM7Ka/13O/TZuEmnSw9juiX70Z3wswkAgAD0coA= Date: Wed, 29 Jul 2015 01:41:34 +0000 Message-ID: References: <1438044416-15588-1-git-send-email-christopher.s.hall@intel.com> <1438044416-15588-2-git-send-email-christopher.s.hall@intel.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.22.254.138] Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id t6T1fh7p022050 Content-Length: 2275 Lines: 61 > -----Original Message----- > From: John Stultz [mailto:john.stultz@linaro.org] > Sent: Monday, July 27, 2015 8:44 PM > To: Hall, Christopher S > Cc: Thomas Gleixner; Richard Cochran; Ingo Molnar; Kirsher, Jeffrey T; > Ronciak, John; H. Peter Anvin; x86@kernel.org; lkml; > netdev@vger.kernel.org > Subject: Re: [PATCH 1/5] Add functions producing system time given a > backing counter value > > On Mon, Jul 27, 2015 at 5:46 PM, Christopher Hall > wrote: > > * counter_to_rawmono64 > > * counter_to_mono64 > > * counter_to_realtime64 > > > > Enables drivers to translate a captured system clock counter to system > > time. This is useful for network and audio devices that capture > timestamps > > in terms of both the system clock and device clock. > > Huh. So for counter_to_realtime64 & mono64, this seems to ignore the > fact that the multiplier is constantly adjusted and corrected. So that > calling the function twice with the same counter value may result in > different returned values. > > I've not yet groked the whole patchset, but it seems like there needs > to be some mechanism that ensures the counter value is captured and > used in the same (or at least close) interval that the timekeeper data > is valid for. The ART (and derived TSC) values are always in the past. There's no chance that we could exceed the interval. I don't think any similar usage would be a problem either. Are you suggesting that, for completeness, this be enforced by the conversion function? I do a check here to make sure that the current counter value isn't before the beginning of the current interval: timekeeping_get_delta() ... if (cycle_now < tkr->cycle_last && tkr->cycle_last - cycle_now < ROLLOVER_THRESHOLD) return -EAGAIN; If tkr->cycle_last - cycle_now is large, the assumption is that rollover occurred. Otherwise, the caller should re-read the counter so that it falls within the current interval. In my "normal use" testing, re-read never occurred. Thanks for your input. Chris > > thanks > -john ????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?