[chrony-dev] [RFC PATCH v1 00/17] RFC: Patch enabling support for Linux auxiliary clocks

[ Thread Index | Date Index | More chrony.tuxfamily.org/chrony-dev Archives ]


AUXILIARY CLOCK INTRODUCTION

Support for auxiliary clocks was added to the Linux kernel starting
with version 6.17 (first commit
22c62b9a84b8f16ca0277e133a0cd62a259fee7c). Auxiliary clocks are
independent from, but behave similarly to, CLOCK_REALTIME. When
enabled auxiliary clocks can be used for to represent any alternative
timebase. There is no expectation that auxiliary clocks are traceable
in any way to TAI/UTC.

Auxiliary clocks can be used in any application, but the current usage
is for industrial automation applications. Factory work cells have up
to two sources of time one that is traceable to UTC/TAI and used for
logging/debug and one that is not necessarily traceable used only
within the work cell to provide network QOS and coordinate realtime
compute over multiple network connected devices. These are referred to
as global time and the working clock. Auxiliary clocks can be used to
represent either or both of these time-bases, but the working clock
with its arbitrary epoch is the principal use of auxiliary clocks.

The relevant standard is IEEE 60802 which among other things, defines
a profile of TSN used for industrial automation. The PTP protocol is
primarily used to distribute time over the network. The NTP protocol
will be used in some cases for a secondary time source. There are some
links in "References" that explain 60802 and TSN at a high level.

AUXILIARY CLOCK PATCHSET OVERVIEW

This patchset enables use of auxiliary clocks with Chrony. Support for
auxiliary clocks is enabled at compile time using the
'enable-auxclock' flag. The added 'auxclockid' directive takes two
options: 'set' and 'alloc'. Set takes one argument which is the clock
ID of a preconfigured clock. The alloc option takes no arguments and
dynamically allocates a clock at runtime and frees that clock on
exit. The clock ID of the dynamically allocated clock can be found
either in the file chrony.clkid or by querying the 'auxclockid' with
chronyc. The patchset also adds a 'nooffsetsanitycheck' directive,
taking no options, that disables offset sanity checking because there
is no expectation that a local auxiliary clock is related to UTC/TAI.

AUXILIARY CLOCK USAGE WITH CHRONY AND PTP

60802 principally uses the PTP protocol for time synchronization. The
proposed use of Chrony in 60802 applications is transferring time from
the Linux PHC to either the system clock or one or more auxiliary
clocks essentially replacing PHC2SYS. Chrony is preferred for this
because it supports multiple reference clocks and telemetry through
chronyc and its API. The expected platform configuration is a single
network card with a single PHC/timestamp clock which will receive both
global time and the working clock using multiple PTP domains. Linux
uses vclocks to represent multiple PTP time-bases using a single
timestamp clock. Global time and the working clock will be assigned to
its own vclock that is disciplined by PTP. Two instances of PTP4L
discipline their respective vclocks and two instances of Chrony
transfer time from the vclock to CLOCK_REALTIME or an auxiliary clock
using the vclock PHC API. The application will be able to read time in
the usual way with the clock_gettime() interface where global time
and the working clock will have unique clock IDs.

References:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/kernel/time/timekeeping.c?h=v6.18&id=22c62b9a84b8f16ca0277e133a0cd62a259fee7c

https://www.ieee802.org/1/files/public/docs2018/60802-industrial-use-cases-0918-v13.pdf

https://www.ieee802.org/1/files/public/docs2018/60802-Steindl-Synchronization-0718-v02.pdf

https://en.wikipedia.org/wiki/Time-Sensitive_Networking

Christopher S M Hall (17):
  sys_linux, sys_timex: Zero out the timex structure before use
  sysincl: Saneify libc and linux kernel headers
  local: Enable use of alternative clock ID for clock_gettime()
  configure: Add configuration parameters for auxiliary clock support on
    Linux
  conf: Add configuration options enabling use of pre-configured
    auxiliary clocks
  local: Use auxiliary clock in local.c
  socket: Ignore the kernel system timestamp read from the socket
  sys_timex: Add interface enabling platform initialization code to set
    an alternative clock ID
  conf, util: Disable offset sanity check
  sys_linux, conf: Linux specific implementation of auxiliary clocks
  sys_linux, configure: Add compile time check for updated
    ptp_sys_offset_extended struct
  doc/chrony.conf: Update chrony.conf manpage adding 'auxclockid' and
    'nooffsetsanitycheck' directives
  conf, sys_linux: Add dynamic auxiliary clock implementation
  doc/chrony.conf: Add dynamic clock allocation option to the auxclockid
    directive
  util, main, logging: Add cleanup code for dynamically allocated
    auxiliary clocks
  configure, conf, main, doc/chrony.conf: Add configuration directive
    for 'auxclockidfile'
  client, cmdmon, doc/chrony.conf, doc/chronyc: Add chronyc command to
    query allocated clock ID

 candm.h              |  12 ++-
 client.c             |  33 +++++++
 cmdmon.c             |  20 +++++
 conf.c               | 201 +++++++++++++++++++++++++++++++++++++++++++
 conf.h               |   7 ++
 configure            |  67 +++++++++++++--
 doc/chrony.conf.adoc |  42 +++++++++
 doc/chronyc.adoc     |  13 +++
 leapdb.c             |   4 +
 local.c              |  25 +++++-
 logging.c            |   5 ++
 main.c               |  56 ++++++++++++
 main.h               |   3 +
 pktlength.c          |   2 +
 privops.c            |   4 +
 refclock_sock.c      |   4 +
 reference.c          |   4 +
 rtc_linux.c          |   1 +
 sched.c              |   4 +
 socket.c             |  24 +++++-
 sys_generic.c        |   4 +
 sys_linux.c          | 129 +++++++++++++++++++++++++--
 sys_linux.h          |  10 +++
 sys_timex.c          |  33 ++++++-
 sys_timex.h          |   8 ++
 sysincl.h            |  21 ++++-
 util.c               |  36 ++++++++
 util.h               |   8 ++
 28 files changed, 760 insertions(+), 20 deletions(-)

-- 
2.34.1


-- 
To unsubscribe email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "unsubscribe" in the subject.
For help email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "help" in the subject.
Trouble?  Email listmaster@xxxxxxxxxxxxxxxxxxxx.


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/