From: Paolo Abeni <pabeni@redhat.com>
To: Thomas Gleixner <tglx@linutronix.de>,
LKML <linux-kernel@vger.kernel.org>
Cc: netdev@vger.kernel.org,
"Richard Cochran" <richardcochran@gmail.com>,
"Christopher Hall" <christopher.s.hall@intel.com>,
"John Stultz" <jstultz@google.com>,
"Frederic Weisbecker" <frederic@kernel.org>,
"Anna-Maria Behnsen" <anna-maria@linutronix.de>,
"Miroslav Lichvar" <mlichvar@redhat.com>,
"Werner Abt" <werner.abt@meinberg-usa.com>,
"David Woodhouse" <dwmw2@infradead.org>,
"Stephen Boyd" <sboyd@kernel.org>,
"Thomas Weißschuh" <thomas.weissschuh@linutronix.de>,
"Kurt Kanzenbach" <kurt@linutronix.de>,
"Nam Cao" <namcao@linutronix.de>,
"Antoine Tenart" <atenart@kernel.org>
Subject: Re: [patch 0/3] ptp: Provide support for auxiliary clocks for PTP_SYS_OFFSET_EXTENDED
Date: Tue, 1 Jul 2025 12:16:50 +0200 [thread overview]
Message-ID: <852d45b4-d53d-42b6-bcd9-62d95aa1f39d@redhat.com> (raw)
In-Reply-To: <20250626124327.667087805@linutronix.de>
On 6/26/25 3:27 PM, Thomas Gleixner wrote:
> This small series enables support for auxiliary clocks on top of the
> timekeeping core infrastructure, which has been paritially merged. The
> remaining outstanding patches can be found here:
>
> https://lore.kernel.org/all/20250625182951.587377878@linutronix.de
>
> Auxiliary clocks are required to support TSN use cases in automation,
> automotive, audio and other areas. They utilize PTP for synchronizing nodes
> in a network accurately, but the underlying master clock is not necessarily
> related to clock TAI. They are completely independent and just represent a
> common notion of time in a network for an application specific
> purpose. This comes with problems obvioulsy:
>
> 1) Applications have no fast access to the time of such independent PTP
> clocks. The only way is to utilize the file descriptor of the PTP
> device with clock_gettime(). That's slow as it has to go all the way
> out to the hardware.
>
> 2) The network stack cannot access PTP time at all because accessing the
> PTP hardware requires preemptible task context in quite some cases.
>
> The timekeeper core changes provide support for this including the ability
> to steer these clocks independently from the core timekeeper via
> clock_adjtimex(2).
>
> This is obviously incomplete as the user space steering daemon needs to be
> able to correlate timestamps from these auxiliary clocks with the
> associated PTP device timestamp. The PTP_SYS_OFFSET_EXTENDED IOCTL command
> already supports to select clock IDs for pre and post hardware timestamps,
> so the first step for correlation is to extend that IOCTL to allow
> selecting auxiliary clocks.
>
> Auxiliary clocks do not provide a seperate CLOCK_MONOTONIC_RAW variant as
> they are internally utilizing the same clocksource and therefore the
> existing CLOCK_MONOTONIC_RAW correlation is valid for them too, if user
> space wants to determine the correlation to the underlying clocksource raw
> initial conversion factor:
>
> CLOCK_MONOTONIC_RAW:
>
> The clocksource readout is converted to nanoseconds by a conversion
> factor, which has been determined at setup time. This factor does not
> change over the lifetime of the system.
>
> CLOCK_REALTIME, CLOCK_MONOTONIC, CLOCK_BOOTTIME, CLOCK_TAI:
>
> The clocksource readout is converted to nanoseconds by a conversion
> factor, which starts with the CLOCK_MONOTONIC_RAW conversion factor at
> setup time. This factor can be steered via clock_adjtimex(CLOCK_REALTIME).
>
> All related clocks use the same conversion factor and internally these
> clocks are built on top of CLOCK_MONOTONIC by adding a clock specific
> offset after the conversion. The CLOCK_REALTIME and CLOCK_TAI offsets can
> be set via clock_settime(2) or clock_adjtimex(2). The CLOCK_BOOTTIME
> offset is modified after a suspend/resume cycle to take the suspend time
> into account.
>
> CLOCK_AUX:
>
> The clocksource readout is converted to nanoseconds by a conversion
> factor, which starts with the CLOCK_MONOTONIC_RAW conversion factor at
> setup time. This factor can be steered via clock_adjtimex(CLOCK_AUX[n]).
>
> Each auxiliary clock uses its own conversion factor and offset. The
> offset can be set via clock_settime(2) or clock_adjtimex(2) for each
> clock ID.
>
> The series applies on top of the above mentioned timekeeper core changes
> and the PTP character device spring cleaning series, which can be found
> here:
>
> https://lore.kernel.org/all/20250625114404.102196103@linutronix.de
>
> It is also available via git with all prerequisite patches:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git timers/ptp/driver-auxclock
>
> Miroslav: This branch should enable you to test the actual steering via a
> PTP device which has PTP_SYS_OFFSET_EXTENDED support in the driver.
I have some dumb issues merging this on net-next.
It looks like we should pull from the above URL, but it looks like the
prereq series there has different hashes WRT the tip tree. Pulling from
there will cause good bunch of duplicate commits - the pre-req series vs
the tip tree and the ptp cleanup series vs already merge commits on
net-next.
I guess we want to avoid such duplicates, but I don't see how to avoid
all of them. A stable branch on top of current net-next will avoid the
ptp cleanup series duplicates, but will not avoid duplicates for
prereqs. Am I missing something obvious?
Thanks,
Paolo
next prev parent reply other threads:[~2025-07-01 10:16 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-26 13:27 [patch 0/3] ptp: Provide support for auxiliary clocks for PTP_SYS_OFFSET_EXTENDED Thomas Gleixner
2025-06-26 13:27 ` [patch 1/3] timekeeping: Provide ktime_get_clock_ts64() Thomas Gleixner
2025-06-27 5:22 ` John Stultz
2025-06-29 15:49 ` Vadim Fedorenko
2025-06-26 13:27 ` [patch 2/3] ptp: Use ktime_get_clock_ts64() for timestamping Thomas Gleixner
2025-06-27 5:23 ` John Stultz
2025-06-29 15:50 ` Vadim Fedorenko
2025-06-26 13:27 ` [patch 3/3] ptp: Enable auxiliary clocks for PTP_SYS_OFFSET_EXTENDED Thomas Gleixner
2025-06-29 15:57 ` Vadim Fedorenko
2025-07-01 13:00 ` Thomas Gleixner
2025-06-26 14:53 ` [patch 0/3] ptp: Provide support for " Miroslav Lichvar
2025-06-26 18:36 ` Thomas Gleixner
2025-07-01 10:16 ` Paolo Abeni [this message]
2025-07-01 12:23 ` Thomas Gleixner
2025-07-01 23:56 ` Jakub Kicinski
2025-07-02 8:19 ` Thomas Gleixner
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=852d45b4-d53d-42b6-bcd9-62d95aa1f39d@redhat.com \
--to=pabeni@redhat.com \
--cc=anna-maria@linutronix.de \
--cc=atenart@kernel.org \
--cc=christopher.s.hall@intel.com \
--cc=dwmw2@infradead.org \
--cc=frederic@kernel.org \
--cc=jstultz@google.com \
--cc=kurt@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mlichvar@redhat.com \
--cc=namcao@linutronix.de \
--cc=netdev@vger.kernel.org \
--cc=richardcochran@gmail.com \
--cc=sboyd@kernel.org \
--cc=tglx@linutronix.de \
--cc=thomas.weissschuh@linutronix.de \
--cc=werner.abt@meinberg-usa.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).