aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/time.c
diff options
context:
space:
mode:
authorLin Ming <ming.m.lin@intel.com>2009-11-17 00:49:50 -0500
committerThomas Gleixner <tglx@linutronix.de>2009-11-17 05:52:34 -0500
commit0696b711e4be45fa104c12329f617beb29c03f78 (patch)
tree96292fdc4ab443d6218077d363548532df6cbd8b /arch/powerpc/kernel/time.c
parenta9366e61b03f55a6e009e687ad10e706714c9907 (diff)
timekeeping: Fix clock_gettime vsyscall time warp
Since commit 0a544198 "timekeeping: Move NTP adjusted clock multiplier to struct timekeeper" the clock multiplier of vsyscall is updated with the unmodified clock multiplier of the clock source and not with the NTP adjusted multiplier of the timekeeper. This causes user space observerable time warps: new CLOCK-warp maximum: 120 nsecs, 00000025c337c537 -> 00000025c337c4bf Add a new argument "mult" to update_vsyscall() and hand in the timekeeping internal NTP adjusted multiplier. Signed-off-by: Lin Ming <ming.m.lin@intel.com> Cc: "Zhang Yanmin" <yanmin_zhang@linux.intel.com> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Tony Luck <tony.luck@intel.com> LKML-Reference: <1258436990.17765.83.camel@minggr.sh.intel.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/powerpc/kernel/time.c')
-rw-r--r--arch/powerpc/kernel/time.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index a136a11c490d..39713312fbc7 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -828,7 +828,8 @@ static cycle_t timebase_read(struct clocksource *cs)
828 return (cycle_t)get_tb(); 828 return (cycle_t)get_tb();
829} 829}
830 830
831void update_vsyscall(struct timespec *wall_time, struct clocksource *clock) 831void update_vsyscall(struct timespec *wall_time, struct clocksource *clock,
832 u32 mult)
832{ 833{
833 u64 t2x, stamp_xsec; 834 u64 t2x, stamp_xsec;
834 835
@@ -841,7 +842,7 @@ void update_vsyscall(struct timespec *wall_time, struct clocksource *clock)
841 842
842 /* XXX this assumes clock->shift == 22 */ 843 /* XXX this assumes clock->shift == 22 */
843 /* 4611686018 ~= 2^(20+64-22) / 1e9 */ 844 /* 4611686018 ~= 2^(20+64-22) / 1e9 */
844 t2x = (u64) clock->mult * 4611686018ULL; 845 t2x = (u64) mult * 4611686018ULL;
845 stamp_xsec = (u64) xtime.tv_nsec * XSEC_PER_SEC; 846 stamp_xsec = (u64) xtime.tv_nsec * XSEC_PER_SEC;
846 do_div(stamp_xsec, 1000000000); 847 do_div(stamp_xsec, 1000000000);
847 stamp_xsec += (u64) xtime.tv_sec * XSEC_PER_SEC; 848 stamp_xsec += (u64) xtime.tv_sec * XSEC_PER_SEC;