time: Compensate for rounding on odd-frequency clocksources
commite97ee080621da3c7c393a6f44118e930949e2f9e
authorKasper Pedersen <kkp2010@kasperkp.dk>
Wed, 20 Oct 2010 22:55:15 +0000 (20 15:55 -0700)
committerAndi Kleen <ak@linux.intel.com>
Mon, 1 Aug 2011 20:54:57 +0000 (1 13:54 -0700)
tree4ddda8c93fcea5a3027422b536c1249735dc6c21
parent4bd6e30b48fb0c03f9546b711dc86a42fd606aa1
time: Compensate for rounding on odd-frequency clocksources

commit a386b5af8edda1c742ce9f77891e112eefffc005 upstream.

When the clocksource is not a multiple of HZ, the clock will be off.  For
acpi_pm, HZ=1000 the error is 127.111 ppm:

The rounding of cycle_interval ends up generating a false error term in
ntp_error accumulation since xtime_interval is not exactly 1/HZ.  So, we
subtract out the error caused by the rounding.

This has been visible since 2.6.32-rc2
commit a092ff0f90cae22b2ac8028ecd2c6f6c1a9e4601
time: Implement logarithmic time accumulation
That commit raised NTP_INTERVAL_FREQ and exposed the rounding error.

testing tool: http://n1.taur.dk/permanent/testpmt.c
Also tested with ntpd and a frequency counter.

Signed-off-by: Kasper Pedersen <kkp2010@kasperkp.dk>
Acked-by: john stultz <johnstul@us.ibm.com>
Cc: John Kacur <jkacur@redhat.com>
Cc: Clark Williams <williams@redhat.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Will Tisdale <willtisdale@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
kernel/time/timekeeping.c