Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752624AbbG1ELa (ORCPT ); Tue, 28 Jul 2015 00:11:30 -0400 Received: from mail-ig0-f175.google.com ([209.85.213.175]:38613 "EHLO mail-ig0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750712AbbG1EL3 (ORCPT ); Tue, 28 Jul 2015 00:11:29 -0400 MIME-Version: 1.0 In-Reply-To: <1438044416-15588-4-git-send-email-christopher.s.hall@intel.com> References: <1438044416-15588-1-git-send-email-christopher.s.hall@intel.com> <1438044416-15588-4-git-send-email-christopher.s.hall@intel.com> Date: Mon, 27 Jul 2015 21:11:28 -0700 Message-ID: Subject: Re: [PATCH 3/5] Add calls to translate Always Running Timer (ART) to system time From: John Stultz To: Christopher Hall Cc: Thomas Gleixner , Richard Cochran , Ingo Molnar , Jeff Kirsher , john.ronciak@intel.com, "H. Peter Anvin" , "x86@kernel.org" , lkml , netdev@vger.kernel.org Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1272 Lines: 35 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. 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/