svn commit: r239320 - head/sys/kern
Warner Losh
imp at FreeBSD.org
Thu Aug 16 02:35:45 UTC 2012
Author: imp
Date: Thu Aug 16 02:35:44 2012
New Revision: 239320
URL: http://svn.freebsd.org/changeset/base/239320
Log:
Limit popcorn limit to something sane (either 2ns or 2 ticks if that's
longer).
PR: 156481
Submitted by: Ian Lepore
Modified:
head/sys/kern/kern_ntptime.c
Modified: head/sys/kern/kern_ntptime.c
==============================================================================
--- head/sys/kern/kern_ntptime.c Thu Aug 16 00:53:23 2012 (r239319)
+++ head/sys/kern/kern_ntptime.c Thu Aug 16 02:35:44 2012 (r239320)
@@ -832,8 +832,15 @@ hardpps(tsp, nsec)
* discarded. otherwise, if so enabled, the time offset is
* updated. We can tolerate a modest loss of data here without
* much degrading time accuracy.
- */
- if (u_nsec > (pps_jitter << PPS_POPCORN)) {
+ *
+ * The measurements being checked here were made with the system
+ * timecounter, so the popcorn threshold is not allowed to fall below
+ * the number of nanoseconds in two ticks of the timecounter. For a
+ * timecounter running faster than 1 GHz the lower bound is 2ns, just
+ * to avoid a nonsensical threshold of zero.
+ */
+ if (u_nsec > lmax(pps_jitter << PPS_POPCORN,
+ 2 * (NANOSECOND / (long)qmin(NANOSECOND, tc_getfrequency())))) {
time_status |= STA_PPSJITTER;
pps_jitcnt++;
} else if (time_status & STA_PPSTIME) {
More information about the svn-src-head
mailing list