Re: [patch] ia64: use generic_handle_irq()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2006-11-15 at 02:08, Eric W. Biederman wrote:
> Ingo Molnar <[email protected]> writes:
> 
> > * Andrew Morton <[email protected]> wrote:
> >
> >> On Tue, 14 Nov 2006 17:08:10 +0800
> >> "Zhang, Yanmin" <[email protected]> wrote:
> >> 
> >> > I got an oops when booting 2.6.19-rc5-mm1 on my ia64 machine.
> >> > 
> >> > 
> >> > The root cause is that some irq_chip variables, especially ia64_msi_chip,
> >> > initiate their memeber end to point to NULL. __do_IRQ doesn't check
> >> > if irq_chip->end is null and just calls it after processing the interrupt.
> >> > 
> >> > As irq_chip->end is called at many places, so I fix it by reinitiating
> >> > irq_chip->end to dummy_irq_chip.end, e.g., a noop function.
> >> > 
> >> > Below patch against 2.6.19-rc5-mm1 fixes it.
> >> > 
> >> > Signed-off-by: Zhang Yanmin <[email protected]>
> >> > 
> >> > ---
> >> > 
> >> > --- linux-2.6.19-rc5-mm1/kernel/irq/chip.c 2006-11-14 14:16:16.000000000
> > +0800
> >> > +++ linux-2.6.19-rc5-mm1_fix/kernel/irq/chip.c 2006-11-14 14:14:25.000000000
> > +0800
> >> > @@ -233,6 +233,8 @@ void irq_chip_set_defaults(struct irq_ch
> >> >  		chip->shutdown = chip->disable;
> >> >  	if (!chip->name)
> >> >  		chip->name = chip->typename;
> >> > +	if (!chip->end)
> >> > +		chip->end = dummy_irq_chip.end;
> >> >  }
> >> >  
> >> 
> >> The same bug should be hitting in mainline, shouldn't it?
> >
> > correct.
> >
> > this bug comes from a 'mixed' IRQ setup on ia64: half of it is still 
> > old-style, half of it (the MSI stuff) is new-style irqchip code. But the 
> > ia64 lowlevel code unconditionally calls __do_IRQ(), which is a bug.
> 
> Now that we hare half converted yes it is a bug.
> 
> > the genirq code has all the right helpers for such a mixed situation: so 
> > a better fix might be the one below: use generic_handle_irq() instead of 
> > unconditionally calling into __do_IRQ(). But i have not tested it - 
> > Yanmin, can you confirm this too fixes your bug?
> >
> > similarly, any architecture that makes use of the new generic MSI 
> > infrastructure should not be calling __do_IRQ() directly. (but i'm not 
> > aware of any other besides ia64 - i386 and x86_64 is now fully irq-chip 
> > converted.)
> >
> > Eric, do you agree?
> >
> 
> This is true in practice.  It isn't necessarily true, as all of irq_chip
> structures are arch specific.  It would be silly to start using msi interrupts
> without converting to genirq though.  So I think this covers it for ia64.
> 
> Your patch only fixes 2 spots and there is a third in irq_ia64.c that
> needs to be fixed as well.  At least in linus's tree.
Based on Eric's comments, I added a new change into Ingo's patch, and tested
on my ia64 machine. It does fix the bug and works well. I still think
my original patch to initilate null end to dummy_irq_chip.end is useful, at
least to prevent potential errors.

---

--- linux-2.6.19-rc5-mm1/arch/ia64/kernel/irq.c	2006-11-14 14:16:12.000000000 +0800
+++ linux-2.6.19-rc5-mm1_fix/arch/ia64/kernel/irq.c	2006-11-15 09:56:01.000000000 +0800
@@ -197,7 +197,7 @@ void fixup_irqs(void)
 			struct pt_regs *old_regs = set_irq_regs(NULL);
 
 			vectors_in_migration[irq]=0;
-			__do_IRQ(irq);
+			generic_handle_irq(irq);
 			set_irq_regs(old_regs);
 		}
 	}
--- linux-2.6.19-rc5-mm1/arch/ia64/kernel/irq_ia64.c	2006-11-14 14:16:12.000000000 +0800
+++ linux-2.6.19-rc5-mm1_fix/arch/ia64/kernel/irq_ia64.c	2006-11-15 09:56:51.000000000 +0800
@@ -186,7 +186,7 @@ ia64_handle_irq (ia64_vector vector, str
 			ia64_setreg(_IA64_REG_CR_TPR, vector);
 			ia64_srlz_d();
 
-			__do_IRQ(local_vector_to_irq(vector));
+			generic_handle_irq(local_vector_to_irq(vector));
 
 			/*
 			 * Disable interrupts and send EOI:
@@ -242,7 +242,7 @@ void ia64_process_pending_intr(void)
 			 * Probably could shared code.
 			 */
 			vectors_in_migration[local_vector_to_irq(vector)]=0;
-			__do_IRQ(local_vector_to_irq(vector));
+			generic_handle_irq(local_vector_to_irq(vector));
 			set_irq_regs(old_regs);
 
 			/*
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux