]> git.karo-electronics.de Git - linux-beck.git/commitdiff
clocksource: Defer override invalidation unless clock is unstable
authorKyle Walker <kwalker@redhat.com>
Sat, 6 Aug 2016 16:07:30 +0000 (12:07 -0400)
committerJohn Stultz <john.stultz@linaro.org>
Wed, 31 Aug 2016 21:43:33 +0000 (14:43 -0700)
Clocksources don't get the VALID_FOR_HRES flag until they have been
checked by a watchdog. However, when using an override, the
clocksource_select logic will clear the override value if the
clocksource is not marked VALID_FOR_HRES during that inititial check.
When using the boot arguments clocksource=<foo>, this selection can
run before the watchdog, and can cause the override to be incorrectly
cleared.

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.

Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Kyle Walker <kwalker@redhat.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
kernel/time/clocksource.c

index 6a5a310a1a5351205ef9bd633a39efa427897556..7e4fad75acaaddbac4d11ade83f6e14cc22aee8c 100644 (file)
@@ -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;