aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/kernel
diff options
context:
space:
mode:
authorHendrik Brueckner <brueckner@linux.vnet.ibm.com>2010-04-22 11:17:06 -0400
committerMartin Schwidefsky <sky@mschwide.boeblingen.de.ibm.com>2010-04-22 11:17:19 -0400
commit157a1a27d5921fc94db8c14e0d01363d13de99b5 (patch)
tree4906607e35a4bee0e84e42d59985af645c1564a2 /arch/s390/kernel
parent8821d24cd261aede9b0436cd3252b17a60ccc33a (diff)
[S390] vdso: use ntp adjusted clock multiplier
Commit "timekeeping: Fix clock_gettime vsyscall time warp" (0696b711e) introduced the new parameter "mult" to update_vsyscall(). This parameter contains the internal NTP adjusted clock multiplier. The s390x vdso did not use this adjusted multiplier. Instead, it used the constant clock multiplier for gettimeofday() and clock_gettime() variants. This may result in observable time warps as explained in commit 0696b711e. Make the NTP adjusted clock multiplier available to the s390x vdso implementation and use it for time calculations. Cc: <stable@kernel.org> Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/kernel')
-rw-r--r--arch/s390/kernel/asm-offsets.c1
-rw-r--r--arch/s390/kernel/time.c1
-rw-r--r--arch/s390/kernel/vdso32/clock_gettime.S12
-rw-r--r--arch/s390/kernel/vdso32/gettimeofday.S6
-rw-r--r--arch/s390/kernel/vdso64/clock_gettime.S4
-rw-r--r--arch/s390/kernel/vdso64/gettimeofday.S2
6 files changed, 14 insertions, 12 deletions
diff --git a/arch/s390/kernel/asm-offsets.c b/arch/s390/kernel/asm-offsets.c
index 08db736dded0..a09408952ed0 100644
--- a/arch/s390/kernel/asm-offsets.c
+++ b/arch/s390/kernel/asm-offsets.c
@@ -61,6 +61,7 @@ int main(void)
61 DEFINE(__VDSO_WTOM_NSEC, offsetof(struct vdso_data, wtom_clock_nsec)); 61 DEFINE(__VDSO_WTOM_NSEC, offsetof(struct vdso_data, wtom_clock_nsec));
62 DEFINE(__VDSO_TIMEZONE, offsetof(struct vdso_data, tz_minuteswest)); 62 DEFINE(__VDSO_TIMEZONE, offsetof(struct vdso_data, tz_minuteswest));
63 DEFINE(__VDSO_ECTG_OK, offsetof(struct vdso_data, ectg_available)); 63 DEFINE(__VDSO_ECTG_OK, offsetof(struct vdso_data, ectg_available));
64 DEFINE(__VDSO_NTP_MULT, offsetof(struct vdso_data, ntp_mult));
64 DEFINE(__VDSO_ECTG_BASE, offsetof(struct vdso_per_cpu_data, ectg_timer_base)); 65 DEFINE(__VDSO_ECTG_BASE, offsetof(struct vdso_per_cpu_data, ectg_timer_base));
65 DEFINE(__VDSO_ECTG_USER, offsetof(struct vdso_per_cpu_data, ectg_user_time)); 66 DEFINE(__VDSO_ECTG_USER, offsetof(struct vdso_per_cpu_data, ectg_user_time));
66 /* constants used by the vdso */ 67 /* constants used by the vdso */
diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c
index fba6dec156bf..d906bf19c14a 100644
--- a/arch/s390/kernel/time.c
+++ b/arch/s390/kernel/time.c
@@ -221,6 +221,7 @@ void update_vsyscall(struct timespec *wall_time, struct clocksource *clock,
221 vdso_data->xtime_clock_nsec = wall_time->tv_nsec; 221 vdso_data->xtime_clock_nsec = wall_time->tv_nsec;
222 vdso_data->wtom_clock_sec = wall_to_monotonic.tv_sec; 222 vdso_data->wtom_clock_sec = wall_to_monotonic.tv_sec;
223 vdso_data->wtom_clock_nsec = wall_to_monotonic.tv_nsec; 223 vdso_data->wtom_clock_nsec = wall_to_monotonic.tv_nsec;
224 vdso_data->ntp_mult = mult;
224 smp_wmb(); 225 smp_wmb();
225 ++vdso_data->tb_update_count; 226 ++vdso_data->tb_update_count;
226} 227}
diff --git a/arch/s390/kernel/vdso32/clock_gettime.S b/arch/s390/kernel/vdso32/clock_gettime.S
index 4a98909a8310..969643954273 100644
--- a/arch/s390/kernel/vdso32/clock_gettime.S
+++ b/arch/s390/kernel/vdso32/clock_gettime.S
@@ -38,13 +38,13 @@ __kernel_clock_gettime:
38 sl %r1,__VDSO_XTIME_STAMP+4(%r5) 38 sl %r1,__VDSO_XTIME_STAMP+4(%r5)
39 brc 3,2f 39 brc 3,2f
40 ahi %r0,-1 40 ahi %r0,-1
412: mhi %r0,1000 /* cyc2ns(clock,cycle_delta) */ 412: ms %r0,__VDSO_NTP_MULT(%r5) /* cyc2ns(clock,cycle_delta) */
42 lr %r2,%r0 42 lr %r2,%r0
43 lhi %r0,1000 43 l %r0,__VDSO_NTP_MULT(%r5)
44 ltr %r1,%r1 44 ltr %r1,%r1
45 mr %r0,%r0 45 mr %r0,%r0
46 jnm 3f 46 jnm 3f
47 ahi %r0,1000 47 a %r0,__VDSO_NTP_MULT(%r5)
483: alr %r0,%r2 483: alr %r0,%r2
49 srdl %r0,12 49 srdl %r0,12
50 al %r0,__VDSO_XTIME_NSEC(%r5) /* + xtime */ 50 al %r0,__VDSO_XTIME_NSEC(%r5) /* + xtime */
@@ -86,13 +86,13 @@ __kernel_clock_gettime:
86 sl %r1,__VDSO_XTIME_STAMP+4(%r5) 86 sl %r1,__VDSO_XTIME_STAMP+4(%r5)
87 brc 3,12f 87 brc 3,12f
88 ahi %r0,-1 88 ahi %r0,-1
8912: mhi %r0,1000 /* cyc2ns(clock,cycle_delta) */ 8912: ms %r0,__VDSO_NTP_MULT(%r5) /* cyc2ns(clock,cycle_delta) */
90 lr %r2,%r0 90 lr %r2,%r0
91 lhi %r0,1000 91 l %r0,__VDSO_NTP_MULT(%r5)
92 ltr %r1,%r1 92 ltr %r1,%r1
93 mr %r0,%r0 93 mr %r0,%r0
94 jnm 13f 94 jnm 13f
95 ahi %r0,1000 95 a %r0,__VDSO_NTP_MULT(%r5)
9613: alr %r0,%r2 9613: alr %r0,%r2
97 srdl %r0,12 97 srdl %r0,12
98 al %r0,__VDSO_XTIME_NSEC(%r5) /* + xtime */ 98 al %r0,__VDSO_XTIME_NSEC(%r5) /* + xtime */
diff --git a/arch/s390/kernel/vdso32/gettimeofday.S b/arch/s390/kernel/vdso32/gettimeofday.S
index ad8acfc949fb..2d3633175e3b 100644
--- a/arch/s390/kernel/vdso32/gettimeofday.S
+++ b/arch/s390/kernel/vdso32/gettimeofday.S
@@ -35,13 +35,13 @@ __kernel_gettimeofday:
35 sl %r1,__VDSO_XTIME_STAMP+4(%r5) 35 sl %r1,__VDSO_XTIME_STAMP+4(%r5)
36 brc 3,3f 36 brc 3,3f
37 ahi %r0,-1 37 ahi %r0,-1
383: mhi %r0,1000 /* cyc2ns(clock,cycle_delta) */ 383: ms %r0,__VDSO_NTP_MULT(%r5) /* cyc2ns(clock,cycle_delta) */
39 st %r0,24(%r15) 39 st %r0,24(%r15)
40 lhi %r0,1000 40 l %r0,__VDSO_NTP_MULT(%r5)
41 ltr %r1,%r1 41 ltr %r1,%r1
42 mr %r0,%r0 42 mr %r0,%r0
43 jnm 4f 43 jnm 4f
44 ahi %r0,1000 44 a %r0,__VDSO_NTP_MULT(%r5)
454: al %r0,24(%r15) 454: al %r0,24(%r15)
46 srdl %r0,12 46 srdl %r0,12
47 al %r0,__VDSO_XTIME_NSEC(%r5) /* + xtime */ 47 al %r0,__VDSO_XTIME_NSEC(%r5) /* + xtime */
diff --git a/arch/s390/kernel/vdso64/clock_gettime.S b/arch/s390/kernel/vdso64/clock_gettime.S
index 49106c6e6f88..f40467884a03 100644
--- a/arch/s390/kernel/vdso64/clock_gettime.S
+++ b/arch/s390/kernel/vdso64/clock_gettime.S
@@ -36,7 +36,7 @@ __kernel_clock_gettime:
36 stck 48(%r15) /* Store TOD clock */ 36 stck 48(%r15) /* Store TOD clock */
37 lg %r1,48(%r15) 37 lg %r1,48(%r15)
38 sg %r1,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */ 38 sg %r1,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */
39 mghi %r1,1000 39 msgf %r1,__VDSO_NTP_MULT(%r5) /* * NTP adjustment */
40 srlg %r1,%r1,12 /* cyc2ns(clock,cycle_delta) */ 40 srlg %r1,%r1,12 /* cyc2ns(clock,cycle_delta) */
41 alg %r1,__VDSO_XTIME_NSEC(%r5) /* + xtime */ 41 alg %r1,__VDSO_XTIME_NSEC(%r5) /* + xtime */
42 lg %r0,__VDSO_XTIME_SEC(%r5) 42 lg %r0,__VDSO_XTIME_SEC(%r5)
@@ -64,7 +64,7 @@ __kernel_clock_gettime:
64 stck 48(%r15) /* Store TOD clock */ 64 stck 48(%r15) /* Store TOD clock */
65 lg %r1,48(%r15) 65 lg %r1,48(%r15)
66 sg %r1,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */ 66 sg %r1,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */
67 mghi %r1,1000 67 msgf %r1,__VDSO_NTP_MULT(%r5) /* * NTP adjustment */
68 srlg %r1,%r1,12 /* cyc2ns(clock,cycle_delta) */ 68 srlg %r1,%r1,12 /* cyc2ns(clock,cycle_delta) */
69 alg %r1,__VDSO_XTIME_NSEC(%r5) /* + xtime */ 69 alg %r1,__VDSO_XTIME_NSEC(%r5) /* + xtime */
70 lg %r0,__VDSO_XTIME_SEC(%r5) 70 lg %r0,__VDSO_XTIME_SEC(%r5)
diff --git a/arch/s390/kernel/vdso64/gettimeofday.S b/arch/s390/kernel/vdso64/gettimeofday.S
index f873e75634e1..36ee674722ec 100644
--- a/arch/s390/kernel/vdso64/gettimeofday.S
+++ b/arch/s390/kernel/vdso64/gettimeofday.S
@@ -31,7 +31,7 @@ __kernel_gettimeofday:
31 stck 48(%r15) /* Store TOD clock */ 31 stck 48(%r15) /* Store TOD clock */
32 lg %r1,48(%r15) 32 lg %r1,48(%r15)
33 sg %r1,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */ 33 sg %r1,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */
34 mghi %r1,1000 34 msgf %r1,__VDSO_NTP_MULT(%r5) /* * NTP adjustment */
35 srlg %r1,%r1,12 /* cyc2ns(clock,cycle_delta) */ 35 srlg %r1,%r1,12 /* cyc2ns(clock,cycle_delta) */
36 alg %r1,__VDSO_XTIME_NSEC(%r5) /* + xtime.tv_nsec */ 36 alg %r1,__VDSO_XTIME_NSEC(%r5) /* + xtime.tv_nsec */
37 lg %r0,__VDSO_XTIME_SEC(%r5) /* xtime.tv_sec */ 37 lg %r0,__VDSO_XTIME_SEC(%r5) /* xtime.tv_sec */