netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/24] timekeeping: Rework to prepare support of indenpendent PTP clocks
@ 2024-09-11 13:29 Anna-Maria Behnsen
  2024-09-11 13:29 ` [PATCH 01/24] timekeeping: Read NTP tick length only once Anna-Maria Behnsen
                   ` (23 more replies)
  0 siblings, 24 replies; 27+ messages in thread
From: Anna-Maria Behnsen @ 2024-09-11 13:29 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. (See
https://lore.kernel.org/r/20240911-devel-anna-maria-b4-timers-ptp-ntp-v1-0-2d52f4e13476@linutronix.de)

Even without the future 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 timekeeping:

- Patch 1-5:   Basic cleanups
- Patch 6-10:  Generalization of tk_data
- Patch 11-24: Use always shadow timekeeper for updates

The queue is available here:

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

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 (16):
      timekeeping: Avoid duplicate leap state update
      timekeeping: Move timekeeper_lock into tk_core
      timekeeping: Define a struct type for tk_core to make it reusable
      timekeeping: Add struct tk_data as argument to timekeeping_update()
      timekeeping: Split out timekeeper update of timekeeping_advanced()
      timekeeping: Introduce combined timekeeping action flag
      timekeeping: Rework do_settimeofday64() to use shadow_timekeeper
      timekeeping: Rework timekeeping_inject_offset() to use shadow_timekeeper
      timekeeping: Rework change_clocksource() to use shadow_timekeeper
      timekeeping: Rework timekeeping_init() to use shadow_timekeeper
      timekeeping: Rework timekeeping_inject_sleeptime64() to use shadow_timekeeper
      timekeeping: Rework timekeeping_resume() to use shadow_timekeeper
      timekeeping: Rework timekeeping_suspend() to use shadow_timekeeper
      timekeeping: Rework do_adjtimex() to use shadow_timekeeper
      timekeeping: Remove TK_MIRROR timekeeping_update() action
      timekeeping: Merge timekeeping_update_staged() and timekeeping_update()

Thomas Gleixner (8):
      timekeeping: Read NTP tick length only once
      timekeeping: Don't stop time readers across hard_pps() update
      timekeeping: Abort clocksource change in case of failure
      timekeeping: Simplify code in timekeeping_advance()
      timekeeping: Reorder struct timekeeper
      timekeeping: Move shadow_timekeeper into tk_core
      timekeeping: Encapsulate locking/unlocking of timekeeper_lock
      timekeeping: Provide timekeeping_restore_shadow()

 include/linux/timekeeper_internal.h | 102 ++++++----
 kernel/time/timekeeping.c           | 369 +++++++++++++++++-------------------
 kernel/time/timekeeping_internal.h  |   3 +-
 kernel/time/vsyscall.c              |   5 +-
 4 files changed, 238 insertions(+), 241 deletions(-)


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

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

Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-11 13:29 [PATCH 00/24] timekeeping: Rework to prepare support of indenpendent PTP clocks Anna-Maria Behnsen
2024-09-11 13:29 ` [PATCH 01/24] timekeeping: Read NTP tick length only once Anna-Maria Behnsen
2024-09-11 13:29 ` [PATCH 02/24] timekeeping: Don't stop time readers across hard_pps() update Anna-Maria Behnsen
2024-09-11 13:29 ` [PATCH 03/24] timekeeping: Avoid duplicate leap state update Anna-Maria Behnsen
2024-09-11 13:29 ` [PATCH 04/24] timekeeping: Abort clocksource change in case of failure Anna-Maria Behnsen
2024-09-11 13:29 ` [PATCH 05/24] timekeeping: Simplify code in timekeeping_advance() Anna-Maria Behnsen
2024-09-11 13:29 ` [PATCH 06/24] timekeeping: Reorder struct timekeeper Anna-Maria Behnsen
2024-09-11 13:29 ` [PATCH 07/24] timekeeping: Move shadow_timekeeper into tk_core Anna-Maria Behnsen
2024-09-11 13:29 ` [PATCH 08/24] timekeeping: Encapsulate locking/unlocking of timekeeper_lock Anna-Maria Behnsen
2024-09-11 13:29 ` [PATCH 09/24] timekeeping: Move timekeeper_lock into tk_core Anna-Maria Behnsen
2024-09-11 13:29 ` [PATCH 10/24] timekeeping: Define a struct type for tk_core to make it reusable Anna-Maria Behnsen
2024-09-12  7:38   ` Simon Horman
2024-09-13  9:16     ` Anna-Maria Behnsen
2024-09-11 13:29 ` [PATCH 11/24] timekeeping: Add struct tk_data as argument to timekeeping_update() Anna-Maria Behnsen
2024-09-11 13:29 ` [PATCH 12/24] timekeeping: Split out timekeeper update of timekeeping_advanced() Anna-Maria Behnsen
2024-09-11 13:29 ` [PATCH 13/24] timekeeping: Introduce combined timekeeping action flag Anna-Maria Behnsen
2024-09-11 13:29 ` [PATCH 14/24] timekeeping: Provide timekeeping_restore_shadow() Anna-Maria Behnsen
2024-09-11 13:29 ` [PATCH 15/24] timekeeping: Rework do_settimeofday64() to use shadow_timekeeper Anna-Maria Behnsen
2024-09-11 13:30 ` [PATCH 16/24] timekeeping: Rework timekeeping_inject_offset() " Anna-Maria Behnsen
2024-09-11 13:30 ` [PATCH 17/24] timekeeping: Rework change_clocksource() " Anna-Maria Behnsen
2024-09-11 13:30 ` [PATCH 18/24] timekeeping: Rework timekeeping_init() " Anna-Maria Behnsen
2024-09-11 13:30 ` [PATCH 19/24] timekeeping: Rework timekeeping_inject_sleeptime64() " Anna-Maria Behnsen
2024-09-11 13:30 ` [PATCH 20/24] timekeeping: Rework timekeeping_resume() " Anna-Maria Behnsen
2024-09-11 13:30 ` [PATCH 21/24] timekeeping: Rework timekeeping_suspend() " Anna-Maria Behnsen
2024-09-11 13:30 ` [PATCH 22/24] timekeeping: Rework do_adjtimex() " Anna-Maria Behnsen
2024-09-11 13:30 ` [PATCH 23/24] timekeeping: Remove TK_MIRROR timekeeping_update() action Anna-Maria Behnsen
2024-09-11 13:30 ` [PATCH 24/24] timekeeping: Merge timekeeping_update_staged() and timekeeping_update() 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).