mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rodolfo Giometti <giometti@enneenne.com>
To: David Woodhouse <dwmw2@infradead.org>,
	Thomas Gleixner <tglx@kernel.org>,
	John Stultz <jstultz@google.com>
Cc: Stephen Boyd <sboyd@kernel.org>,
	Miroslav Lichvar <mlichvar@redhat.com>,
	Richard Cochran <richardcochran@gmail.com>,
	Jie Wang <jie.wang@intel.com>, Yuan Wang <yuan1.wang@intel.com>,
	Ryan Luu <rluu@amazon.com>, Julien Ridoux <ridouxj@amazon.com>,
	linux-kernel@vger.kernel.org, nh-open-source@amazon.com
Subject: Re: [PATCH v2 5/6] pps: Always use ktime_get_snapshot_id() for pps_get_ts()
Date: Fri, 6 Nov 2026 09:44:53 +0100	[thread overview]
Message-ID: <d76c4e6a-3411-4497-a07d-44d8e77e1904@enneenne.com> (raw)
In-Reply-To: <20261106030856.2538039-6-dwmw2@infradead.org>

On 06/11/2026 04:08, David Woodhouse wrote:
> From: David Woodhouse <dwmw@amazon.co.uk>
>
> Without CONFIG_NTP_PPS, pps_get_ts() fills in ts_real with
> ktime_get_real_ts64(). Use ktime_get_snapshot_id() unconditionally so
> that PPS timestamps always come from the snapshot machinery; only the
> raw timestamp remains conditional on CONFIG_NTP_PPS.
>
> This is preparation for the next commit, which corrects the snapshot's
> ::systime for the accumulated ntp_error. That correction should reach
> *all* PPS consumers, not only those on CONFIG_NTP_PPS kernels.
>
> The cost of the snapshot on a small ARM board (Cortex-A53, 12.5MHz
> arch counter) is 38.8ns from the pulse handler to the counter read,
> against 23.4ns for ktime_get_real_ts64() — both small against the
> ~2.8µs measured from the pin edge to the handler.
>
> Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
> ---
> v2: New in this series, ahead of the snapshot correction so that its
>     effect explicitly covers all PPS consumers.
>
>  include/linux/pps_kernel.h | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/include/linux/pps_kernel.h b/include/linux/pps_kernel.h
> index 00b840970d56..35d6ac06a0c0 100644
> --- a/include/linux/pps_kernel.h
> +++ b/include/linux/pps_kernel.h
> @@ -100,14 +100,12 @@ static inline void timespec_to_pps_ktime(struct pps_ktime *kt,
>
>  static inline void pps_get_ts(struct pps_event_time *ts)
>  {
> -#ifdef CONFIG_NTP_PPS
>  	struct system_time_snapshot snap;
>
>  	ktime_get_snapshot_id(CLOCK_REALTIME, &snap);
>  	ts->ts_real = ktime_to_timespec64(snap.systime);
> +#ifdef CONFIG_NTP_PPS
>  	ts->ts_raw = ktime_to_timespec64(snap.monoraw);
> -#else
> -	ktime_get_real_ts64(&ts->ts_real);
>  #endif
>  }
>

Acked-by: Rodolfo Giometti <giometti@enneenne.com>

Ciao,

Rodolfo

-- 
GNU/Linux Solutions                  e-mail: giometti@enneenne.com
Linux Device Driver                          giometti@linux.it
Embedded Systems                     phone:  +39 349 2432127
UNIX programming

  reply	other threads:[~2026-11-06  8:45 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-06  3:08 [PATCH v2 0/6] timekeeping: Reduce magnitude of ntp_error David Woodhouse
2026-11-06  3:08 ` [PATCH v2 1/6] timekeeping: Allow tick_length changes to apply mid-tick David Woodhouse
2026-11-06  3:08 ` [PATCH v2 2/6] ntp: Recalculate skew_delta when the phase offset changes David Woodhouse
2026-11-06  3:08 ` [PATCH v2 3/6] timekeeping: Bound idle sleep while a phase slew is in flight David Woodhouse
2026-11-06  3:08 ` [PATCH v2 4/6] timekeeping: Reinstate proportional correction of ntp_error David Woodhouse
2026-11-06  3:08 ` [PATCH v2 5/6] pps: Always use ktime_get_snapshot_id() for pps_get_ts() David Woodhouse
2026-11-06  8:44   ` Rodolfo Giometti [this message]
2026-11-06  3:08 ` [PATCH v2 6/6] timekeeping: Apply extrapolated ntp_error to clock snapshots David Woodhouse
2026-11-06  8:44   ` Rodolfo Giometti
2026-11-06  3:24 ` [PATCH v2 0/6] timekeeping: Reduce magnitude of ntp_error David Woodhouse
2026-11-06  8:44   ` Rodolfo Giometti
2026-11-06 18:05     ` David Woodhouse

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=d76c4e6a-3411-4497-a07d-44d8e77e1904@enneenne.com \
    --to=giometti@enneenne.com \
    --cc=dwmw2@infradead.org \
    --cc=jie.wang@intel.com \
    --cc=jstultz@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mlichvar@redhat.com \
    --cc=nh-open-source@amazon.com \
    --cc=richardcochran@gmail.com \
    --cc=ridouxj@amazon.com \
    --cc=rluu@amazon.com \
    --cc=sboyd@kernel.org \
    --cc=tglx@kernel.org \
    --cc=yuan1.wang@intel.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

all inboxes | Powered by JetHome®