[tip: timers/ptp] timekeeping: Use system_time_snapshot::systime/monoraw instead of ::real/raw

tip-bot2 for Thomas Gleixner posted 1 patch 5 days, 16 hours ago
kernel/time/timekeeping.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
[tip: timers/ptp] timekeeping: Use system_time_snapshot::systime/monoraw instead of ::real/raw
Posted by tip-bot2 for Thomas Gleixner 5 days, 16 hours ago
The following commit has been merged into the timers/ptp branch of tip:

Commit-ID:     ef22786707e3967b539c3b1e6b5c7ea8b408430f
Gitweb:        https://git.kernel.org/tip/ef22786707e3967b539c3b1e6b5c7ea8b408430f
Author:        Thomas Gleixner <tglx@kernel.org>
AuthorDate:    Fri, 29 May 2026 21:59:55 +02:00
Committer:     Thomas Gleixner <tglx@kernel.org>
CommitterDate: Tue, 02 Jun 2026 11:39:57 +02:00

timekeeping: Use system_time_snapshot::systime/monoraw instead of ::real/raw

system_time_snapshot::systime provides the same information as
system_time_snapshot::real when the snapshot was taken with
ktime_get_snapshot_id(CLOCK_REALTIME).

Convert the history interpolation over to use 'systime' and 'monoraw' as
'real/raw' are going away once all users are converted.

As a side effect this is the first step to support CLOCK_AUX with
get_device_crosstime_stamp() and the history interpolation.

Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Tested-by: David Woodhouse <dwmw@amazon.co.uk>
Tested-by: Arthur Kiyanovski <akiyano@amazon.com>
Reviewed-by: David Woodhouse <dwmw@amazon.co.uk>
Reviewed-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Link: https://patch.msgid.link/20260529195557.024415766@kernel.org
---
 kernel/time/timekeeping.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index 0053dc0..ccd04ad 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -1323,7 +1323,7 @@ static int adjust_historical_crosststamp(struct system_time_snapshot *history,
 	 *	partial_history_cycles / total_history_cycles
 	 */
 	corr_raw = (u64)ktime_to_ns(
-		ktime_sub(ts->sys_monoraw, history->raw));
+		ktime_sub(ts->sys_monoraw, history->monoraw));
 	ret = scale64_check_overflow(partial_history_cycles,
 				     total_history_cycles, &corr_raw);
 	if (ret)
@@ -1341,7 +1341,7 @@ static int adjust_historical_crosststamp(struct system_time_snapshot *history,
 			(corr_raw, tk->tkr_mono.mult, tk->tkr_raw.mult);
 	} else {
 		corr_real = (u64)ktime_to_ns(
-			ktime_sub(ts->sys_realtime, history->real));
+			ktime_sub(ts->sys_realtime, history->systime));
 		ret = scale64_check_overflow(partial_history_cycles,
 					     total_history_cycles, &corr_real);
 		if (ret)
@@ -1350,8 +1350,8 @@ static int adjust_historical_crosststamp(struct system_time_snapshot *history,
 
 	/* Fixup monotonic raw and real time time values */
 	if (interp_forward) {
-		ts->sys_monoraw = ktime_add_ns(history->raw, corr_raw);
-		ts->sys_realtime = ktime_add_ns(history->real, corr_real);
+		ts->sys_monoraw = ktime_add_ns(history->monoraw, corr_raw);
+		ts->sys_realtime = ktime_add_ns(history->systime, corr_real);
 	} else {
 		ts->sys_monoraw = ktime_sub_ns(ts->sys_monoraw, corr_raw);
 		ts->sys_realtime = ktime_sub_ns(ts->sys_realtime, corr_real);