aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/timex.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/timex.h')
-rw-r--r--include/linux/timex.h45
1 files changed, 34 insertions, 11 deletions
diff --git a/include/linux/timex.h b/include/linux/timex.h
index aa3475fcff64..e6967d10d9e5 100644
--- a/include/linux/timex.h
+++ b/include/linux/timex.h
@@ -170,17 +170,37 @@ struct timex {
170#include <asm/timex.h> 170#include <asm/timex.h>
171 171
172/* 172/*
173 * SHIFT_KG and SHIFT_KF establish the damping of the PLL and are chosen 173 * SHIFT_PLL is used as a dampening factor to define how much we
174 * for a slightly underdamped convergence characteristic. SHIFT_KH 174 * adjust the frequency correction for a given offset in PLL mode.
175 * establishes the damping of the FLL and is chosen by wisdom and black 175 * It also used in dampening the offset correction, to define how
176 * art. 176 * much of the current value in time_offset we correct for each
177 * second. Changing this value changes the stiffness of the ntp
178 * adjustment code. A lower value makes it more flexible, reducing
179 * NTP convergence time. A higher value makes it stiffer, increasing
180 * convergence time, but making the clock more stable.
177 * 181 *
178 * MAXTC establishes the maximum time constant of the PLL. With the 182 * In David Mills' nanokernel reference implementation SHIFT_PLL is 4.
179 * SHIFT_KG and SHIFT_KF values given and a time constant range from 183 * However this seems to increase convergence time much too long.
180 * zero to MAXTC, the PLL will converge in 15 minutes to 16 hours, 184 *
181 * respectively. 185 * https://lists.ntp.org/pipermail/hackers/2008-January/003487.html
186 *
187 * In the above mailing list discussion, it seems the value of 4
188 * was appropriate for other Unix systems with HZ=100, and that
189 * SHIFT_PLL should be decreased as HZ increases. However, Linux's
190 * clock steering implementation is HZ independent.
191 *
192 * Through experimentation, a SHIFT_PLL value of 2 was found to allow
193 * for fast convergence (very similar to the NTPv3 code used prior to
194 * v2.6.19), with good clock stability.
195 *
196 *
197 * SHIFT_FLL is used as a dampening factor to define how much we
198 * adjust the frequency correction for a given offset in FLL mode.
199 * In David Mills' nanokernel reference implementation SHIFT_FLL is 2.
200 *
201 * MAXTC establishes the maximum time constant of the PLL.
182 */ 202 */
183#define SHIFT_PLL 4 /* PLL frequency factor (shift) */ 203#define SHIFT_PLL 2 /* PLL frequency factor (shift) */
184#define SHIFT_FLL 2 /* FLL frequency factor (shift) */ 204#define SHIFT_FLL 2 /* FLL frequency factor (shift) */
185#define MAXTC 10 /* maximum time constant (shift) */ 205#define MAXTC 10 /* maximum time constant (shift) */
186 206
@@ -192,10 +212,10 @@ struct timex {
192#define SHIFT_USEC 16 /* frequency offset scale (shift) */ 212#define SHIFT_USEC 16 /* frequency offset scale (shift) */
193#define PPM_SCALE ((s64)NSEC_PER_USEC << (NTP_SCALE_SHIFT - SHIFT_USEC)) 213#define PPM_SCALE ((s64)NSEC_PER_USEC << (NTP_SCALE_SHIFT - SHIFT_USEC))
194#define PPM_SCALE_INV_SHIFT 19 214#define PPM_SCALE_INV_SHIFT 19
195#define PPM_SCALE_INV ((1ll << (PPM_SCALE_INV_SHIFT + NTP_SCALE_SHIFT)) / \ 215#define PPM_SCALE_INV ((1LL << (PPM_SCALE_INV_SHIFT + NTP_SCALE_SHIFT)) / \
196 PPM_SCALE + 1) 216 PPM_SCALE + 1)
197 217
198#define MAXPHASE 500000000l /* max phase error (ns) */ 218#define MAXPHASE 500000000L /* max phase error (ns) */
199#define MAXFREQ 500000 /* max frequency error (ns/s) */ 219#define MAXFREQ 500000 /* max frequency error (ns/s) */
200#define MAXFREQ_SCALED ((s64)MAXFREQ << NTP_SCALE_SHIFT) 220#define MAXFREQ_SCALED ((s64)MAXFREQ << NTP_SCALE_SHIFT)
201#define MINSEC 256 /* min interval between updates (s) */ 221#define MINSEC 256 /* min interval between updates (s) */
@@ -260,6 +280,9 @@ extern int do_adjtimex(struct timex *);
260 280
261int read_current_timer(unsigned long *timer_val); 281int read_current_timer(unsigned long *timer_val);
262 282
283/* The clock frequency of the i8253/i8254 PIT */
284#define PIT_TICK_RATE 1193182ul
285
263#endif /* KERNEL */ 286#endif /* KERNEL */
264 287
265#endif /* LINUX_TIMEX_H */ 288#endif /* LINUX_TIMEX_H */