netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: "Hall, Christopher S" <christopher.s.hall@intel.com>
Cc: 'John Stultz' <john.stultz@linaro.org>,
	Richard Cochran <richardcochran@gmail.com>,
	Ingo Molnar <mingo@redhat.com>,
	"Kirsher, Jeffrey T" <jeffrey.t.kirsher@intel.com>,
	"Ronciak, John" <john.ronciak@intel.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	"x86@kernel.org" <x86@kernel.org>,
	lkml <linux-kernel@vger.kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: RE: [PATCH 1/5] Add functions producing system time given a backing counter value
Date: Wed, 29 Jul 2015 16:05:19 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.11.1507291603220.3825@nanos> (raw)
In-Reply-To: <B79D786B7111A34A8CF09F833429C493A909CEE1@ORSMSX109.amr.corp.intel.com>

On Wed, 29 Jul 2015, Hall, Christopher S wrote:
> 
> > -----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
> > <christopher.s.hall@intel.com> 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.

Sure that never happens, because your rollover value is 2 << 39 for
whatever reasons.

So on a 1GHz machine that is (2 << 39) / 1e9 ~= 1099.51 seconds.

Oh well.

  reply	other threads:[~2015-07-29 14:05 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-28  0:46 [PATCH 0/5] Patchset enabling hardware based cross-timestamps for next gen Intel platforms Christopher Hall
2015-07-28  0:46 ` [PATCH 1/5] Add functions producing system time given a backing counter value Christopher Hall
2015-07-28  3:44   ` John Stultz
2015-07-28  4:05     ` John Stultz
2015-07-29 10:19       ` Thomas Gleixner
2015-07-29 10:23         ` Thomas Gleixner
2015-07-29 10:51           ` Peter Zijlstra
2015-07-29 12:30           ` Richard Cochran
2015-07-29 10:49         ` Peter Zijlstra
2015-07-29 11:48           ` Richard Cochran
2015-07-29 12:35             ` Peter Zijlstra
2015-07-29 12:52           ` Thomas Gleixner
2015-07-29  1:41     ` Hall, Christopher S
2015-07-29 14:05       ` Thomas Gleixner [this message]
2015-07-28  0:46 ` [PATCH 2/5] Added functions mapping TSC value to system time Christopher Hall
2015-07-28  0:46 ` [PATCH 3/5] Add calls to translate Always Running Timer (ART) " Christopher Hall
2015-07-28  1:32   ` Andy Lutomirski
2015-07-29  1:18     ` Hall, Christopher S
2015-07-29  1:47       ` Andy Lutomirski
2015-07-28  4:11   ` John Stultz
2015-07-29  2:05     ` Hall, Christopher S
2015-07-29  8:25   ` Paul Bolle
2015-07-28  0:46 ` [PATCH 4/5] Add support for driver cross-timestamp to PTP_SYS_OFFSET ioctl Christopher Hall
2015-07-28  0:46 ` [PATCH 5/5] Enables cross timestamping in the e1000e driver Christopher Hall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.11.1507291603220.3825@nanos \
    --to=tglx@linutronix.de \
    --cc=christopher.s.hall@intel.com \
    --cc=hpa@zytor.com \
    --cc=jeffrey.t.kirsher@intel.com \
    --cc=john.ronciak@intel.com \
    --cc=john.stultz@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=richardcochran@gmail.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).