Name: Debug Too-Early Use of softirqs Status: Untested diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .31025-linux-2.6.6-rc2-bk4/kernel/softirq.c .31025-linux-2.6.6-rc2-bk4.updated/kernel/softirq.c --- .31025-linux-2.6.6-rc2-bk4/kernel/softirq.c 2004-04-22 08:04:01.000000000 +1000 +++ .31025-linux-2.6.6-rc2-bk4.updated/kernel/softirq.c 2004-04-27 13:21:57.000000000 +1000 @@ -190,14 +190,18 @@ struct tasklet_head /* Some compilers disobey section attribute on statics when not initialized -- RR */ -static DEFINE_PER_CPU(struct tasklet_head, tasklet_vec) = { NULL }; -static DEFINE_PER_CPU(struct tasklet_head, tasklet_hi_vec) = { NULL }; +static DEFINE_PER_CPU(struct tasklet_head, tasklet_vec) = { (void *)1 }; +static DEFINE_PER_CPU(struct tasklet_head, tasklet_hi_vec) = { (void *)1 }; void fastcall __tasklet_schedule(struct tasklet_struct *t) { unsigned long flags; local_irq_save(flags); + if (__get_cpu_var(tasklet_vec).list == (void *)1) { + WARN_ON(1); + __get_cpu_var(tasklet_vec).list = NULL; + } t->next = __get_cpu_var(tasklet_vec).list; __get_cpu_var(tasklet_vec).list = t; raise_softirq_irqoff(TASKLET_SOFTIRQ); @@ -211,6 +215,10 @@ void fastcall __tasklet_hi_schedule(stru unsigned long flags; local_irq_save(flags); + if (__get_cpu_var(tasklet_hi_vec).list == (void *)1) { + WARN_ON(1); + __get_cpu_var(tasklet_hi_vec).list = NULL; + } t->next = __get_cpu_var(tasklet_hi_vec).list; __get_cpu_var(tasklet_hi_vec).list = t; raise_softirq_irqoff(HI_SOFTIRQ); @@ -423,8 +431,8 @@ static int __devinit cpu_callback(struct switch (action) { case CPU_UP_PREPARE: - BUG_ON(per_cpu(tasklet_vec, hotcpu).list); - BUG_ON(per_cpu(tasklet_hi_vec, hotcpu).list); + per_cpu(tasklet_vec, hotcpu).list = NULL; + per_cpu(tasklet_hi_vec, hotcpu).list = NULL; p = kthread_create(ksoftirqd, hcpu, "ksoftirqd/%d", hotcpu); if (IS_ERR(p)) { printk("ksoftirqd for %i failed\n", hotcpu);