diff options
author | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2013-11-22 04:04:53 -0500 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2013-11-25 03:15:39 -0500 |
commit | 79c74ecbebf76732f91b82a62ce7fc8a88326962 (patch) | |
tree | aabc8542bfa82067edb563a1de166952058e91d5 /arch/s390 | |
parent | 71a86ef055f569b93bc6901f007bdf447dbf515f (diff) |
s390/time,vdso: convert to the new update_vsyscall interface
Switch to the improved update_vsyscall interface that provides
sub-nanosecond precision for gettimeofday and clock_gettime.
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390')
-rw-r--r-- | arch/s390/Kconfig | 2 | ||||
-rw-r--r-- | arch/s390/include/asm/vdso.h | 5 | ||||
-rw-r--r-- | arch/s390/kernel/asm-offsets.c | 3 | ||||
-rw-r--r-- | arch/s390/kernel/time.c | 27 | ||||
-rw-r--r-- | arch/s390/kernel/vdso32/clock_gettime.S | 30 | ||||
-rw-r--r-- | arch/s390/kernel/vdso32/gettimeofday.S | 9 | ||||
-rw-r--r-- | arch/s390/kernel/vdso64/clock_gettime.S | 22 | ||||
-rw-r--r-- | arch/s390/kernel/vdso64/gettimeofday.S | 9 |
8 files changed, 62 insertions, 45 deletions
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index 314fced4fc14..5877e71901b3 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig | |||
@@ -101,7 +101,7 @@ config S390 | |||
101 | select GENERIC_CPU_DEVICES if !SMP | 101 | select GENERIC_CPU_DEVICES if !SMP |
102 | select GENERIC_FIND_FIRST_BIT | 102 | select GENERIC_FIND_FIRST_BIT |
103 | select GENERIC_SMP_IDLE_THREAD | 103 | select GENERIC_SMP_IDLE_THREAD |
104 | select GENERIC_TIME_VSYSCALL_OLD | 104 | select GENERIC_TIME_VSYSCALL |
105 | select HAVE_ALIGNED_STRUCT_PAGE if SLUB | 105 | select HAVE_ALIGNED_STRUCT_PAGE if SLUB |
106 | select HAVE_ARCH_JUMP_LABEL if !MARCH_G5 | 106 | select HAVE_ARCH_JUMP_LABEL if !MARCH_G5 |
107 | select HAVE_ARCH_SECCOMP_FILTER | 107 | select HAVE_ARCH_SECCOMP_FILTER |
diff --git a/arch/s390/include/asm/vdso.h b/arch/s390/include/asm/vdso.h index a73eb2e1e918..bc9746a7d47c 100644 --- a/arch/s390/include/asm/vdso.h +++ b/arch/s390/include/asm/vdso.h | |||
@@ -26,8 +26,9 @@ struct vdso_data { | |||
26 | __u64 wtom_clock_nsec; /* 0x28 */ | 26 | __u64 wtom_clock_nsec; /* 0x28 */ |
27 | __u32 tz_minuteswest; /* Minutes west of Greenwich 0x30 */ | 27 | __u32 tz_minuteswest; /* Minutes west of Greenwich 0x30 */ |
28 | __u32 tz_dsttime; /* Type of dst correction 0x34 */ | 28 | __u32 tz_dsttime; /* Type of dst correction 0x34 */ |
29 | __u32 ectg_available; | 29 | __u32 ectg_available; /* ECTG instruction present 0x38 */ |
30 | __u32 ntp_mult; /* NTP adjusted multiplier 0x3C */ | 30 | __u32 tk_mult; /* Mult. used for xtime_nsec 0x3c */ |
31 | __u32 tk_shift; /* Shift used for xtime_nsec 0x40 */ | ||
31 | }; | 32 | }; |
32 | 33 | ||
33 | struct vdso_per_cpu_data { | 34 | struct vdso_per_cpu_data { |
diff --git a/arch/s390/kernel/asm-offsets.c b/arch/s390/kernel/asm-offsets.c index 2416138ebd3e..496116cd65ec 100644 --- a/arch/s390/kernel/asm-offsets.c +++ b/arch/s390/kernel/asm-offsets.c | |||
@@ -65,7 +65,8 @@ int main(void) | |||
65 | DEFINE(__VDSO_WTOM_NSEC, offsetof(struct vdso_data, wtom_clock_nsec)); | 65 | DEFINE(__VDSO_WTOM_NSEC, offsetof(struct vdso_data, wtom_clock_nsec)); |
66 | DEFINE(__VDSO_TIMEZONE, offsetof(struct vdso_data, tz_minuteswest)); | 66 | DEFINE(__VDSO_TIMEZONE, offsetof(struct vdso_data, tz_minuteswest)); |
67 | DEFINE(__VDSO_ECTG_OK, offsetof(struct vdso_data, ectg_available)); | 67 | DEFINE(__VDSO_ECTG_OK, offsetof(struct vdso_data, ectg_available)); |
68 | DEFINE(__VDSO_NTP_MULT, offsetof(struct vdso_data, ntp_mult)); | 68 | DEFINE(__VDSO_TK_MULT, offsetof(struct vdso_data, tk_mult)); |
69 | DEFINE(__VDSO_TK_SHIFT, offsetof(struct vdso_data, tk_shift)); | ||
69 | DEFINE(__VDSO_ECTG_BASE, offsetof(struct vdso_per_cpu_data, ectg_timer_base)); | 70 | DEFINE(__VDSO_ECTG_BASE, offsetof(struct vdso_per_cpu_data, ectg_timer_base)); |
70 | DEFINE(__VDSO_ECTG_USER, offsetof(struct vdso_per_cpu_data, ectg_user_time)); | 71 | DEFINE(__VDSO_ECTG_USER, offsetof(struct vdso_per_cpu_data, ectg_user_time)); |
71 | /* constants used by the vdso */ | 72 | /* constants used by the vdso */ |
diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c index 064c3082ab33..60a508a9b981 100644 --- a/arch/s390/kernel/time.c +++ b/arch/s390/kernel/time.c | |||
@@ -221,21 +221,30 @@ struct clocksource * __init clocksource_default_clock(void) | |||
221 | return &clocksource_tod; | 221 | return &clocksource_tod; |
222 | } | 222 | } |
223 | 223 | ||
224 | void update_vsyscall_old(struct timespec *wall_time, struct timespec *wtm, | 224 | void update_vsyscall(struct timekeeper *tk) |
225 | struct clocksource *clock, u32 mult) | ||
226 | { | 225 | { |
227 | if (clock != &clocksource_tod) | 226 | u64 nsecps; |
227 | |||
228 | if (tk->clock != &clocksource_tod) | ||
228 | return; | 229 | return; |
229 | 230 | ||
230 | /* Make userspace gettimeofday spin until we're done. */ | 231 | /* Make userspace gettimeofday spin until we're done. */ |
231 | ++vdso_data->tb_update_count; | 232 | ++vdso_data->tb_update_count; |
232 | smp_wmb(); | 233 | smp_wmb(); |
233 | vdso_data->xtime_tod_stamp = clock->cycle_last; | 234 | vdso_data->xtime_tod_stamp = tk->clock->cycle_last; |
234 | vdso_data->xtime_clock_sec = wall_time->tv_sec; | 235 | vdso_data->xtime_clock_sec = tk->xtime_sec; |
235 | vdso_data->xtime_clock_nsec = wall_time->tv_nsec; | 236 | vdso_data->xtime_clock_nsec = tk->xtime_nsec; |
236 | vdso_data->wtom_clock_sec = wtm->tv_sec; | 237 | vdso_data->wtom_clock_sec = |
237 | vdso_data->wtom_clock_nsec = wtm->tv_nsec; | 238 | tk->xtime_sec + tk->wall_to_monotonic.tv_sec; |
238 | vdso_data->ntp_mult = mult; | 239 | vdso_data->wtom_clock_nsec = tk->xtime_nsec + |
240 | + (tk->wall_to_monotonic.tv_nsec << tk->shift); | ||
241 | nsecps = (u64) NSEC_PER_SEC << tk->shift; | ||
242 | while (vdso_data->wtom_clock_nsec >= nsecps) { | ||
243 | vdso_data->wtom_clock_nsec -= nsecps; | ||
244 | vdso_data->wtom_clock_sec++; | ||
245 | } | ||
246 | vdso_data->tk_mult = tk->mult; | ||
247 | vdso_data->tk_shift = tk->shift; | ||
239 | smp_wmb(); | 248 | smp_wmb(); |
240 | ++vdso_data->tb_update_count; | 249 | ++vdso_data->tb_update_count; |
241 | } | 250 | } |
diff --git a/arch/s390/kernel/vdso32/clock_gettime.S b/arch/s390/kernel/vdso32/clock_gettime.S index b2224e0b974c..5be8e472f57d 100644 --- a/arch/s390/kernel/vdso32/clock_gettime.S +++ b/arch/s390/kernel/vdso32/clock_gettime.S | |||
@@ -38,25 +38,26 @@ __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 |
41 | 2: ms %r0,__VDSO_NTP_MULT(%r5) /* cyc2ns(clock,cycle_delta) */ | 41 | 2: ms %r0,__VDSO_TK_MULT(%r5) /* * tk->mult */ |
42 | lr %r2,%r0 | 42 | lr %r2,%r0 |
43 | l %r0,__VDSO_NTP_MULT(%r5) | 43 | l %r0,__VDSO_TK_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 | a %r0,__VDSO_NTP_MULT(%r5) | 47 | a %r0,__VDSO_TK_MULT(%r5) |
48 | 3: alr %r0,%r2 | 48 | 3: alr %r0,%r2 |
49 | srdl %r0,12 | 49 | al %r0,__VDSO_XTIME_NSEC(%r5) /* + tk->xtime_nsec */ |
50 | al %r0,__VDSO_XTIME_NSEC(%r5) /* + xtime */ | ||
51 | al %r1,__VDSO_XTIME_NSEC+4(%r5) | 50 | al %r1,__VDSO_XTIME_NSEC+4(%r5) |
52 | brc 12,4f | 51 | brc 12,4f |
53 | ahi %r0,1 | 52 | ahi %r0,1 |
54 | 4: l %r2,__VDSO_XTIME_SEC+4(%r5) | 53 | 4: al %r0,__VDSO_WTOM_NSEC(%r5) /* + wall_to_monotonic.nsec */ |
55 | al %r0,__VDSO_WTOM_NSEC(%r5) /* + wall_to_monotonic */ | ||
56 | al %r1,__VDSO_WTOM_NSEC+4(%r5) | 54 | al %r1,__VDSO_WTOM_NSEC+4(%r5) |
57 | brc 12,5f | 55 | brc 12,5f |
58 | ahi %r0,1 | 56 | ahi %r0,1 |
59 | 5: al %r2,__VDSO_WTOM_SEC+4(%r5) | 57 | 5: l %r2,__VDSO_TK_SHIFT(%r5) /* Timekeeper shift */ |
58 | srdl %r0,0(%r2) /* >> tk->shift */ | ||
59 | l %r2,__VDSO_XTIME_SEC+4(%r5) | ||
60 | al %r2,__VDSO_WTOM_SEC+4(%r5) | ||
60 | cl %r4,__VDSO_UPD_COUNT+4(%r5) /* check update counter */ | 61 | cl %r4,__VDSO_UPD_COUNT+4(%r5) /* check update counter */ |
61 | jne 1b | 62 | jne 1b |
62 | basr %r5,0 | 63 | basr %r5,0 |
@@ -86,20 +87,21 @@ __kernel_clock_gettime: | |||
86 | sl %r1,__VDSO_XTIME_STAMP+4(%r5) | 87 | sl %r1,__VDSO_XTIME_STAMP+4(%r5) |
87 | brc 3,12f | 88 | brc 3,12f |
88 | ahi %r0,-1 | 89 | ahi %r0,-1 |
89 | 12: ms %r0,__VDSO_NTP_MULT(%r5) /* cyc2ns(clock,cycle_delta) */ | 90 | 12: ms %r0,__VDSO_TK_MULT(%r5) /* * tk->mult */ |
90 | lr %r2,%r0 | 91 | lr %r2,%r0 |
91 | l %r0,__VDSO_NTP_MULT(%r5) | 92 | l %r0,__VDSO_TK_MULT(%r5) |
92 | ltr %r1,%r1 | 93 | ltr %r1,%r1 |
93 | mr %r0,%r0 | 94 | mr %r0,%r0 |
94 | jnm 13f | 95 | jnm 13f |
95 | a %r0,__VDSO_NTP_MULT(%r5) | 96 | a %r0,__VDSO_TK_MULT(%r5) |
96 | 13: alr %r0,%r2 | 97 | 13: alr %r0,%r2 |
97 | srdl %r0,12 | 98 | al %r0,__VDSO_XTIME_NSEC(%r5) /* + tk->xtime_nsec */ |
98 | al %r0,__VDSO_XTIME_NSEC(%r5) /* + xtime */ | ||
99 | al %r1,__VDSO_XTIME_NSEC+4(%r5) | 99 | al %r1,__VDSO_XTIME_NSEC+4(%r5) |
100 | brc 12,14f | 100 | brc 12,14f |
101 | ahi %r0,1 | 101 | ahi %r0,1 |
102 | 14: l %r2,__VDSO_XTIME_SEC+4(%r5) | 102 | 14: l %r2,__VDSO_TK_SHIFT(%r5) /* Timekeeper shift */ |
103 | srdl %r0,0(%r2) /* >> tk->shift */ | ||
104 | l %r2,__VDSO_XTIME_SEC+4(%r5) | ||
103 | cl %r4,__VDSO_UPD_COUNT+4(%r5) /* check update counter */ | 105 | cl %r4,__VDSO_UPD_COUNT+4(%r5) /* check update counter */ |
104 | jne 11b | 106 | jne 11b |
105 | basr %r5,0 | 107 | basr %r5,0 |
diff --git a/arch/s390/kernel/vdso32/gettimeofday.S b/arch/s390/kernel/vdso32/gettimeofday.S index 2d3633175e3b..fd621a950f7c 100644 --- a/arch/s390/kernel/vdso32/gettimeofday.S +++ b/arch/s390/kernel/vdso32/gettimeofday.S | |||
@@ -35,15 +35,14 @@ __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 |
38 | 3: ms %r0,__VDSO_NTP_MULT(%r5) /* cyc2ns(clock,cycle_delta) */ | 38 | 3: ms %r0,__VDSO_TK_MULT(%r5) /* * tk->mult */ |
39 | st %r0,24(%r15) | 39 | st %r0,24(%r15) |
40 | l %r0,__VDSO_NTP_MULT(%r5) | 40 | l %r0,__VDSO_TK_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 | a %r0,__VDSO_NTP_MULT(%r5) | 44 | a %r0,__VDSO_TK_MULT(%r5) |
45 | 4: al %r0,24(%r15) | 45 | 4: al %r0,24(%r15) |
46 | srdl %r0,12 | ||
47 | al %r0,__VDSO_XTIME_NSEC(%r5) /* + xtime */ | 46 | al %r0,__VDSO_XTIME_NSEC(%r5) /* + xtime */ |
48 | al %r1,__VDSO_XTIME_NSEC+4(%r5) | 47 | al %r1,__VDSO_XTIME_NSEC+4(%r5) |
49 | brc 12,5f | 48 | brc 12,5f |
@@ -51,6 +50,8 @@ __kernel_gettimeofday: | |||
51 | 5: mvc 24(4,%r15),__VDSO_XTIME_SEC+4(%r5) | 50 | 5: mvc 24(4,%r15),__VDSO_XTIME_SEC+4(%r5) |
52 | cl %r4,__VDSO_UPD_COUNT+4(%r5) /* check update counter */ | 51 | cl %r4,__VDSO_UPD_COUNT+4(%r5) /* check update counter */ |
53 | jne 1b | 52 | jne 1b |
53 | l %r4,__VDSO_TK_SHIFT(%r5) /* Timekeeper shift */ | ||
54 | srdl %r0,0(%r4) /* >> tk->shift */ | ||
54 | l %r4,24(%r15) /* get tv_sec from stack */ | 55 | l %r4,24(%r15) /* get tv_sec from stack */ |
55 | basr %r5,0 | 56 | basr %r5,0 |
56 | 6: ltr %r0,%r0 | 57 | 6: ltr %r0,%r0 |
diff --git a/arch/s390/kernel/vdso64/clock_gettime.S b/arch/s390/kernel/vdso64/clock_gettime.S index d46c95ed5f19..0add1072ba30 100644 --- a/arch/s390/kernel/vdso64/clock_gettime.S +++ b/arch/s390/kernel/vdso64/clock_gettime.S | |||
@@ -34,14 +34,15 @@ __kernel_clock_gettime: | |||
34 | tmll %r4,0x0001 /* pending update ? loop */ | 34 | tmll %r4,0x0001 /* pending update ? loop */ |
35 | jnz 0b | 35 | jnz 0b |
36 | stck 48(%r15) /* Store TOD clock */ | 36 | stck 48(%r15) /* Store TOD clock */ |
37 | lgf %r2,__VDSO_TK_SHIFT(%r5) /* Timekeeper shift */ | ||
38 | lg %r0,__VDSO_XTIME_SEC(%r5) /* tk->xtime_sec */ | ||
39 | alg %r0,__VDSO_WTOM_SEC(%r5) /* + wall_to_monotonic.sec */ | ||
37 | lg %r1,48(%r15) | 40 | lg %r1,48(%r15) |
38 | sg %r1,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */ | 41 | sg %r1,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */ |
39 | msgf %r1,__VDSO_NTP_MULT(%r5) /* * NTP adjustment */ | 42 | msgf %r1,__VDSO_TK_MULT(%r5) /* * tk->mult */ |
40 | srlg %r1,%r1,12 /* cyc2ns(clock,cycle_delta) */ | 43 | alg %r1,__VDSO_XTIME_NSEC(%r5) /* + tk->xtime_nsec */ |
41 | alg %r1,__VDSO_XTIME_NSEC(%r5) /* + xtime */ | 44 | alg %r1,__VDSO_WTOM_NSEC(%r5) /* + wall_to_monotonic.nsec */ |
42 | lg %r0,__VDSO_XTIME_SEC(%r5) | 45 | srlg %r1,%r1,0(%r2) /* >> tk->shift */ |
43 | alg %r1,__VDSO_WTOM_NSEC(%r5) /* + wall_to_monotonic */ | ||
44 | alg %r0,__VDSO_WTOM_SEC(%r5) | ||
45 | clg %r4,__VDSO_UPD_COUNT(%r5) /* check update counter */ | 46 | clg %r4,__VDSO_UPD_COUNT(%r5) /* check update counter */ |
46 | jne 0b | 47 | jne 0b |
47 | larl %r5,13f | 48 | larl %r5,13f |
@@ -62,12 +63,13 @@ __kernel_clock_gettime: | |||
62 | tmll %r4,0x0001 /* pending update ? loop */ | 63 | tmll %r4,0x0001 /* pending update ? loop */ |
63 | jnz 5b | 64 | jnz 5b |
64 | stck 48(%r15) /* Store TOD clock */ | 65 | stck 48(%r15) /* Store TOD clock */ |
66 | lgf %r2,__VDSO_TK_SHIFT(%r5) /* Timekeeper shift */ | ||
65 | lg %r1,48(%r15) | 67 | lg %r1,48(%r15) |
66 | sg %r1,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */ | 68 | sg %r1,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */ |
67 | msgf %r1,__VDSO_NTP_MULT(%r5) /* * NTP adjustment */ | 69 | msgf %r1,__VDSO_TK_MULT(%r5) /* * tk->mult */ |
68 | srlg %r1,%r1,12 /* cyc2ns(clock,cycle_delta) */ | 70 | alg %r1,__VDSO_XTIME_NSEC(%r5) /* + tk->xtime_nsec */ |
69 | alg %r1,__VDSO_XTIME_NSEC(%r5) /* + xtime */ | 71 | srlg %r1,%r1,0(%r2) /* >> tk->shift */ |
70 | lg %r0,__VDSO_XTIME_SEC(%r5) | 72 | lg %r0,__VDSO_XTIME_SEC(%r5) /* tk->xtime_sec */ |
71 | clg %r4,__VDSO_UPD_COUNT(%r5) /* check update counter */ | 73 | clg %r4,__VDSO_UPD_COUNT(%r5) /* check update counter */ |
72 | jne 5b | 74 | jne 5b |
73 | larl %r5,13f | 75 | larl %r5,13f |
diff --git a/arch/s390/kernel/vdso64/gettimeofday.S b/arch/s390/kernel/vdso64/gettimeofday.S index 36ee674722ec..d0860d1d0ccc 100644 --- a/arch/s390/kernel/vdso64/gettimeofday.S +++ b/arch/s390/kernel/vdso64/gettimeofday.S | |||
@@ -31,12 +31,13 @@ __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 | msgf %r1,__VDSO_NTP_MULT(%r5) /* * NTP adjustment */ | 34 | msgf %r1,__VDSO_TK_MULT(%r5) /* * tk->mult */ |
35 | srlg %r1,%r1,12 /* cyc2ns(clock,cycle_delta) */ | 35 | alg %r1,__VDSO_XTIME_NSEC(%r5) /* + tk->xtime_nsec */ |
36 | alg %r1,__VDSO_XTIME_NSEC(%r5) /* + xtime.tv_nsec */ | 36 | lg %r0,__VDSO_XTIME_SEC(%r5) /* tk->xtime_sec */ |
37 | lg %r0,__VDSO_XTIME_SEC(%r5) /* xtime.tv_sec */ | ||
38 | clg %r4,__VDSO_UPD_COUNT(%r5) /* check update counter */ | 37 | clg %r4,__VDSO_UPD_COUNT(%r5) /* check update counter */ |
39 | jne 0b | 38 | jne 0b |
39 | lgf %r5,__VDSO_TK_SHIFT(%r5) /* Timekeeper shift */ | ||
40 | srlg %r1,%r1,0(%r5) /* >> tk->shift */ | ||
40 | larl %r5,5f | 41 | larl %r5,5f |
41 | 2: clg %r1,0(%r5) | 42 | 2: clg %r1,0(%r5) |
42 | jl 3f | 43 | jl 3f |