From: john stultz <johnstul@us.ibm.com>
To: Richard Cochran <richardcochran@gmail.com>
Cc: Rodolfo Giometti <giometti@linux.it>,
Arnd Bergmann <arnd@arndb.de>,
netdev@vger.kernel.org, devicetree-discuss@lists.ozlabs.org,
linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
linux-arm-kernel@lists.infradead.org,
Krzysztof Halasa <khc@pm.waw.pl>
Subject: Re: [PATCH 1/5] ptp: Added a brand new class driver for ptp clocks.
Date: Mon, 23 Aug 2010 13:21:39 -0700 [thread overview]
Message-ID: <1282594899.3111.358.camel@localhost.localdomain> (raw)
In-Reply-To: <20100819153847.GA10695@riccoc20.at.omicron.at>
On Thu, 2010-08-19 at 17:38 +0200, Richard Cochran wrote:
> On Thu, Aug 19, 2010 at 02:28:04PM +0200, Arnd Bergmann wrote:
> > My point was that a syscall is better than an ioctl based interface here,
> > which I definitely still think. Given that John knows much more about
> > clocks than I do, we still need to get agreement on the question that
> > he raised, which is whether we actually need to expose this clock to the
> > user or not.
> >
> > If we can find a way to sync system time accurate enough with PTP and
> > PPS, user applications may not need to see two separate clocks at all.
>
> At the very least, one user application (the PTPd) needs to see the
> PTP clock.
>
> > > SYSCALL_DEFINE3(clock_adjtime, const clockid_t, clkid,
> > > int, ppb, struct timespec __user *, ts)
> > >
> > > ppb - desired frequency adjustment in parts per billion
> > > ts - desired time step (or jump) in <sec,nsec> to correct
> > > a measured offset
> > >
> > > Arguably, this syscall might be useful for other clocks, too.
> >
> > This is a mix of adjtime and adjtimex with the addition of
> > the clkid parameter, right?
>
> Sort of, but not really. ADJTIME(3) takes an offset and slowly
> corrects the clock using a servo in the kernel, over hours.
>
> For this function, the offset passed in the 'ts' parameter will be
> immediately corrected, by jumping to the new time. This reflects the
> way that PTP works. After the first few samples, the PTPd has an
> estimate of the offset to the master and the rate difference. The PTPd
> can proceed in one of two ways.
>
> 1. If resetting the clock is not desired, then the clock is set to the
> maximum adjustment (in the right direction) until the clock time is
> close to the master's time.
>
> 2. The estimated offset is added to the current time, resulting in a
> jump in time.
>
> We need clock_adjtime(id, 0, ts) for the second case.
>
> > Have you considered passing a struct timex instead of ppb and ts?
>
> Yes, but the timex is not suitable, IMHO.
Could you expand on this?
Could we not add a adjustment mode ADJ_SETOFFSET or something that would
provide the instantaneous offset correction?
> > Is using ppb instead of the timex ppm required to get the accuracy
> > you want?
>
> That is one very good reason.
>
> Another is this: can you explain what the 20+ fields mean?
>
> Consider the field, freq. The comment says "frequency offset (scaled
> ppm)." To what is it scaled? The only way I know of to find out is to
> read the NTP code (which is fairly complex) and see what the unit
> really is meant to be. Ditto for the other fields.
>
> The timex structure reveals, AFAICT, the inner workings of the kernel
> clock servo. For PTP, we don't need or want the kernel servo. The PTPd
> has its own clock servo in user space.
You're right that the timex is a little crufty. But its legacy that we
will support indefinitely. So following the established interface helps
maintainability.
So if the clock_adjtime interface is needed, it would seem best for it
to be generic enough to support not only PTP, but also the NTP kernel
PLL.
In effect, this would make clock_adjtime(or clock_adjtimex) identical to
adjtimex, but only applicable to different CLOCK_ids. Additionally, it
would simplify the code for the CLOCK_REALTIME case as you could just
call directly into do_adjtimex().
Of course, extending adjtimex for ADJ_SETOFFSET would be needed first,
but that seems like a reasonable expansion of the interface that could
be used by more then just PTP.
thanks
-john
next prev parent reply other threads:[~2010-08-23 20:21 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-16 11:17 [PATCH v5 0/5] ptp: IEEE 1588 clock support Richard Cochran
2010-08-16 11:17 ` [PATCH 1/5] ptp: Added a brand new class driver for ptp clocks Richard Cochran
2010-08-16 14:26 ` Arnd Bergmann
2010-08-16 19:00 ` Richard Cochran
2010-08-16 19:59 ` Arnd Bergmann
2010-08-17 8:32 ` Richard Cochran
2010-08-17 9:25 ` Arnd Bergmann
2010-08-17 10:52 ` Richard Cochran
2010-08-17 11:36 ` Arnd Bergmann
2010-08-18 0:40 ` john stultz
2010-08-18 14:04 ` Richard Cochran
2010-08-18 15:02 ` Arnd Bergmann
2010-08-19 9:22 ` Richard Cochran
2010-08-19 12:29 ` Arnd Bergmann
2010-08-19 15:23 ` Ira W. Snyder
2010-08-19 15:48 ` Arnd Bergmann
2010-08-16 19:24 ` john stultz
2010-08-16 19:38 ` john stultz
2010-08-17 8:53 ` Richard Cochran
2010-08-18 0:22 ` john stultz
2010-08-18 7:19 ` Richard Cochran
2010-08-19 0:12 ` john stultz
2010-08-19 5:55 ` Richard Cochran
2010-08-19 12:28 ` Arnd Bergmann
2010-08-19 15:38 ` Richard Cochran
2010-08-23 20:21 ` john stultz [this message]
2010-08-27 11:08 ` Richard Cochran
2010-08-27 12:03 ` Arnd Bergmann
2010-08-27 20:56 ` John Stultz
2010-08-27 12:45 ` Alan Cox
2010-08-27 20:14 ` John Stultz
2010-08-23 20:08 ` john stultz
2010-08-24 18:30 ` Stephan Gatzka
2010-08-25 9:40 ` Christian Riesch
2010-08-27 1:57 ` john stultz
2010-08-27 7:57 ` Richard Cochran
2010-08-27 12:41 ` Alan Cox
2010-08-27 14:02 ` Richard Cochran
2010-08-27 14:50 ` Alan Cox
2010-08-27 15:35 ` M. Warner Losh
2010-08-29 13:32 ` Christian Riesch
2010-08-27 12:38 ` Richard Cochran
2010-08-27 13:38 ` Alan Cox
2010-08-27 14:34 ` Richard Cochran
2010-08-27 15:06 ` Alan Cox
2010-08-27 15:21 ` Patrick Loschmidt
2010-08-27 16:17 ` Jacob Keller
2010-08-27 22:30 ` John Stultz
2010-09-06 6:33 ` Richard Cochran
2010-09-21 16:54 ` Stephan Gatzka
2010-09-21 20:47 ` Kyle Moffett
2010-09-22 10:14 ` Richard Cochran
2010-08-16 11:18 ` [PATCH 2/5] ptp: Added a clock that uses the Linux system time Richard Cochran
2010-08-16 11:18 ` [PATCH 3/5] ptp: Added a clock that uses the eTSEC found on the MPC85xx Richard Cochran
2010-08-16 11:18 ` [PATCH 4/5] ptp: Added a clock driver for the IXP46x Richard Cochran
2010-08-16 11:19 ` [PATCH 5/5] ptp: Added a clock driver for the National Semiconductor PHYTER 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=1282594899.3111.358.camel@localhost.localdomain \
--to=johnstul@us.ibm.com \
--cc=arnd@arndb.de \
--cc=devicetree-discuss@lists.ozlabs.org \
--cc=giometti@linux.it \
--cc=khc@pm.waw.pl \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=netdev@vger.kernel.org \
--cc=richardcochran@gmail.com \
/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).