public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: john stultz <johnstul@us.ibm.com>
To: Andy Lutomirski <luto@amacapital.net>
Cc: Richard Cochran <richardcochran@gmail.com>,
	linux-kernel@vger.kernel.org, Kumar Sundararajan <kumar@fb.com>,
	Arun Sharma <asharma@fb.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [RFC 0/2] ABI for clock_gettime_ns
Date: Wed, 14 Dec 2011 09:31:55 -0800	[thread overview]
Message-ID: <1323883915.6805.50.camel@work-vm> (raw)
In-Reply-To: <CALCETrW+g6_VSUJJz4NSVwjKhMo+U_3uQDe9W6uEXdjTuaXVhA@mail.gmail.com>

On Wed, 2011-12-14 at 09:15 -0800, Andy Lutomirski wrote:
> On Wed, Dec 14, 2011 at 8:48 AM, john stultz <johnstul@us.ibm.com> wrote:
> > On Wed, 2011-12-14 at 08:46 +0100, Richard Cochran wrote:
> >>
> >> What about this sort of time value?
> >>
> >> struct sys_timeval {
> >>       __s64 nanoseconds;
> >>       __u32 fractional_ns;
> >> };
> >>
> >> The second field can just be zero, for now.
> >
> > I'm mixed on this.
> >
> > We could do this, as the kernel keeps track of sub-ns granularity.
> > However, its not stored in a decimal format. So I worry the extra math
> > needed to convert it to something usable might add extra overhead,
> > removing the gain of the proposed clock_gettime_ns() interface.
> >
> 
> I would actually prefer units of 2^-32 ns over .  I have no attachment
> to SI picoseconds so long as the units are constant.

2^-32ns would be much easier to do.


> Windows sidesteps this issue by returning arbitrary units and telling
> the user what those units are.  This adds a lot of unpleasantness (try
> relating the timestamps to actual wall time) and we need to rescale
> the time anyway for NTP.
> 
> What about:
> 
> struct sys_timeval {
>     u64 nanoseconds;  /* unsigned.  the current time will always be
> after 1970, and those extra 290 years might be nice. */

I'd suspect we will still need this to be signed if it goes to userland.
In-kernel u64 for nanoseconds is fine because it doesn't have to deal
with anything that far in the past. But for userland we probably should
use s64. 

>     u64 padding;  /* for later.  currently always zero. */
> 
> That way, once there's both an implementation and a use case, we can
> implement it.  In the mean time, the overhead is probably immeasurably
> low -- it's a single assignment.

This sounds good to me. 

Kumar, Arun, I know we've strayed a bit from your original patch, but
any objections here?

thanks
-john





  reply	other threads:[~2011-12-14 17:33 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-13  1:26 [RFC 0/2] ABI for clock_gettime_ns Andy Lutomirski
2011-12-13  1:26 ` [RFC 1/2] Add clock_gettime_ns syscall Andy Lutomirski
2011-12-13  3:32   ` Richard Cochran
2011-12-13  1:26 ` [RFC 2/2] x86-64: Add __vdso_clock_gettime_ns vsyscall Andy Lutomirski
2011-12-13  3:24 ` [RFC 0/2] ABI for clock_gettime_ns Richard Cochran
2011-12-13  3:43   ` john stultz
2011-12-13  7:09     ` Andy Lutomirski
2011-12-14  7:46       ` Richard Cochran
2011-12-14 16:48         ` john stultz
2011-12-14 17:15           ` Andy Lutomirski
2011-12-14 17:31             ` john stultz [this message]
2011-12-14 18:37             ` Richard Cochran
2011-12-14 18:30           ` Richard Cochran
2011-12-14 19:07             ` john stultz
2011-12-14 19:20               ` Andy Lutomirski
2011-12-14 21:34                 ` john stultz
2011-12-15 11:35                   ` Richard Cochran
2011-12-22 12:03               ` Richard Cochran
2011-12-24  5:59                 ` Andy Lutomirski
2011-12-24  6:50                   ` Richard Cochran
2011-12-25  4:06                     ` Andy Lutomirski
2011-12-14  7:20     ` Richard Cochran
2011-12-14 16:23       ` john stultz
2011-12-14 18:21         ` Richard Cochran
2011-12-14 18:57           ` john stultz
2012-01-07 19:51             ` Richard Cochran
2011-12-21  0:50 ` Arun Sharma
2011-12-21  1:07   ` Andy Lutomirski

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=1323883915.6805.50.camel@work-vm \
    --to=johnstul@us.ibm.com \
    --cc=asharma@fb.com \
    --cc=kumar@fb.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=richardcochran@gmail.com \
    --cc=tglx@linutronix.de \
    /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