diff options
author | Will Deacon <will.deacon@arm.com> | 2012-11-29 17:33:29 -0500 |
---|---|---|
committer | Catalin Marinas <catalin.marinas@arm.com> | 2012-12-05 06:20:03 -0500 |
commit | 45a7905fc48f6079932e77d64237cf7f008db5f4 (patch) | |
tree | 93b60ea0b2c3daf94b50dfa3125b2a3c59a0ff1b /arch/arm64/kernel/vdso.c | |
parent | d91fb5c2677db90460611fce72e6a0af8f6c2a73 (diff) |
arm64: vdso: defer shifting of nanosecond component of timespec
Shifting the nanosecond component of the computed timespec early can
lead to sub-ns inaccuracies when using the truncated value as input to
further arithmetic for things like conversions to monotonic time.
This patch defers the timespec shifting until after the final value has
been computed.
Reported-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'arch/arm64/kernel/vdso.c')
-rw-r--r-- | arch/arm64/kernel/vdso.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/arm64/kernel/vdso.c b/arch/arm64/kernel/vdso.c index ba457943a16b..c958cb84d75f 100644 --- a/arch/arm64/kernel/vdso.c +++ b/arch/arm64/kernel/vdso.c | |||
@@ -239,7 +239,7 @@ void update_vsyscall(struct timekeeper *tk) | |||
239 | if (!use_syscall) { | 239 | if (!use_syscall) { |
240 | vdso_data->cs_cycle_last = tk->clock->cycle_last; | 240 | vdso_data->cs_cycle_last = tk->clock->cycle_last; |
241 | vdso_data->xtime_clock_sec = tk->xtime_sec; | 241 | vdso_data->xtime_clock_sec = tk->xtime_sec; |
242 | vdso_data->xtime_clock_nsec = tk->xtime_nsec >> tk->shift; | 242 | vdso_data->xtime_clock_nsec = tk->xtime_nsec; |
243 | vdso_data->cs_mult = tk->mult; | 243 | vdso_data->cs_mult = tk->mult; |
244 | vdso_data->cs_shift = tk->shift; | 244 | vdso_data->cs_shift = tk->shift; |
245 | vdso_data->wtm_clock_sec = tk->wall_to_monotonic.tv_sec; | 245 | vdso_data->wtm_clock_sec = tk->wall_to_monotonic.tv_sec; |