@@ -125,6 +125,13 @@ static u64 suspend_start;
125
125
*
126
126
* The default of 500 parts per million is based on NTP's limits.
127
127
* If a clocksource is good enough for NTP, it is good enough for us!
128
+ *
129
+ * In other words, by default, even if a clocksource is extremely
130
+ * precise (for example, with a sub-nanosecond period), the maximum
131
+ * permissible skew between the clocksource watchdog and the clocksource
132
+ * under test is not permitted to go below the 500ppm minimum defined
133
+ * by MAX_SKEW_USEC. This 500ppm minimum may be overridden using the
134
+ * CLOCKSOURCE_WATCHDOG_MAX_SKEW_US Kconfig option.
128
135
*/
129
136
#ifdef CONFIG_CLOCKSOURCE_WATCHDOG_MAX_SKEW_US
130
137
#define MAX_SKEW_USEC CONFIG_CLOCKSOURCE_WATCHDOG_MAX_SKEW_US
@@ -1146,14 +1153,19 @@ void __clocksource_update_freq_scale(struct clocksource *cs, u32 scale, u32 freq
1146
1153
}
1147
1154
1148
1155
/*
1149
- * If the uncertainty margin is not specified, calculate it.
1150
- * If both scale and freq are non-zero, calculate the clock
1151
- * period, but bound below at 2*WATCHDOG_MAX_SKEW. However,
1152
- * if either of scale or freq is zero, be very conservative and
1153
- * take the tens-of-milliseconds WATCHDOG_THRESHOLD value for the
1154
- * uncertainty margin. Allow stupidly small uncertainty margins
1155
- * to be specified by the caller for testing purposes, but warn
1156
- * to discourage production use of this capability.
1156
+ * If the uncertainty margin is not specified, calculate it. If
1157
+ * both scale and freq are non-zero, calculate the clock period, but
1158
+ * bound below at 2*WATCHDOG_MAX_SKEW, that is, 500ppm by default.
1159
+ * However, if either of scale or freq is zero, be very conservative
1160
+ * and take the tens-of-milliseconds WATCHDOG_THRESHOLD value
1161
+ * for the uncertainty margin. Allow stupidly small uncertainty
1162
+ * margins to be specified by the caller for testing purposes,
1163
+ * but warn to discourage production use of this capability.
1164
+ *
1165
+ * Bottom line: The sum of the uncertainty margins of the
1166
+ * watchdog clocksource and the clocksource under test will be at
1167
+ * least 500ppm by default. For more information, please see the
1168
+ * comment preceding CONFIG_CLOCKSOURCE_WATCHDOG_MAX_SKEW_US above.
1157
1169
*/
1158
1170
if (scale && freq && !cs -> uncertainty_margin ) {
1159
1171
cs -> uncertainty_margin = NSEC_PER_SEC / (scale * freq );
0 commit comments