Commit dc01c9fa authored by Thomas Gleixner's avatar Thomas Gleixner Committed by John Stultz

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: default avatarThomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
parent 988b0c54
...@@ -260,7 +260,6 @@ void update_vsyscall_tz(void) ...@@ -260,7 +260,6 @@ void update_vsyscall_tz(void)
void update_vsyscall(struct timekeeper *tk) void update_vsyscall(struct timekeeper *tk)
{ {
struct timespec wall_time = tk_xtime(tk);
struct timespec *wtm = &tk->wall_to_monotonic; struct timespec *wtm = &tk->wall_to_monotonic;
struct clocksource *clock = tk->clock; struct clocksource *clock = tk->clock;
...@@ -271,12 +270,12 @@ void update_vsyscall(struct timekeeper *tk) ...@@ -271,12 +270,12 @@ void update_vsyscall(struct timekeeper *tk)
++vdso_data->tb_update_count; ++vdso_data->tb_update_count;
smp_wmb(); smp_wmb();
vdso_data->xtime_tod_stamp = clock->cycle_last; vdso_data->xtime_tod_stamp = clock->cycle_last;
vdso_data->xtime_clock_sec = wall_time.tv_sec; vdso_data->xtime_clock_sec = tk->xtime_sec;
vdso_data->xtime_clock_nsec = wall_time.tv_nsec; vdso_data->xtime_clock_nsec = tk->xtime_nsec;
vdso_data->wtom_clock_sec = wtm->tv_sec; vdso_data->wtom_clock_sec = wtm->tv_sec;
vdso_data->wtom_clock_nsec = wtm->tv_nsec; vdso_data->wtom_clock_nsec = wtm->tv_nsec;
vdso_data->mult = clock->mult; vdso_data->mult = tk->mult;
vdso_data->shift = clock->shift; vdso_data->shift = tk->shift;
smp_wmb(); smp_wmb();
++vdso_data->tb_update_count; ++vdso_data->tb_update_count;
} }
...@@ -83,10 +83,11 @@ int __vdso_gettimeofday(struct timeval *tv, struct timezone *tz) ...@@ -83,10 +83,11 @@ int __vdso_gettimeofday(struct timeval *tv, struct timezone *tz)
if (count & 1) if (count & 1)
continue; continue;
cycles = (get_cycles() - vdso_data->xtime_tod_stamp);
ns = (cycles * vdso_data->mult) >> vdso_data->shift;
sec = vdso_data->xtime_clock_sec; sec = vdso_data->xtime_clock_sec;
ns += vdso_data->xtime_clock_nsec; cycles = get_cycles() - vdso_data->xtime_tod_stamp;
ns = (cycles * vdso_data->mult) + vdso_data->xtime_clock_nsec;
ns >>= vdso_data->shift;
if (ns >= NSEC_PER_SEC) { if (ns >= NSEC_PER_SEC) {
ns -= NSEC_PER_SEC; ns -= NSEC_PER_SEC;
sec += 1; sec += 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment