Thread (24 messages) flat view 24 messages, 8 authors, 2015-07-29

Re: [PATCH 3/5] Add calls to translate Always Running Timer (ART) to system time

From: John Stultz <hidden>
Date: 2015-07-28 04:11:30
Also in: lkml

On Mon, Jul 27, 2015 at 5:46 PM, Christopher Hall
[off-list ref] 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help