public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH]Timer list init is done AFTER use
@ 2002-12-20  8:43 george anzinger
  2002-12-20 10:26 ` Andrew Morton
  0 siblings, 1 reply; 9+ messages in thread
From: george anzinger @ 2002-12-20  8:43 UTC (permalink / raw)
  To: linux-kernel@vger.kernel.org, Linus Torvalds

[-- Attachment #1: Type: text/plain, Size: 901 bytes --]

On SMP systems the timer list init is done by way of a
cpu_notifier call.  This has two problems:

1.) Timers are started WAY before the cpu_notifier call
chain is executed.  In particular the console blanking timer
is deleted and inserted every time printk() is called.  That
this does not fail is only because the kernel has yet to
protect location zero.

2.) This notifier is called when a cpu comes up.  I suspect
that initializing the timer list when a hot swap of a cpu is
done is NOT the right thing to do.  In any case, if this is
a desired action, the list still needs to be initialized
prior to its use.

The attached patch initializes all the timer lists at
init_timers time and does not put code in the notify list.
--
George Anzinger   george@mvista.com
High-res-timers: 
http://sourceforge.net/projects/high-res-timers/
Preemption patch:
http://www.kernel.org/pub/linux/kernel/people/rml

[-- Attachment #2: timer-init-fix.patch --]
[-- Type: text/plain, Size: 1027 bytes --]

--- linux-2.5.52-bk4-org/kernel/timer.c~	Thu Dec 19 12:13:18 2002
+++ linux/kernel/timer.c	Fri Dec 20 00:38:15 2002
@@ -1150,7 +1150,7 @@
 	return 0;
 }
 
-static void __devinit init_timers_cpu(int cpu)
+static void __init init_timers_cpu(int cpu)
 {
 	int j;
 	tvec_base_t *base;
@@ -1167,29 +1167,12 @@
 		INIT_LIST_HEAD(base->tv1.vec + j);
 }
 	
-static int __devinit timer_cpu_notify(struct notifier_block *self, 
-				unsigned long action, void *hcpu)
-{
-	long cpu = (long)hcpu;
-	switch(action) {
-	case CPU_UP_PREPARE:
-		init_timers_cpu(cpu);
-		break;
-	default:
-		break;
-	}
-	return NOTIFY_OK;
-}
-
-static struct notifier_block __devinitdata timers_nb = {
-	.notifier_call	= timer_cpu_notify,
-};
-
 
 void __init init_timers(void)
 {
-	timer_cpu_notify(&timers_nb, (unsigned long)CPU_UP_PREPARE,
-				(void *)(long)smp_processor_id());
-	register_cpu_notifier(&timers_nb);
+	int cpu;
+	for (cpu = 0; cpu < NR_CPUS; cpu++){
+		init_timers_cpu(cpu);
+	}
 	open_softirq(TIMER_SOFTIRQ, run_timer_softirq, NULL);
 }


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2002-12-22 21:06 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-12-20  8:43 [PATCH]Timer list init is done AFTER use george anzinger
2002-12-20 10:26 ` Andrew Morton
2002-12-20 17:18   ` george anzinger
2002-12-20 19:34     ` Andrew Morton
2002-12-20 20:01       ` george anzinger
2002-12-20 20:31         ` Andrew Morton
2002-12-22  8:38         ` Andrew Morton
2002-12-22  9:58           ` george anzinger
2002-12-22 21:14           ` Martin J. Bligh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox