Re: kernel/softirq.c issues under 2.6.5

From: Rusty Russell
Date: Mon Apr 26 2004 - 22:28:43 EST


On Sat, 2004-04-24 at 21:00, Zoltan Boszormenyi wrote:
> Hi,
>
> > On Tue, 2004-04-20 at 17:58, Aivils wrote:
> >> Hi all!
> >>
> >> My 2.6.5 will not start until i applay patch bellow:
...
> This changes caused that the linuxconsole.sf.net patch against
> newer kernels (>2.6.3) did not boot. The .config is
> from 2.6.6-rc2-mm1 + changes from linuxconsole.sf.net patch.
> Do you want the whole patch to investigate?

No, but the bug is probably that patch submitting a softirq before it's
initialized. This patch should find it: look for the backtrace.

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

--
Anyone who quotes me in their signature is an idiot -- Rusty Russell

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/