Skip to contentSkip to conversation

Time: Delay clocksource selection until later in boot

PATCH In review john stultz 2 participants 3 messages Jan 17, 2006 Timekeeping, clocksource core, NTP, alarmtimer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Time: Delay clocksource selection until later in boot

Delay installing new clocksources until later in boot. This avoids some
of the clocksource churn that can occur at boot, possibly allowing the system to run for a brief time with a bad clocksource.

This patch resolves the boot time stalls seen by Mattia Dongili.

thanks
-john

kernel/time/clocksource.c +15 -1
@@ -51,13 +51,27 @@ static LIST_HEAD(clocksource_list);
 static DEFINE_SPINLOCK(clocksource_lock);
 static char override_name[32];
 
+static int finished_booting;
+
+/* clocksource_done_booting - Called near the end of bootup
+ *
+ * Hack to avoid lots of clocksource churn at boot time 
+ */
+static int clocksource_done_booting(void)
+{
+	finished_booting = 1;
+	return 0;
+}
+
+late_initcall(clocksource_done_booting);
+
 /**
  * get_next_clocksource - Returns the selected clocksource
  */
 struct clocksource *get_next_clocksource(void)
 {
 	spin_lock(&clocksource_lock);
-	if (next_clocksource) {
+	if (next_clocksource && finished_booting) {
 		curr_clocksource = next_clocksource;
 		next_clocksource = NULL;
 	}
#1 lore raw
Quoted 7 lines · john stultz

Delay installing new clocksources until later in boot. This avoids some
of the clocksource churn that can occur at boot, possibly allowing the system to run for a brief time with a bad clocksource.

This patch resolves the boot time stalls seen by Mattia Dongili.

Except he now thinks that it doesn't. Do you think the patch is good anyway?

#2 lore raw
Quoted 10 lines · Andrew Morton
Quoted 7 lines · john stultz

Delay installing new clocksources until later in boot. This avoids some
of the clocksource churn that can occur at boot, possibly allowing the system to run for a brief time with a bad clocksource.

This patch resolves the boot time stalls seen by Mattia Dongili.

Except he now thinks that it doesn't. Do you think the patch is good anyway?

I actually do still think its a good idea to avoid the bootup clocksource churn. I've still got a few ideas for further improving the TSC registration so I'll probably have another patch or two to try later this week.

thanks
-john