Re: [patch 1/6] hardirq: Make hardirq bits generic

From: Geert Uytterhoeven
Date: Mon Nov 04 2013 - 14:45:27 EST


Hi Thomas,

On Mon, 4 Nov 2013, Thomas Gleixner wrote:
> On Thu, 19 Sep 2013, Geert Uytterhoeven wrote:
> > However, the resulting kernel hangs (on ARAnyM) after starting userspace:
> >
> > | INIT: version 2.86 booting
> >
> > I'll have a deeper look when I have some more time...
>
> Any chance that you find some more time? :)

Sure!

But only if you look at "[m68k] IRQ: add handle_polled_irq() for timer
based soft interrupt" (http://www.spinics.net/lists/linux-m68k/msg05889.html)
first ;-)

Below is a patch with some fixups, on top of your two patches.

Unfortunately it still hangs somewhere after mounting the root filesystem.

Using this debug code for do_IRQ():

diff --git a/arch/m68k/kernel/irq.c b/arch/m68k/kernel/irq.c
index aaf7b15fad41..da9687803d98 100644
--- a/arch/m68k/kernel/irq.c
+++ b/arch/m68k/kernel/irq.c
@@ -22,11 +22,21 @@ asmlinkage int do_IRQ(int irq, struct pt_regs *regs)
struct pt_regs *oldregs = set_irq_regs(regs);
int nested = regs->sr & ~ALLOWINT;

+static int nesting;
+const char prefix[] = " ";
+unsigned long flags;
+local_irq_save(flags);
+nesting++;
+printk("# %sirq %d nested %d\n", &prefix[16-2*nesting], irq, nested);
+local_irq_restore(flags);
irq_enter();
generic_handle_irq(irq);
irq_exit_nested(nested);

set_irq_regs(oldregs);
+local_irq_save(flags);
+nesting--;
+local_irq_restore(flags);
return nested;
}

I get output like

# irq 15 nested 0
# irq 15 nested 1024

irq 15 while irq 15 in progress??

# irq 15 nested 1024
# irq 15 nested 1024
# irq 15 nested 1024
# irq 13 nested 1024
# irq 13 nested 1024
# irq 13 nested 1024
# irq 13 nested 1024
# irq 13 nested 1024
# irq 4 nested 0
# irq 13 nested 1024
# irq 4 nested 0
# irq 13 nested 1024
# irq 4 nested 0
# irq 13 nested 1024
# irq 13 nested 1024
# irq 13 nested 1024
# irq 4 nested 0
# irq 13 nested 1024
# irq 13 nested 1024
# irq 13 nested 1024
# irq 13 nested 1024
# irq 13 nested 1024
# irq 13 nested 1024
# irq 13 nested 1024
# irq 4 nested 0
# irq 13 nested 1024
# irq 13 nested 1024

[...]

# irq 13 nested 1024
# irq 13 nested 1024
# irq 4 nested 0
# irq 13 nested 1024
# irq 4 nested 0

irq 4 while irq 4 in progress?

# irq 13 nested 1024
# irq 4 nested 0
# irq 13 nested 0

and then it stops printing anything.

With similar debug code on the old working do_IRQ(), I get
- slightly less deep nesting,
- do_IRQ() is never re-entered with the same irq number.

Also note that the value of "nested" doesn't match the indentation level,
which depends on my own bookkeeping using "nesting".

Anyone with an idea where it's going wrong?

Thanks!