netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/21] ntp: Rework to prepare support of indenpendent PTP clocks
@ 2024-09-11 13:17 Anna-Maria Behnsen
  2024-09-11 13:17 ` [PATCH 01/21] ntp: Remove unused tick_nsec Anna-Maria Behnsen
                   ` (21 more replies)
  0 siblings, 22 replies; 37+ messages in thread
From: Anna-Maria Behnsen @ 2024-09-11 13:17 UTC (permalink / raw)
  To: John Stultz, Frederic Weisbecker, Thomas Gleixner
  Cc: linux-kernel, netdev, Miroslav Lichvar, Richard Cochran,
	Christopher S Hall, Anna-Maria Behnsen

The generic clock and timekeeping infrastructure supports only the already
defined clocks and as they are not independent there is no need of
generalization of data structures. But PTP clocks can be independent from
CLOCK_TAI.

PTP clocks already have clock_gettime() support via the file descriptor
based posix clocks. These interfaces access the PTP hardware and are
therefore slow and cannot be used from within the kernel, e.g. TSN
networking.

This problem can be solved by emulating clock_gettime() via the system
clock source e.g. TSC on x86. Such emulation requires:

1. timekeeping mechanism similar to the existing system timekeeping
2. clock steering equivalent to NTP/adjtimex()

In the already existing system timekeeping implementation the lock and
shadow timekeeper are separate from the timekeeper and sequence
counter. Move this information into a new struct type "tk_data" to be able
to recycle it for the above explained approach.

NTP/adjtimex() related information is all stored in static variables. Move
all of them into the new struct type ntp_data to make it reusable.

Even without the furture support for independent PTP clocks, the
generalization of timekeeping and NTP/adjtimex() improves the structure and
readability of the already existing code.

Once this is implemented clock_gettime() support for these clocks via vdso
can be implement as well but this is an orthogonal task.

This queue covers only the generalization of ntp:

- Patch 1-6:  Basic cleanups
- Patch 7-21: Introduction of struct ntp_data and move all static variables
	      to the struct

The queue is available here:

  git://git.kernel.org/pub/scm/linux/kernel/git/anna-maria/linux-devel.git timers/ptp/ntp

Cc: linux-kernel@vger.kernel.org
Cc: netdev@vger.kernel.org
Cc: Miroslav Lichvar <mlichvar@redhat.com>
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: Christopher S Hall <christopher.s.hall@intel.com>
To: John Stultz <jstultz@google.com>
To: Frederic Weisbecker <frederic@kernel.org>
To: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Anna-Maria Behnsen <anna-maria@linutronix.de>

Thanks,

Anna-Maria

---
Anna-Maria Behnsen (1):
      ntp: Cleanup formatting of code

Thomas Gleixner (20):
      ntp: Remove unused tick_nsec
      ntp: Make tick_usec static
      ntp: Clean up comments
      ntp: Convert functions with only two states to bool
      ntp: Read reference time only once
      ntp: Introduce struct ntp_data
      ntp: Move tick_length* into ntp_data
      ntp: Move tick_stat* into ntp_data
      ntp: Move time_offset/constant into ntp_data
      ntp: Move time_max/esterror into ntp_data
      ntp: Move time_freq/reftime into ntp_data
      ntp: Move time_adj/ntp_tick_adj into ntp_data
      ntp: Move ntp_next_leap_sec into ntp_data
      ntp: Move pps_valid into ntp_data
      ntp: Move pps_ft into ntp_data
      ntp: Move pps_jitter into ntp_data
      ntp: Move pps_fbase into ntp_data
      ntp: Move pps_shift/intcnt into ntp_data
      ntp: Move pps_freq/stabil into ntp_data
      ntp: Move pps monitors into ntp_data

 arch/x86/include/asm/timer.h |   2 -
 include/linux/timex.h        |   8 -
 kernel/time/ntp.c            | 840 +++++++++++++++++++++----------------------
 3 files changed, 419 insertions(+), 431 deletions(-)


^ permalink raw reply	[flat|nested] 37+ messages in thread

end of thread, other threads:[~2024-09-13 10:28 UTC | newest]

Thread overview: 37+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-11 13:17 [PATCH 00/21] ntp: Rework to prepare support of indenpendent PTP clocks Anna-Maria Behnsen
2024-09-11 13:17 ` [PATCH 01/21] ntp: Remove unused tick_nsec Anna-Maria Behnsen
2024-09-11 20:06   ` John Stultz
2024-09-11 13:17 ` [PATCH 02/21] ntp: Make tick_usec static Anna-Maria Behnsen
2024-09-11 20:28   ` John Stultz
2024-09-11 13:17 ` [PATCH 03/21] ntp: Clean up comments Anna-Maria Behnsen
2024-09-11 20:08   ` John Stultz
2024-09-11 13:17 ` [PATCH 04/21] ntp: Cleanup formatting of code Anna-Maria Behnsen
2024-09-11 20:11   ` John Stultz
2024-09-11 13:17 ` [PATCH 05/21] ntp: Convert functions with only two states to bool Anna-Maria Behnsen
2024-09-11 20:12   ` John Stultz
2024-09-11 13:17 ` [PATCH 06/21] ntp: Read reference time only once Anna-Maria Behnsen
2024-09-11 20:00   ` John Stultz
2024-09-11 13:17 ` [PATCH 07/21] ntp: Introduce struct ntp_data Anna-Maria Behnsen
2024-09-11 20:20   ` John Stultz
2024-09-11 13:17 ` [PATCH 08/21] ntp: Move tick_length* into ntp_data Anna-Maria Behnsen
2024-09-11 20:23   ` John Stultz
2024-09-11 13:17 ` [PATCH 09/21] ntp: Move tick_stat* " Anna-Maria Behnsen
2024-09-11 20:25   ` John Stultz
2024-09-11 13:17 ` [PATCH 10/21] ntp: Move time_offset/constant " Anna-Maria Behnsen
2024-09-11 20:27   ` John Stultz
2024-09-11 13:17 ` [PATCH 11/21] ntp: Move time_max/esterror " Anna-Maria Behnsen
2024-09-11 13:17 ` [PATCH 12/21] ntp: Move time_freq/reftime " Anna-Maria Behnsen
2024-09-11 20:30   ` John Stultz
2024-09-11 13:17 ` [PATCH 13/21] ntp: Move time_adj/ntp_tick_adj " Anna-Maria Behnsen
2024-09-11 20:36   ` John Stultz
2024-09-11 13:17 ` [PATCH 14/21] ntp: Move ntp_next_leap_sec " Anna-Maria Behnsen
2024-09-11 13:17 ` [PATCH 15/21] ntp: Move pps_valid " Anna-Maria Behnsen
2024-09-11 13:17 ` [PATCH 16/21] ntp: Move pps_ft " Anna-Maria Behnsen
2024-09-11 13:17 ` [PATCH 17/21] ntp: Move pps_jitter " Anna-Maria Behnsen
2024-09-11 13:17 ` [PATCH 18/21] ntp: Move pps_fbase " Anna-Maria Behnsen
2024-09-11 13:17 ` [PATCH 19/21] ntp: Move pps_shift/intcnt " Anna-Maria Behnsen
2024-09-11 13:17 ` [PATCH 20/21] ntp: Move pps_freq/stabil " Anna-Maria Behnsen
2024-09-11 13:17 ` [PATCH 21/21] ntp: Move pps monitors " Anna-Maria Behnsen
2024-09-12  8:12 ` [PATCH 00/21] ntp: Rework to prepare support of indenpendent PTP clocks Miroslav Lichvar
2024-09-13  3:59   ` Richard Cochran
2024-09-13 10:28   ` Anna-Maria Behnsen

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).