Re: [PATCH v4 3/4] pps: Always use ktime_get_snapshot_id() for pps_get_ts()
From: Rodolfo Giometti
Date: Tue Sep 01 2026 - 12:47:04 EST
On Sat, 2026-08-29 at 21:57 +0100, David Woodhouse wrote:
Rather than using that more accurate timestamp *only* in the case where
CONFIG_NTP_PPS is enabled, do so unconditionally.
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
}
Why are you removing ktime_get_real_ts64()?
The commit message says you are using the more accurate timestamp
unconditionally. What the diff does is delete the !CONFIG_NTP_PPS
branch. Those are not the same thing, and the second one changes an
ABI: ts_real reaches userspace through PPS_FETCH on /dev/ppsN and
through /sys/class/pps/ppsX/assert, documented in
Documentation/ABI/testing/sysfs-pps and unchanged since 2008. Until
now it came from ktime_get_real_ts64(), the same clock userspace reads
with clock_gettime(CLOCK_REALTIME). After your patch it does not.
That needs a good reason and the commit message does not give one.
Give me that first. Until then the details do not matter.
Separately: are we sure that calling ktime_get_snapshot_id() does not
introduce much larger delays than ktime_get_real_ts64()? pps_get_ts()
runs in hard IRQ, and in pps-gpio it is the first statement of the
handler. Whatever it costs sits between the edge and the timestamp,
and that is the one thing PPS has to keep short.
I would like to see that measured on something other than an x86 VM
with a TSC. A small 32-bit ARM board is what I worry about.
Rodolfo