[kernel] r14054 - in dists/lenny/linux-2.6/debian: . patches/bugfix/all patches/series

Moritz Muehlenhoff jmm at alioth.debian.org
Thu Jul 30 19:11:06 UTC 2009


Author: jmm
Date: Thu Jul 30 19:11:03 2009
New Revision: 14054

Log:
NTP Adjust SHIFT_PLL to improve NTP convergence (Closes: #527968)

Added:
   dists/lenny/linux-2.6/debian/patches/bugfix/all/ntp-fix-convergence-regression.patch
Modified:
   dists/lenny/linux-2.6/debian/changelog
   dists/lenny/linux-2.6/debian/patches/series/18

Modified: dists/lenny/linux-2.6/debian/changelog
==============================================================================
--- dists/lenny/linux-2.6/debian/changelog	Thu Jul 30 17:35:55 2009	(r14053)
+++ dists/lenny/linux-2.6/debian/changelog	Thu Jul 30 19:11:03 2009	(r14054)
@@ -29,6 +29,7 @@
   * Fix support for AverMedia AverTV Cardbus Hybrid E506R (Closes: #511385)
   * ALSA: HDA patch_via.c: Fix inversion of surround and side channels
     (Closes: #538391)
+  * NTP Adjust SHIFT_PLL to improve NTP convergence (Closes: #527968)
 
   [ dann frazier ]
   * sata_nv: avoid link reset on controllers where it's broken

Added: dists/lenny/linux-2.6/debian/patches/bugfix/all/ntp-fix-convergence-regression.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/lenny/linux-2.6/debian/patches/bugfix/all/ntp-fix-convergence-regression.patch	Thu Jul 30 19:11:03 2009	(r14054)
@@ -0,0 +1,101 @@
+From: john stultz <johnstul at us.ibm.com>
+Date: Wed, 6 May 2009 09:43:57 +0000 (+0200)
+Subject: ntp: adjust SHIFT_PLL to improve NTP convergence
+X-Git-Tag: v2.6.31-rc1~329^2~1
+X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=22cfbbfd9f67b67fe073010f51cb71d3632387d5
+
+ntp: adjust SHIFT_PLL to improve NTP convergence
+
+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 <johnstul at us.ibm.com>
+Acked-by: Rik van Riel <riel at redhat.com>
+Cc: zippel at linux-m68k.org
+Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
+LKML-Reference: <200905051956.n45JuVo9025575 at imap1.linux-foundation.org>
+Signed-off-by: Ingo Molnar <mingo at elte.hu>
+---
+
+diff --git a/include/linux/timex.h b/include/linux/timex.h
+index aa3475f..0daf961 100644
+--- a/include/linux/timex.h
++++ b/include/linux/timex.h
+@@ -170,17 +170,37 @@ struct timex {
+ #include <asm/timex.h>
+ 
+ /*
+- * SHIFT_KG and SHIFT_KF establish the damping of the PLL and are chosen
+- * for a slightly underdamped convergence characteristic. SHIFT_KH
+- * establishes the damping of the FLL and is chosen by wisdom and black
+- * art.
++ * SHIFT_PLL is used as a dampening factor to define how much we
++ * adjust the frequency correction for a given offset in PLL mode.
++ * It also used in dampening the offset correction, to define how
++ * much of the current value in time_offset we correct for each
++ * second. Changing this value changes the stiffness of the ntp
++ * adjustment code. A lower value makes it more flexible, reducing
++ * NTP convergence time. A higher value makes it stiffer, increasing
++ * convergence time, but making the clock more stable.
+  *
+- * MAXTC establishes the maximum time constant of the PLL. With the
+- * SHIFT_KG and SHIFT_KF values given and a time constant range from
+- * zero to MAXTC, the PLL will converge in 15 minutes to 16 hours,
+- * respectively.
++ * In David Mills' nanokenrel reference implmentation SHIFT_PLL is 4.
++ * However this seems to increase convergence time much too long.
++ *
++ * https://lists.ntp.org/pipermail/hackers/2008-January/003487.html
++ *
++ * In the above mailing list discussion, it seems the value of 4
++ * was appropriate for other Unix systems with HZ=100, and that
++ * SHIFT_PLL should be decreased as HZ increases. However, Linux's
++ * clock steering implementation is HZ independent.
++ *
++ * Through experimentation, a SHIFT_PLL value of 2 was found to allow
++ * for fast convergence (very similar to the NTPv3 code used prior to
++ * v2.6.19), with good clock stability.
++ *
++ *
++ * SHIFT_FLL is used as a dampening factor to define how much we
++ * adjust the frequency correction for a given offset in FLL mode.
++ * In David Mills' nanokenrel reference implmentation SHIFT_PLL is 2.
++ *
++ * MAXTC establishes the maximum time constant of the PLL.
+  */
+-#define SHIFT_PLL	4	/* PLL frequency factor (shift) */
++#define SHIFT_PLL	2	/* PLL frequency factor (shift) */
+ #define SHIFT_FLL	2	/* FLL frequency factor (shift) */
+ #define MAXTC		10	/* maximum time constant (shift) */
+ 
+@@ -192,10 +212,10 @@ struct timex {
+ #define SHIFT_USEC 16		/* frequency offset scale (shift) */
+ #define PPM_SCALE ((s64)NSEC_PER_USEC << (NTP_SCALE_SHIFT - SHIFT_USEC))
+ #define PPM_SCALE_INV_SHIFT 19
+-#define PPM_SCALE_INV ((1ll << (PPM_SCALE_INV_SHIFT + NTP_SCALE_SHIFT)) / \
++#define PPM_SCALE_INV ((1LL << (PPM_SCALE_INV_SHIFT + NTP_SCALE_SHIFT)) / \
+ 		       PPM_SCALE + 1)
+ 
+-#define MAXPHASE 500000000l	/* max phase error (ns) */
++#define MAXPHASE 500000000L	/* max phase error (ns) */
+ #define MAXFREQ 500000		/* max frequency error (ns/s) */
+ #define MAXFREQ_SCALED ((s64)MAXFREQ << NTP_SCALE_SHIFT)
+ #define MINSEC 256		/* min interval between updates (s) */

Modified: dists/lenny/linux-2.6/debian/patches/series/18
==============================================================================
--- dists/lenny/linux-2.6/debian/patches/series/18	Thu Jul 30 17:35:55 2009	(r14053)
+++ dists/lenny/linux-2.6/debian/patches/series/18	Thu Jul 30 19:11:03 2009	(r14054)
@@ -14,3 +14,5 @@
 + bugfix/all/video-support-avertv-cardbus-hybrid-e506r.patch
 + bugfix/all/fbmon-work-around-compiler-bug.patch
 + bugfix/all/alsa-via-fix-inversion-of-sound-and-side-channels.patch
++ bugfix/all/ntp-fix-convergence-regression.patch
+



More information about the Kernel-svn-changes mailing list