02 Feb, 2011
1 commit
-
This patch adds a new mode bit into the timex structure. When set, the bit
instructs the kernel to add the given time value to the current time.Signed-off-by: Richard Cochran
Acked-by: John Stultz
LKML-Reference:
Signed-off-by: Thomas Gleixner
14 Jan, 2011
1 commit
-
This commit adds hardpps() implementation based upon the original one from
the NTPv4 reference kernel code from David Mills. However, it is highly
optimized towards very fast syncronization and maximum stickness to PPS
signal. The typical error is less then a microsecond.To make it sync faster I had to throw away exponential phase filter so
that the full phase offset is corrected immediately. Then I also had to
throw away median phase filter because it gives a bigger error itself if
used without exponential filter.Maybe we will find an appropriate filtering scheme in the future but it's
not necessary if the signal quality is ok.Signed-off-by: Alexander Gordeev
Acked-by: John Stultz
Cc: Rodolfo Giometti
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
24 Mar, 2010
2 commits
-
There are zero users of tickadj. So remove it.
Signed-off-by: John Stultz
LKML-Reference:
Signed-off-by: Thomas Gleixner -
Now that no arches are accessing time_adjust directly,
make it static.Signed-off-by: John Stultz
LKML-Reference:
Signed-off-by: Thomas Gleixner
29 Jan, 2010
1 commit
-
Make time_esterror and time_maxerror static as no one uses them
outside of ntp.cSigned-off-by: John Stultz
Cc: richard@rsk.demon.co.uk
LKML-Reference:
Signed-off-by: Thomas Gleixner
09 Dec, 2009
1 commit
-
…el.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'timers-for-linus-ntp' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
ntp: Provide compability defines (You say MOD_NANO, I say ADJ_NANO)* 'irq-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
genirq: do not execute DEBUG_SHIRQ when irq setup failed
05 Oct, 2009
1 commit
-
Accumulating one tick at a time works well unless we're using NOHZ.
Then it can be an issue, since we may have to run through the loop
a few thousand times, which can increase timer interrupt caused
latency.The current solution was to accumulate in half-second intervals
with NOHZ. This kept the number of loops down, however it did
slightly change how we make NTP adjustments. While not an issue
with NTPd users, as NTPd makes adjustments over a longer period of
time, other adjtimex() users have noticed the half-second
granularity with which we can apply frequency changes to the clock.For instance, if a application tries to apply a 100ppm frequency
correction for 20ms to correct a 2us offset, with NOHZ they either
get no correction, or a 50us correction.Now, there will always be some granularity error for applying
frequency corrections. However with users sensitive to this error
have seen a 50-500x increase with NOHZ compared to running without
NOHZ.So I figured I'd try another approach then just simply increasing
the interval. My approach is to consume the time interval
logarithmically. This reduces the number of times through the loop
needed keeping latency down, while still preserving the original
granularity error for adjtimex() changes.Further, this change allows us to remove the xtime_cache code
(patch to follow), as xtime is always within one tick of the
current time, instead of the half-second updates it saw before.An earlier version of this patch has been shipping to x86 users in
the RedHat MRG releases for awhile without issue, but I've reworked
this version to be even more careful about avoiding possible
overflows if the shift value gets too large.Signed-off-by: John Stultz
Acked-by: Thomas Gleixner
Reviewed-by: John Kacur
Cc: Clark Williams
Cc: Martin Schwidefsky
Cc: Andrew Morton
LKML-Reference:
Signed-off-by: Ingo Molnar
28 Aug, 2009
1 commit
-
MOD_NANO, ADJ_NANO, MOD_NANO, ADJ_NANO!
Lets call the whole thing off!
But oh! If we call the whole thing off,
Then we must part.
And oh! If we ever part,
Then that might break my heart^H^H^H^Hclock!
So, if you like MOD_NANO and I like ADJ_NANO,
I'll include MOD_NANO and give up ADJ_NANO (not really!).
For we know we need each other,
So we better call the calling off off.
Let's call the whole thing off!The tumultuous NTP and Linux relationship has hit another snag: Ends
up NTPd still uses the "xntp 3.4 compatability names" and when the
STA_NANO value was added (along with ADJ_NANO), NTPd expected MOD_NANO
to be added and has apparently hit some build errors.Report to ntp hackers:
https://lists.ntp.org/pipermail/hackers/2009-August/004455.htmlRelated Bugs:
https://support.ntp.org/bugs/show_bug.cgi?id=1219
https://bugzilla.redhat.com/show_bug.cgi?id=505566So in an effort to make peace, here's a patch to help get things
building again. I also have updated the comment to make sure folks
don't think the MOD_* values are just legacy constants.Of course, NTPd really uses the glibc-headers, so those will need to
be similarly updated before things are working again (the RH bug above
should probably cover that).Thanks to Michael Tatarinov and Hal Murray for finding and reporting
the issue!Signed-off-by: John Stultz
Cc: Miroslav Lichvar
Cc: hmurray@megapathdsl.net
Cc: Ulrich Drepper
Cc: Michael Tatarinov
LKML-Reference:
Signed-off-by: Thomas Gleixner
17 Jun, 2009
1 commit
-
PIT_TICK_RATE is currently defined in four architectures, but in three
different places. While linux/timex.h is not the perfect place for it, it
is still a reasonable replacement for those drivers that traditionally use
asm/timex.h to get CLOCK_TICK_RATE and expect it to be the PIT frequency.Note that for Alpha, the actual value changed from 1193182UL to 1193180UL.
This is unlikely to make a difference, and probably can only improve
accuracy. There was a discussion on the correct value of CLOCK_TICK_RATE
a few years ago, after which every existing instance was getting changed
to 1193182. According to the specification, it should be
1193181.818181...Signed-off-by: Arnd Bergmann
Cc: Richard Henderson
Cc: Ivan Kokshaysky
Cc: Ralf Baechle
Cc: Benjamin Herrenschmidt
Cc: Ingo Molnar
Cc: Thomas Gleixner
Cc: "H. Peter Anvin"
Cc: Len Brown
Cc: john stultz
Cc: Dmitry Torokhov
Cc: Takashi Iwai
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
12 May, 2009
1 commit
-
Bernhard Schiffner noticed I had a few comment typos in this patch,
(note: to save embarrassment, when making typos, avoid copying and
pasting them) so this patch corrects them.[ Impact: cleanup ]
Reported-by: Bernhard Schiffner
Signed-off-by: John Stultz
Cc: riel@redhat.com
Cc: akpm@linux-foundation.org
LKML-Reference:
Signed-off-by: Ingo Molnar
06 May, 2009
1 commit
-
The conversion to the ntpv4 reference model
f19923937321244e7dc334767eb4b67e0e3d5c74 ("ntp: convert to the NTP4
reference model") in 2.6.19 added nanosecond resolution the adjtimex
interface, but also changed the "stiffness" of the frequency adjustments,
causing NTP convergence time to greatly increase.SHIFT_PLL, which reduces the stiffness of the freq adjustments, was
designed to be inversely linked to HZ, and the reference value of 4 was
designed for Unix systems using HZ=100. However Linux's clock steering
code mostly independent of HZ.So this patch reduces the SHIFT_PLL value from 4 to 2, which causes NTPd
behavior to match kernels prior to 2.6.19, greatly reducing convergence
times, and improving close synchronization through environmental thermal
changes.The patch also changes some l's to L's in nearby code to avoid misreading
50l as 501.[ Impact: tweak NTP algorithm for faster convergence ]
Signed-off-by: John Stultz
Acked-by: Rik van Riel
Cc: zippel@linux-m68k.org
Signed-off-by: Andrew Morton
LKML-Reference:
Signed-off-by: Ingo Molnar
26 Feb, 2009
1 commit
-
Impact: cleanup, no functionality changed
- make PPM_SCALE an explicit s64 constant, to
remove (s64) casts from usage sites.kernel/time/ntp.o:
text data bss dec hex filename
2536 114 136 2786 ae2 ntp.o.before
2536 114 136 2786 ae2 ntp.o.aftermd5:
40a7728d1188aa18e83e21a81fa7b150 ntp.o.before.asm
40a7728d1188aa18e83e21a81fa7b150 ntp.o.after.asmSigned-off-by: Ingo Molnar
13 Dec, 2008
1 commit
-
Impact: fix user-space exported use
Move all the kernel-specific defines and includes into the __KERNEL__
section so that they don't get leaked into userspace.[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Mike Frysinger
Signed-off-by: Andrew Morton
Signed-off-by: Thomas Gleixner
24 Sep, 2008
1 commit
-
Change PPM_SCALE_INV_SHIFT so that it doesn't throw away any input bits
(19 is the amount of the factor 2 in PPM_SCALE), the output frequency
can then be calculated back to its input value, as the inverse divide
produce a slightly larger value, which is then correctly rounded by the
final shift.Reported-by: Martin Ziegler
Signed-off-by: Roman Zippel
Cc: John Stultz
Signed-off-by: Andrew Morton
Signed-off-by: Thomas Gleixner
22 Aug, 2008
1 commit
-
Thanks to the review by Michael Kerrisk a bug in the recent
ADJ_OFFSET_SS_READ option was discovered, where the ntp time_offset was
inadvertently set by it. This fixes this by making the adjtime code
more separate from the ntp_adjtime code (both of which really want to
be separate syscalls).Signed-off-by: Roman Zippel
Signed-off-by: Andrew Morton
Acked-by: John Stultz
Signed-off-by: Ingo Molnar
01 May, 2008
7 commits
-
Remove the leap second handling from second_overflow(), which doesn't have to
check for it every second anymore. With CONFIG_NO_HZ this also makes sure the
leap second is handled close to the full second. Additionally this makes it
possible to abort a leap second properly by resetting the STA_INS/STA_DEL
status bits.Signed-off-by: Roman Zippel
Cc: john stultz
Cc: Thomas Gleixner
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
current_tick_length used to do a little more, but now it just returns
tick_length, which we can also access directly at the few places, where it's
needed.Signed-off-by: Roman Zippel
Cc: john stultz
Cc: Thomas Gleixner
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
As TICK_LENGTH_SHIFT is used for more than just the tick length, the name
isn't quite approriate anymore, so this renames it to NTP_SCALE_SHIFT.Signed-off-by: Roman Zippel
Cc: john stultz
Cc: Thomas Gleixner
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
This adds support for setting the TAI value (International Atomic Time). The
value is reported back to userspace via timex (as we don't have a
ntp_gettime() syscall).Signed-off-by: Roman Zippel
Cc: john stultz
Cc: Thomas Gleixner
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
time_offset is already a 64bit value but its resolution barely used, so this
makes better use of it by replacing SHIFT_UPDATE with TICK_LENGTH_SHIFT.Side note: the SHIFT_HZ in SHIFT_UPDATE was incorrect for CONFIG_NO_HZ and the
primary reason for changing time_offset to 64bit to avoid the overflow.Signed-off-by: Roman Zippel
Cc: john stultz
Cc: Thomas Gleixner
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
This changes time_freq to a 64bit value and makes it static (the only outside
user had no real need to modify it). Intermediate values were already 64bit,
so the change isn't that big, but it saves a little in shifts by replacing
SHIFT_NSEC with TICK_LENGTH_SHIFT. PPM_SCALE is then used to convert between
user space and kernel space representation.Signed-off-by: Roman Zippel
Cc: john stultz
Cc: Thomas Gleixner
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
This adds a few more things from the ntp nanokernel related to user space.
It's now possible to select the resolution used of some values via STA_NANO
and the kernel reports in which mode it works (pll/fll).If some values for adjtimex() are outside the acceptable range, they are now
simply normalized instead of letting the syscall fail. I removed
MOD_CLKA/MOD_CLKB as the mapping didn't really makes any sense, the kernel
doesn't support setting the clock.Signed-off-by: Roman Zippel
Cc: john stultz
Cc: Thomas Gleixner
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
09 Mar, 2008
1 commit
-
The first version of the ntp_interval/tick_length inconsistent usage patch was
recently merged as bbe4d18ac2e058c56adb0cd71f49d9ed3216a405http://git.kernel.org/gitweb.cgi?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=bbe4d18ac2e058c56adb0cd71f49d9ed3216a405
While the fix did greatly improve the situation, it was correctly pointed out
by Roman that it does have a small bug: If the users change clocksources after
the system has been running and NTP has made corrections, the correctoins made
against the old clocksource will be applied against the new clocksource,
causing error.The second attempt, which corrects the issue in the NTP_INTERVAL_LENGTH
definition has also made it up-stream as commit
e13a2e61dd5152f5499d2003470acf9c838eab84http://git.kernel.org/gitweb.cgi?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=e13a2e61dd5152f5499d2003470acf9c838eab84
Roman has correctly pointed out that CLOCK_TICK_ADJUST is calculated
based on the PIT's frequency, and isn't really relevant to non-PIT
driven clocksources (that is, clocksources other then jiffies and pit).This patch reverts both of those changes, and simply removes
CLOCK_TICK_ADJUST.This does remove the granularity error correction for users of PIT and Jiffies
clocksource users, but the granularity error but for the majority of users, it
should be within the 500ppm range NTP can accommodate for.For systems that have granularity errors greater then 500ppm, the
"ntp_tick_adj=" boot option can be used to compensate.[johnstul@us.ibm.com: provided changelog]
[mattilinnanvuori@yahoo.com: maek ntp_tick_adj static]
Signed-off-by: Roman Zippel
Acked-by: john stultz
Signed-off-by: Matti Linnanvuori
Signed-off-by: Andrew Morton
Cc: mingo@elte.hu
Signed-off-by: Thomas Gleixner
10 Feb, 2008
1 commit
-
clocksource initialization and error accumulation. This corrects a 280ppm
drift seen on some systems using acpi_pm, and affects other clocksources as
well (likely to a lesser degree).Signed-off-by: John Stultz
Cc: Roman Zippel
Cc: Steven Rostedt
Signed-off-by: Andrew Morton
Signed-off-by: Ingo Molnar
Signed-off-by: Thomas Gleixner
07 Feb, 2008
1 commit
-
- All implementations can be __devinit
- The function prototypes were in asm/timex.h but they all must be the same,
so create a single declaration in linux/timex.h.- uninline the sparc64 version to match the other architectures
- Don't bother #defining ARCH_HAS_READ_CURRENT_TIMER to a particular value.
[ezk@cs.sunysb.edu: fix build]
Cc: "David S. Miller"
Cc: Haavard Skinnemoen
Cc: Thomas Gleixner
Cc: Ingo Molnar
Cc: Andi Kleen
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
27 Nov, 2007
1 commit
-
Michael Kerrisk reported that a long standing bug in the adjtimex()
system call causes glibc's adjtime(3) function to deliver the wrong
results if 'delta' is NULL.add the ADJ_OFFSET_SS_READ API detail, which will be used by glibc
to fix this API compatibility bug.Also see: http://bugzilla.kernel.org/show_bug.cgi?id=6761
[ mingo@elte.hu: added patch description and made it backwards compatible ]
NOTE: the new flag is defined 0xa001 so that it returns -EINVAL on
older kernels - this way glibc can use it safely. Suggested by Ulrich
Drepper.Acked-by: Ulrich Drepper
Signed-off-by: Ingo Molnar
Signed-off-by: Thomas Gleixner
21 Jul, 2007
1 commit
-
Remove time_interpolator code (This is generic code, but
only user was ia64. It has been superseded by the
CONFIG_GENERIC_TIME code).Signed-off-by: Bob Picco
Signed-off-by: John Stultz
Signed-off-by: Peter Keilty
Signed-off-by: Tony Luck
17 Feb, 2007
1 commit
-
Distangle the NTP update from HZ. This is necessary for dynamic tick enabled
kernels.Cc: Thomas Gleixner
Cc: Ingo Molnar
Cc: john stultz
Cc: Roman Zippel
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
12 Feb, 2007
1 commit
-
The 32bit and 64bit PARISC Linux kernels suffers from the problem, that the
gettimeofday() call sometimes returns non-monotonic times.The easiest way to fix this, is to drop the PARISC-specific implementation
and switch over to the generic TIME_INTERPOLATION framework.But in order to make it even compile on 32bit PARISC, the patch below which
touches the generic Linux code, is mandatory.More information and the full patch with the parisc-specific changes is included in this thread: http://lists.parisc-linux.org/pipermail/parisc-linux/2006-December/031003.html
As far as I could see, this patch does not change anything for the existing
architectures which use this framework (IA64 and SPARC64), since "cycles_t"
is defined there as unsigned 64bit-integer anyway (which then makes this
patch a no-change for them).Signed-off-by: Helge Deller
Cc:
Cc: Thomas Gleixner
Cc: Ingo Molnar
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
06 Oct, 2006
1 commit
-
Provide a tickadj compatibility define for archs still using it.
Signed-off-by: Roman Zippel
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
01 Oct, 2006
9 commits
-
This patch contains the following possible cleanups:
- make the following needlessly global function static:
- ntp_update_frequency()
- make the following needlessly global variables static:
- time_state
- time_offset
- time_constant
- time_reftime
- remove the following read-only global variable:
- time_precisionSigned-off-by: Adrian Bunk
Cc: Roman Zippel
Cc: john stultz
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Remove a few unused defines and remove obsolete information from comments.
Signed-off-by: Roman Zippel
Cc: john stultz
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
This converts the kernel ntp model into a model which matches the nanokernel
reference implementations. The previous patches already increased the
resolution and precision of the computations, so that this conversion becomes
quite simple.explains:
The original NTP kernel interface was defined in units of microseconds.
That's what Linux implements. As computers have gotten faster and can now
split microseconds easily, a new kernel interface using nanosecond units was
defined ("the nanokernel", confusing as that name is to OS hackers), and
there's an STA_NANO bit in the adjtimex() status field to tell the application
which units it's using.The current ntpd supports both, but Linux loses some possible timing
resolution because of quantization effects, and the ntpd hackers would really
like to be able to drop the backwards compatibility code.Ulrich Windl has been maintaining a patch set to do the conversion for years,
but it's hard to keep in sync.Signed-off-by: Roman Zippel
Cc: john stultz
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
This converts time_freq to a scaled nsec value and adds around 6bit of extra
resolution. This pushes the time_freq to its 32bit limits so the calculatons
have to be done with 64bit.Signed-off-by: Roman Zippel
Cc: john stultz
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
time_tolerance isn't changed at all in the kernel, so simply remove it, this
simplifies the next patch, as it avoids a number of conversions.Signed-off-by: Roman Zippel
Cc: john stultz
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
This folds update_ntp_one_tick() into second_overflow() and adds time_adjust
to the tick length, this makes time_next_adjust unnecessary. This slightly
changes the adjtime() behaviour, instead of applying it to the next tick, it's
applied to the next second.Signed-off-by: Roman Zippel
Cc: john stultz
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
This converts time_offset into a scaled per tick value. This avoids now
completely the crude compensation in second_overflow().Signed-off-by: Roman Zippel
Cc: john stultz
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
This introduces ntp_update_frequency() and deinlines ntp_clear() (as it's not
performance critical). ntp_update_frequency() calculates the base tick length
using tick_usec and adds a base adjustment, in case the frequency doesn't
divide evenly by HZ.Signed-off-by: Roman Zippel
Cc: john stultz
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Move all the NTP related code to ntp.c
[akpm@osdl.org: cleanups, build fix]
Signed-off-by: John Stultz
Cc: Ingo Molnar
Cc: Roman Zippel
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
13 Sep, 2006
1 commit
-
There's useful stuff in but has nothing for
userspace. Stop exporting it, and include it only from within the existing
#ifdef __KERNEL__ part ofThis fixes a 'make headers_check' failure on i386 because asm-i386/timex.h
includes both asm-i386/tsc.h and asm-i386/processor.h, neither of which are
exported to userspace. It's not entirely clear _why_ it includes either of
these, but it does.Signed-off-by: David Woodhouse
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds