linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: george anzinger <george@mvista.com>
To: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Linus Torvalds <torvalds@transmeta.com>
Subject: [PATCH]Timer list init is done AFTER use
Date: Fri, 20 Dec 2002 00:43:11 -0800	[thread overview]
Message-ID: <3E02D81F.13A5A59D@mvista.com> (raw)

[-- 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);
 }


             reply	other threads:[~2002-12-20  8:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-20  8:43 george anzinger [this message]
2002-12-20 10:26 ` [PATCH]Timer list init is done AFTER use 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3E02D81F.13A5A59D@mvista.com \
    --to=george@mvista.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).