[PATCH] i386 and x86_64 TSC set_cyc2ns_scale imprecision
authorMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Sun, 30 Oct 2005 22:59:25 +0000 (14:59 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Mon, 31 Oct 2005 01:37:11 +0000 (17:37 -0800)
commitdacb16b1a034fa7a0b868ee30758119fbfd90bc1
treedaaa631c9c6fa2ad011647fb3acd219784faf2e2
parentbfd51626cbf61cb23f787d8ff972ef0d5ddacc0b
[PATCH] i386 and x86_64 TSC set_cyc2ns_scale imprecision

I just found out that some precision is unnecessarily lost in the
arch/i386/kernel/timers/timer_tsc.c:set_cyc2ns_scale function.  It uses a
cpu_mhz parameter when it could use a cpu_khz.  In the specific case of an
Intel P4 running at 3001.171 Mhz, the truncation to 3001 Mhz leads to an
imprecision of 19 microseconds per second : this is very sad for a timer with
nearly nanosecond accuracy.

Fix the x86_64 architecture too.

Cc: george anzinger <george@mvista.com>
Cc: john stultz <johnstul@us.ibm.com>
Cc: Andi Kleen <ak@muc.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
arch/i386/kernel/timers/timer_hpet.c
arch/i386/kernel/timers/timer_tsc.c
arch/x86_64/kernel/time.c