]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
s390/time: Remove in-kernel time steering
authorSven Schnelle <svens@linux.ibm.com>
Fri, 25 Apr 2025 08:19:28 +0000 (10:19 +0200)
committerAlexander Gordeev <agordeev@linux.ibm.com>
Mon, 21 Jul 2025 10:41:55 +0000 (12:41 +0200)
Remove the in-kernel time steering in favour of the new
ptp s390 driver, which allows the kernel clock to be steered
more precise.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Reviewed-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
arch/s390/include/asm/vdso/gettimeofday.h
arch/s390/include/asm/vdso/time_data.h
arch/s390/kernel/time.c

index fb4564308e9d77a40f8d5059503519e9f5961f14..c31ac5f61c83e963bc21c655db0610231e51db19 100644 (file)
 
 static inline u64 __arch_get_hw_counter(s32 clock_mode, const struct vdso_time_data *vd)
 {
-       u64 adj, now;
-
-       now = get_tod_clock();
-       adj = vd->arch_data.tod_steering_end - now;
-       if (unlikely((s64) adj > 0))
-               now += (vd->arch_data.tod_steering_delta < 0) ? (adj >> 15) : -(adj >> 15);
-       return now;
+       return get_tod_clock() - vd->arch_data.tod_delta;
 }
 
 static __always_inline
index 8a08752422e609d925c87ba5aafd1bbb6fef57e7..25c4e0d9f596d1a0aa0a67cd58f3230667ad640a 100644 (file)
@@ -5,8 +5,7 @@
 #include <linux/types.h>
 
 struct arch_vdso_time_data {
-       __s64 tod_steering_delta;
-       __u64 tod_steering_end;
+       __s64 tod_delta;
 };
 
 #endif /* __S390_ASM_VDSO_TIME_DATA_H */
index cb7ed55e24d206a9da1b70f93e6d8152f75693b6..02c7bebd0b3cad0e3fa1da4fe4abfc8c5f37387c 100644 (file)
@@ -69,8 +69,6 @@ unsigned char ptff_function_mask[16];
 
 static unsigned long lpar_offset;
 static unsigned long initial_leap_seconds;
-static unsigned long tod_steering_end;
-static long tod_steering_delta;
 
 /*
  * Get time offsets with PTFF
@@ -80,9 +78,7 @@ void __init time_early_init(void)
        struct ptff_qto qto;
        struct ptff_qui qui;
 
-       /* Initialize TOD steering parameters */
-       tod_steering_end = tod_clock_base.tod;
-       vdso_k_time_data->arch_data.tod_steering_end = tod_steering_end;
+       vdso_k_time_data->arch_data.tod_delta = tod_clock_base.tod;
 
        if (!test_facility(28))
                return;
@@ -226,21 +222,7 @@ void __init read_persistent_wall_and_boot_offset(struct timespec64 *wall_time,
 
 static u64 read_tod_clock(struct clocksource *cs)
 {
-       unsigned long now, adj;
-
-       preempt_disable(); /* protect from changes to steering parameters */
-       now = get_tod_clock();
-       adj = tod_steering_end - now;
-       if (unlikely((s64) adj > 0))
-               /*
-                * manually steer by 1 cycle every 2^16 cycles. This
-                * corresponds to shifting the tod delta by 15. 1s is
-                * therefore steered in ~9h. The adjust will decrease
-                * over time, until it finally reaches 0.
-                */
-               now += (tod_steering_delta < 0) ? (adj >> 15) : -(adj >> 15);
-       preempt_enable();
-       return now;
+       return get_tod_clock_monotonic();
 }
 
 static struct clocksource clocksource_tod = {
@@ -369,26 +351,11 @@ static inline int check_sync_clock(void)
  */
 static void clock_sync_global(long delta)
 {
-       unsigned long now, adj;
        struct ptff_qto qto;
 
        /* Fixup the monotonic sched clock. */
        tod_clock_base.eitod += delta;
-       /* Adjust TOD steering parameters. */
-       now = get_tod_clock();
-       adj = tod_steering_end - now;
-       if (unlikely((s64) adj >= 0))
-               /* Calculate how much of the old adjustment is left. */
-               tod_steering_delta = (tod_steering_delta < 0) ?
-                       -(adj >> 15) : (adj >> 15);
-       tod_steering_delta += delta;
-       if ((abs(tod_steering_delta) >> 48) != 0)
-               panic("TOD clock sync offset %li is too large to drift\n",
-                     tod_steering_delta);
-       tod_steering_end = now + (abs(tod_steering_delta) << 15);
-       vdso_k_time_data->arch_data.tod_steering_end = tod_steering_end;
-       vdso_k_time_data->arch_data.tod_steering_delta = tod_steering_delta;
-
+       vdso_k_time_data->arch_data.tod_delta = tod_clock_base.tod;
        /* Update LPAR offset. */
        if (ptff_query(PTFF_QTO) && ptff(&qto, sizeof(qto), PTFF_QTO) == 0)
                lpar_offset = qto.tod_epoch_difference;