Skip to contentSkip to conversation

clocksource: Defer override invalidation unless clock is unstable

PATCH Superseded Kyle Walker 1 participant 1 message Jul 13, 2016 Timekeeping, clocksource core, NTP, alarmtimer

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 clocksource: Defer override invalidation unless clock is unstable

The clock_select() operation will attempt to use the clocksource override to apply the desired clocksource when the "clocksource=" boot parameter is supplied. However, in the event that "clocksource=tsc" is used on a system where there is a more desireable clocksource available, the boot parameter fails. This is due to the TSC clocksource being installed unvalidated, but the override being invalidated during the initial run through clocksource_done_booting().

To address this condition, the override_name is only invalidated for unstable clocksources. Otherwise, the override is left intact until after the watchdog has validated the clocksource as stable/unstable.

---
 kernel/time/clocksource.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
kernel/time/clocksource.c +12 -3
index 56ece14..4c1bb2a 100644
@@ -600,9 +600,18 @@ static void __clocksource_select(bool skipcur)
 		 */
 		if (!(cs->flags & CLOCK_SOURCE_VALID_FOR_HRES) && oneshot) {
 			/* Override clocksource cannot be used. */
-			pr_warn("Override clocksource %s is not HRT compatible - cannot switch while in HRT/NOHZ mode\n",
-				cs->name);
-			override_name[0] = 0;
+			if (cs->flags & CLOCK_SOURCE_UNSTABLE) {
+				pr_warn("Override clocksource %s is unstable and not HRT compatible - cannot switch while in HRT/NOHZ mode\n",
+					cs->name);
+				override_name[0] = 0;
+			} else {
+				/*
+				 * The override cannot be currently verified.
+				 * Deferring to let the watchdog check.
+				 */
+				pr_info("Override clocksource %s is not currently HRT compatible - deferring\n",
+					cs->name);
+			}
 		} else
 			/* Override clocksource can be used. */
 			best = cs;
Signature · 1 line
2.5.5