From: Thomas Gleixner <tglx@linutronix.de>
To: John Stultz <jstultz@google.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
netdev@vger.kernel.org,
"Richard Cochran" <richardcochran@gmail.com>,
"Christopher Hall" <christopher.s.hall@intel.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 V3 04/11] timekeeping: Provide time setter for auxiliary clocks
Date: Fri, 27 Jun 2025 16:57:31 +0200 [thread overview]
Message-ID: <87ikkhnsf8.ffs@tglx> (raw)
In-Reply-To: <87ldpdnu8y.ffs@tglx>
On Fri, Jun 27 2025 at 16:18, Thomas Gleixner wrote:
> On Thu, Jun 26 2025 at 21:23, John Stultz wrote:
>> On Wed, Jun 25, 2025 at 11:38 AM Thomas Gleixner <tglx@linutronix.de> wrote:
>>>
>>> Add clock_settime(2) support for auxiliary clocks. The function affects the
>>> AUX offset which is added to the "monotonic" clock readout of these clocks.
>>>
>>> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
>>> ---
>>
>> Minor fretting: I worry a little that the difference here between the
>> default timekeeper where set adjusts the REALTIME offset from
>> MONOTONIC, and here where it directly adjusts "mono" might confuse
>> later readers?
>
> Actually it's not really that different.
>
> In both cases the new offset to the monotonic clock is calculated and
> stored in the relevant tk::offs_* member.
>
> The difference is that the core timekeeper operates on xtime, but for
> simplicity I chose to calculate the resulting tk::offs_aux directly from
> the monotonic base. That's valid with the aux clocks as they don't
> need any of the xtime parts.
Actually using xtime and adjusting it and xtime_to_mono does not work
for those auxiliary clocks because the offset to clock "monotonic" is
allowed to be negative, unless it would result in a overall negative
time readout.
This is required for those clocks because the TSN/PTP zoo out there
especially in automation/automotive uses clockmasters starting at the
epoch for their specialized networks. So if the clockmaster starts up
_after_ the client, then the pile of xtime sanity checks would prevent
setting the clock back to the epoch.
I tried to work around that, but the result was more horrible and
fragile than the current approach with the aux specific offset.
Don't ask :)
Thanks,
tglx
next prev parent reply other threads:[~2025-06-27 14:57 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-25 18:38 [patch V3 00/11] timekeeping: Provide support for auxiliary clocks - Remaining series Thomas Gleixner
2025-06-25 18:38 ` [patch V3 01/11] timekeeping: Update auxiliary timekeepers on clocksource change Thomas Gleixner
2025-06-27 4:43 ` John Stultz
2025-06-27 14:04 ` Thomas Gleixner
2025-06-25 18:38 ` [patch V3 02/11] timekeeping: Provide time getters for auxiliary clocks Thomas Gleixner
2025-06-27 4:18 ` John Stultz
2025-06-25 18:38 ` [patch V3 03/11] timekeeping: Add minimal posix-timers support " Thomas Gleixner
2025-06-27 4:19 ` John Stultz
2025-06-25 18:38 ` [patch V3 04/11] timekeeping: Provide time setter " Thomas Gleixner
2025-06-27 4:23 ` John Stultz
2025-06-27 14:18 ` Thomas Gleixner
2025-06-27 14:57 ` Thomas Gleixner [this message]
2025-06-25 18:38 ` [patch V3 05/11] timekeeping: Make timekeeping_inject_offset() reusable Thomas Gleixner
2025-06-27 4:26 ` John Stultz
2025-06-25 18:38 ` [patch V3 06/11] timekeeping: Add auxiliary clock support to __timekeeping_inject_offset() Thomas Gleixner
2025-06-27 4:54 ` John Stultz
2025-06-25 18:38 ` [patch V3 07/11] timekeeping: Make do_adjtimex() reusable Thomas Gleixner
2025-06-27 4:56 ` John Stultz
2025-06-25 18:38 ` [patch V3 08/11] timekeeping: Prepare do_adtimex() for auxiliary clocks Thomas Gleixner
2025-06-27 5:00 ` John Stultz
2025-06-25 18:38 ` [patch V3 09/11] timekeeping: Provide adjtimex() " Thomas Gleixner
2025-06-27 5:01 ` John Stultz
2025-06-25 18:38 ` [patch V3 10/11] timekeeping: Provide update for auxiliary timekeepers Thomas Gleixner
2025-06-27 5:05 ` John Stultz
2025-06-25 18:38 ` [patch V3 11/11] timekeeping: Provide interface to control auxiliary clocks Thomas Gleixner
2025-06-27 5:07 ` John Stultz
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=87ikkhnsf8.ffs@tglx \
--to=tglx@linutronix.de \
--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=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