Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752573AbbG2CFP (ORCPT ); Tue, 28 Jul 2015 22:05:15 -0400 Received: from mga14.intel.com ([192.55.52.115]:18450 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751520AbbG2CFN (ORCPT ); Tue, 28 Jul 2015 22:05:13 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,568,1432623600"; d="scan'208";a="614885800" 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 3/5] Add calls to translate Always Running Timer (ART) to system time Thread-Topic: [PATCH 3/5] Add calls to translate Always Running Timer (ART) to system time Thread-Index: AQHQyM7L8oiVoLdWo0mhpAdaK5Mix53wuq4AgAD3jEA= Date: Wed, 29 Jul 2015 02:05:12 +0000 Message-ID: References: <1438044416-15588-1-git-send-email-christopher.s.hall@intel.com> <1438044416-15588-4-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 t6T25L2f022103 Content-Length: 2021 Lines: 56 > -----Original Message----- > From: John Stultz [mailto:john.stultz@linaro.org] > Sent: Monday, July 27, 2015 9:11 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 3/5] Add calls to translate Always Running Timer > (ART) to system time > > On Mon, Jul 27, 2015 at 5:46 PM, Christopher Hall > wrote: > > +static bool checked_art_to_tsc(cycle_t *tsc) > > +{ > > + if (!has_art()) > > + return false; > > + *tsc = art_to_tsc(*tsc); > > + return true; > > +} > > + > > +static int art_to_rawmono64(struct timespec64 *rawmono, cycle_t art) > > +{ > > + if (!checked_art_to_tsc(&art)) > > + return -ENXIO; > > + return tsc_to_rawmono64(rawmono, art); > > +} > > +EXPORT_SYMBOL(art_to_rawmono64); > > This all seems to assume the TSC is the current clocksource, which it > may not be if the user has overridden it. I don't make that assumption. The counter_to_* functions take a pointer to a clocksource struct. They return -ENXIO if that clocksource doesn’t match the current clocksource. The tsc_to_* functions pass the tsc clocksource pointer to the counter_to_* functions. These tsc conversion functions are called by the art_to_* functions. > > If instead there were a counter_to_rawmono64() which took the counter > value and maybe the name of the clocksource (if the strncmp is > affordable for your use), it might be easier for the core to provide > an error if the current timekeeping clocksource isn't the one the > counter value is based on. This would also allow the tsc_to_*() > midlayers to be dropped (since they don't seem to do much). > > thanks > -john Again, thanks for your input. Chris ????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?