Skip to content

Commit 94ecbf1

Browse files
svens-s390Alexander Gordeev
authored andcommitted
s390/time: Remove in-kernel time steering
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 <[email protected]> Reviewed-by: Heiko Carstens <[email protected]> Signed-off-by: Alexander Gordeev <[email protected]>
1 parent 925f070 commit 94ecbf1

File tree

3 files changed

+5
-45
lines changed

3 files changed

+5
-45
lines changed

arch/s390/include/asm/vdso/gettimeofday.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,7 @@
1616

1717
static inline u64 __arch_get_hw_counter(s32 clock_mode, const struct vdso_time_data *vd)
1818
{
19-
u64 adj, now;
20-
21-
now = get_tod_clock();
22-
adj = vd->arch_data.tod_steering_end - now;
23-
if (unlikely((s64) adj > 0))
24-
now += (vd->arch_data.tod_steering_delta < 0) ? (adj >> 15) : -(adj >> 15);
25-
return now;
19+
return get_tod_clock() - vd->arch_data.tod_delta;
2620
}
2721

2822
static __always_inline

arch/s390/include/asm/vdso/time_data.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
#include <linux/types.h>
66

77
struct arch_vdso_time_data {
8-
__s64 tod_steering_delta;
9-
__u64 tod_steering_end;
8+
__s64 tod_delta;
109
};
1110

1211
#endif /* __S390_ASM_VDSO_TIME_DATA_H */

arch/s390/kernel/time.c

Lines changed: 3 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,6 @@ unsigned char ptff_function_mask[16];
6969

7070
static unsigned long lpar_offset;
7171
static unsigned long initial_leap_seconds;
72-
static unsigned long tod_steering_end;
73-
static long tod_steering_delta;
7472

7573
/*
7674
* Get time offsets with PTFF
@@ -80,9 +78,7 @@ void __init time_early_init(void)
8078
struct ptff_qto qto;
8179
struct ptff_qui qui;
8280

83-
/* Initialize TOD steering parameters */
84-
tod_steering_end = tod_clock_base.tod;
85-
vdso_k_time_data->arch_data.tod_steering_end = tod_steering_end;
81+
vdso_k_time_data->arch_data.tod_delta = tod_clock_base.tod;
8682

8783
if (!test_facility(28))
8884
return;
@@ -226,21 +222,7 @@ void __init read_persistent_wall_and_boot_offset(struct timespec64 *wall_time,
226222

227223
static u64 read_tod_clock(struct clocksource *cs)
228224
{
229-
unsigned long now, adj;
230-
231-
preempt_disable(); /* protect from changes to steering parameters */
232-
now = get_tod_clock();
233-
adj = tod_steering_end - now;
234-
if (unlikely((s64) adj > 0))
235-
/*
236-
* manually steer by 1 cycle every 2^16 cycles. This
237-
* corresponds to shifting the tod delta by 15. 1s is
238-
* therefore steered in ~9h. The adjust will decrease
239-
* over time, until it finally reaches 0.
240-
*/
241-
now += (tod_steering_delta < 0) ? (adj >> 15) : -(adj >> 15);
242-
preempt_enable();
243-
return now;
225+
return get_tod_clock_monotonic();
244226
}
245227

246228
static struct clocksource clocksource_tod = {
@@ -369,26 +351,11 @@ static inline int check_sync_clock(void)
369351
*/
370352
static void clock_sync_global(long delta)
371353
{
372-
unsigned long now, adj;
373354
struct ptff_qto qto;
374355

375356
/* Fixup the monotonic sched clock. */
376357
tod_clock_base.eitod += delta;
377-
/* Adjust TOD steering parameters. */
378-
now = get_tod_clock();
379-
adj = tod_steering_end - now;
380-
if (unlikely((s64) adj >= 0))
381-
/* Calculate how much of the old adjustment is left. */
382-
tod_steering_delta = (tod_steering_delta < 0) ?
383-
-(adj >> 15) : (adj >> 15);
384-
tod_steering_delta += delta;
385-
if ((abs(tod_steering_delta) >> 48) != 0)
386-
panic("TOD clock sync offset %li is too large to drift\n",
387-
tod_steering_delta);
388-
tod_steering_end = now + (abs(tod_steering_delta) << 15);
389-
vdso_k_time_data->arch_data.tod_steering_end = tod_steering_end;
390-
vdso_k_time_data->arch_data.tod_steering_delta = tod_steering_delta;
391-
358+
vdso_k_time_data->arch_data.tod_delta = tod_clock_base.tod;
392359
/* Update LPAR offset. */
393360
if (ptff_query(PTFF_QTO) && ptff(&qto, sizeof(qto), PTFF_QTO) == 0)
394361
lpar_offset = qto.tod_epoch_difference;

0 commit comments

Comments
 (0)