public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
From: "Zhang, Yanmin" <yanmin_zhang@linux.intel.com>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Ingo Molnar <mingo@elte.hu>, Andrew Morton <akpm@osdl.org>,
	LKML <linux-kernel@vger.kernel.org>,
	"linux-ia64@vger.kernel.org" <linux-ia64@vger.kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [patch] ia64: use generic_handle_irq()
Date: Wed, 15 Nov 2006 02:26:36 +0000	[thread overview]
Message-ID: <1163557596.4311.76.camel@ymzhang-perf.sh.intel.com> (raw)
In-Reply-To: <m14pt1lx4j.fsf@ebiederm.dsl.xmission.com>

On Wed, 2006-11-15 at 02:08, Eric W. Biederman wrote:
> Ingo Molnar <mingo@elte.hu> writes:
> 
> > * Andrew Morton <akpm@osdl.org> wrote:
> >
> >> On Tue, 14 Nov 2006 17:08:10 +0800
> >> "Zhang, Yanmin" <yanmin_zhang@linux.intel.com> 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 <yanmin.zhang@intel.com>
> >> > 
> >> > ---
> >> > 
> >> > --- 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);
 
 			/*

      reply	other threads:[~2006-11-15  2:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-14  9:08 [PATCH] some irq_chip variables initiate end to point to NULL Zhang, Yanmin
2006-11-14 10:05 ` Andrew Morton
2006-11-14 12:46   ` [patch] ia64: use generic_handle_irq() Ingo Molnar
2006-11-14 18:08     ` Eric W. Biederman
2006-11-15  2:26       ` Zhang, Yanmin [this message]

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=1163557596.4311.76.camel@ymzhang-perf.sh.intel.com \
    --to=yanmin_zhang@linux.intel.com \
    --cc=akpm@osdl.org \
    --cc=ebiederm@xmission.com \
    --cc=linux-ia64@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    /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