aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2014-07-16 17:03:49 -0400
committerJohn Stultz <john.stultz@linaro.org>2014-07-23 13:16:50 -0400
commitdc01c9fae1c5e40458c086a868d2028dfd6faebd (patch)
tree13569e1407d84fc72e6fdf902c0922a0d045306f
parent988b0c541ed8b1c633c4d4df7169010635942e18 (diff)
tile: Convert VDSO timekeeping to the precise mechanism
The code was only halfarsed converted to the new VSDO update mechanism and still uses the inaccurate base value which lacks the fractional part of xtime_nsec. Fix it up. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: John Stultz <john.stultz@linaro.org>
-rw-r--r--arch/tile/kernel/time.c9
-rw-r--r--arch/tile/kernel/vdso/vgettimeofday.c7
2 files changed, 8 insertions, 8 deletions
diff --git a/arch/tile/kernel/time.c b/arch/tile/kernel/time.c
index 462dcd0c1700..ae70155c2f16 100644
--- a/arch/tile/kernel/time.c
+++ b/arch/tile/kernel/time.c
@@ -260,7 +260,6 @@ void update_vsyscall_tz(void)
260 260
261void update_vsyscall(struct timekeeper *tk) 261void update_vsyscall(struct timekeeper *tk)
262{ 262{
263 struct timespec wall_time = tk_xtime(tk);
264 struct timespec *wtm = &tk->wall_to_monotonic; 263 struct timespec *wtm = &tk->wall_to_monotonic;
265 struct clocksource *clock = tk->clock; 264 struct clocksource *clock = tk->clock;
266 265
@@ -271,12 +270,12 @@ void update_vsyscall(struct timekeeper *tk)
271 ++vdso_data->tb_update_count; 270 ++vdso_data->tb_update_count;
272 smp_wmb(); 271 smp_wmb();
273 vdso_data->xtime_tod_stamp = clock->cycle_last; 272 vdso_data->xtime_tod_stamp = clock->cycle_last;
274 vdso_data->xtime_clock_sec = wall_time.tv_sec; 273 vdso_data->xtime_clock_sec = tk->xtime_sec;
275 vdso_data->xtime_clock_nsec = wall_time.tv_nsec; 274 vdso_data->xtime_clock_nsec = tk->xtime_nsec;
276 vdso_data->wtom_clock_sec = wtm->tv_sec; 275 vdso_data->wtom_clock_sec = wtm->tv_sec;
277 vdso_data->wtom_clock_nsec = wtm->tv_nsec; 276 vdso_data->wtom_clock_nsec = wtm->tv_nsec;
278 vdso_data->mult = clock->mult; 277 vdso_data->mult = tk->mult;
279 vdso_data->shift = clock->shift; 278 vdso_data->shift = tk->shift;
280 smp_wmb(); 279 smp_wmb();
281 ++vdso_data->tb_update_count; 280 ++vdso_data->tb_update_count;
282} 281}
diff --git a/arch/tile/kernel/vdso/vgettimeofday.c b/arch/tile/kernel/vdso/vgettimeofday.c
index 51ec8e46f5f9..e933fb9fbf5c 100644
--- a/arch/tile/kernel/vdso/vgettimeofday.c
+++ b/arch/tile/kernel/vdso/vgettimeofday.c
@@ -83,10 +83,11 @@ int __vdso_gettimeofday(struct timeval *tv, struct timezone *tz)
83 if (count & 1) 83 if (count & 1)
84 continue; 84 continue;
85 85
86 cycles = (get_cycles() - vdso_data->xtime_tod_stamp);
87 ns = (cycles * vdso_data->mult) >> vdso_data->shift;
88 sec = vdso_data->xtime_clock_sec; 86 sec = vdso_data->xtime_clock_sec;
89 ns += vdso_data->xtime_clock_nsec; 87 cycles = get_cycles() - vdso_data->xtime_tod_stamp;
88 ns = (cycles * vdso_data->mult) + vdso_data->xtime_clock_nsec;
89 ns >>= vdso_data->shift;
90
90 if (ns >= NSEC_PER_SEC) { 91 if (ns >= NSEC_PER_SEC) {
91 ns -= NSEC_PER_SEC; 92 ns -= NSEC_PER_SEC;
92 sec += 1; 93 sec += 1;