linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
To: Richard Cochran <richardcochran-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	LKML <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	John Stultz <johnstul-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>,
	Peter Zijlstra <peterz-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
Subject: Re: [PATCH 1/2] posix clocks: introduce a syscall for clock tuning.
Date: Thu, 9 Sep 2010 22:10:01 +0200 (CEST)	[thread overview]
Message-ID: <alpine.LFD.2.00.1009092102150.2477@localhost6.localdomain6> (raw)
In-Reply-To: <20100909133449.GB2823-7KxsofuKt4IfAd9E5cN8NEzG7cXyKsk/@public.gmane.org>

Richard,

On Thu, 9 Sep 2010, Richard Cochran wrote:

> On Thu, Sep 09, 2010 at 12:49:27PM +0200, Thomas Gleixner wrote:
> > On Fri, 3 Sep 2010, Richard Cochran wrote:
> > > In addition, the POSIX clock code has been augmented to offer a
> > > dynamic clock creation method. Instead of registering a hard
> > > coded clock ID, modules may call create_posix_clock(), which
> > > returns a new clock ID.
> > 
> > This has been discussed for years and I still fail to see the
> > requirement for this. The only result is that it allows folks to
> > create their special purpose clock stuff and keep it out of tree
> > instead of fixing the problems they have with the existing clock
> > infrastructure in the kernel.
> 
> Do you have any pointers to this discussion?

Not out of the box. Need to ask the oracle of google [ I wonder if
this expression is politically correct today :) ]

My personal stance on this is clear: Assign fixed ID.

The point is, that if we provide something like CLOCK_PTP, then we can
abstract the real hardware drivers behind this clock id and we get a
consistent feature set for these drivers and a consistent behaviour on
the user space interface. There still might be a hardware driver which
cannot provide a specific feature, but there is nothing wrong to
return -ENOSYS in such a case.

> There isn't really anything wrong with the existing clock
> infrastructure, in my view. I think the stumbling block is the idea
> that there can be more than one clock in a computer system, and that
> user space needs access to more than just one of them.
> 
> It is a fact that PTP hardware clocks are separate from the system
> clock, and this situation will presist for some time, if not
> indefinitely. It is ironic that the very best PTP clocks, the PHY
> clocks, are the farthest away from the system clock.

In terms of hardware, yes.
 
> Using PTP (or any disributed time protocol, eg NTP) involves a number
> of options and choices. This complexity belongs in user space. The
> kernel should simply offer a way to access the hardware clocks
> (mechanism, not policy). For NTP, the kernel has to have a special

I completely agree with that.

> role running the clock servo, but this is an exception.
> 
> Of course, the kernel wants to present a consistent system time to
> user space, hiding the ugly clock details. However, when it comes to
> PTP hardware clocks, the kernel needs a little help.  Only one
> program, lets call it the ptpd, needs to know about the PTP
> clock. What this program does depends on the operational mode and on
> the user's preferences.

No objections
 
> What follows uses the posix clock api idea just to illustrate. You
> could just as well use chardev ioctls. I am not arguing about the
> API. Rather I am trying to explain why the kernel must expose multiple
> clocks to user space.
> 
> 1. Master with external time source (like GPS)
> 2. Master with PTP clock as time source
> 3. Master with kernel as time source
> 4. Slave with PPS hook

Ok, that makes a lot of sense now. Thanks for taking the time and
shedding some light on me!

So you want to utilize the posix-timer infrastructure to make all this
happen. This new clock basically needs clock_[get|set]time plus the
new clock_adjust syscall, nothing more. The normal application stuff
will still use what's already there, right ?

If that's the case, then I'm not going to stand in the way, except for
some implementation details like the new syscall clock_adjust: 

Please make this thing new from ground up and not just a modified copy
of sys_adjtimex.

 1) This avoids the compat syscall crap

 2) It allows you to add the extra control stuff for your PTP magic
     (PPS, whatever) which you would need to expose by some other
     means otherwise.

Thanks,

	tglx

  parent reply	other threads:[~2010-09-09 20:10 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-03  9:27 [PATCH 0/2] [RFC] posix clock tuning Richard Cochran
2010-09-03  9:29 ` [PATCH 1/2] posix clocks: introduce a syscall for " Richard Cochran
     [not found]   ` <7f4815cdfcf5bc49df4bdd09d59a4f56ca2598f5.1283504065.git.richard.cochran-3mrvs1K0uXizZXS1Dc/lvw@public.gmane.org>
2010-09-03  9:58     ` Richard Cochran
2010-09-04 14:06     ` Richard Cochran
2010-09-09 10:49     ` Thomas Gleixner
     [not found]       ` <alpine.LFD.2.00.1009091159260.2477-bi+AKbBUZKagILUCTcTcHdKyNwTtLsGr@public.gmane.org>
2010-09-09 13:34         ` Richard Cochran
     [not found]           ` <20100909133449.GB2823-7KxsofuKt4IfAd9E5cN8NEzG7cXyKsk/@public.gmane.org>
2010-09-09 20:10             ` Thomas Gleixner [this message]
     [not found]               ` <alpine.LFD.2.00.1009092102150.2477-bi+AKbBUZKagILUCTcTcHdKyNwTtLsGr@public.gmane.org>
2010-09-09 21:16                 ` Thomas Gleixner
2010-09-09 22:53                   ` john stultz
     [not found]                     ` <1284072793.2762.259.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2010-09-10  9:23                       ` Richard Cochran
2010-09-09 21:01       ` john stultz
     [not found]         ` <1284066084.2762.172.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2010-09-09 21:31           ` Thomas Gleixner
     [not found] ` <cover.1283504065.git.richard.cochran-3mrvs1K0uXizZXS1Dc/lvw@public.gmane.org>
2010-09-03  9:30   ` [PATCH 2/2] posix clocks: introduce a sysfs presence Richard Cochran
     [not found]     ` <84124d2479b8967cac2b35f852fc0fcae6ad9444.1283504065.git.richard.cochran-3mrvs1K0uXizZXS1Dc/lvw@public.gmane.org>
2010-09-09 22:19       ` john stultz
2010-09-09 23:00       ` Alan Cox
     [not found]         ` <20100910000008.1483fdd7-qBU/x9rampVanCEyBjwyrvXRex20P6io@public.gmane.org>
2010-09-10  9:31           ` Richard Cochran
     [not found]             ` <20100910093135.GB10179-7KxsofuKt4IfAd9E5cN8NEzG7cXyKsk/@public.gmane.org>
2010-09-11  0:20               ` Greg KH
2010-09-09  9:58   ` [PATCH 0/2] [RFC] posix clock tuning Thomas Gleixner
     [not found]     ` <alpine.LFD.2.00.1009091152300.2477-bi+AKbBUZKagILUCTcTcHdKyNwTtLsGr@public.gmane.org>
2010-09-09 12:21       ` Richard Cochran
     [not found]         ` <20100909122156.GA2823-7KxsofuKt4IfAd9E5cN8NEzG7cXyKsk/@public.gmane.org>
2010-09-09 12:50           ` Thomas Gleixner
     [not found]             ` <alpine.LFD.2.00.1009091443250.2477-bi+AKbBUZKagILUCTcTcHdKyNwTtLsGr@public.gmane.org>
2010-09-09 15:02               ` Alan Cox
2010-09-04 17:23 ` Christoph Lameter
     [not found]   ` <alpine.DEB.2.00.1009041221240.888-sBS69tsa9Uj/9pzu0YdTqQ@public.gmane.org>
2010-09-04 17:48     ` Christian Riesch
     [not found]       ` <4C828652.4060804-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2010-09-05  1:37         ` Christoph Lameter
     [not found]           ` <alpine.DEB.2.00.1009042036540.9425-sBS69tsa9Uj/9pzu0YdTqQ@public.gmane.org>
2010-09-05  5:56             ` Richard Cochran
2010-09-05  1:47         ` Christoph Lameter
     [not found]           ` <alpine.DEB.2.00.1009042042130.9425-sBS69tsa9Uj/9pzu0YdTqQ@public.gmane.org>
2010-09-05  6:22             ` Richard Cochran
2010-09-05  7:20               ` Richard Cochran
2010-09-05 23:13                 ` Christoph Lameter
     [not found]                   ` <alpine.DEB.2.00.1009051759100.3480-sBS69tsa9Uj/9pzu0YdTqQ@public.gmane.org>
2010-09-06  7:09                     ` Richard Cochran

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.LFD.2.00.1009092102150.2477@localhost6.localdomain6 \
    --to=tglx-hfztesqfncyowbw4kg4ksq@public.gmane.org \
    --cc=johnstul-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org \
    --cc=linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=peterz-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
    --cc=richardcochran-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.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).