linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paul Gortmaker <paul.gortmaker@windriver.com>
To: <raghu.prabhu13@gmail.com>
Cc: <jeremy@goop.org>, <mingo@redhat.com>, <x86@kernel.org>,
	Raghavendra D Prabhu <rprabhu@wnohang.net>,
	Thomas Gleixner <tglx@linutronix.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	liu chuansheng <chuansheng.liu@intel.com>,
	Fernando Luis Vazquez Cao <fernando@oss.ntt.co.jp>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] IRQ: Add a check for uninitialized irqs.
Date: Mon, 10 Sep 2012 09:41:49 -0400	[thread overview]
Message-ID: <504DEE1D.3040704@windriver.com> (raw)
In-Reply-To: <9250ef1afde6ddd2bab613bd847ad54adc014bac.1347218449.git.rprabhu@wnohang.net>

On 12-09-09 03:25 PM, raghu.prabhu13@gmail.com wrote:
> From: Raghavendra D Prabhu <rprabhu@wnohang.net>
> 
> Errors like "do_IRQ: 0.84 No Irq handler for vector (irq -1)" have been reported
> earlier filling up the console/logs. So this adds a condition to check for

Reported by who, and where, and on what hardware, and under what
circumstances?

You are adding another if statement to the hot path of do_IRQ just
to mask some random unknown symptom. instead of trying to understand
(and then solve) what the real breakage is.  Which is not the right
approach.

Paul.
--

> uninitialized irqs so that it exits early and doesn't proceed further. Also, irq
> is made a signed integer, since if it is not mapped to a vector, it will be
> assigned -1 which will be UINT_MAX otherwise.
> 
> Signed-off-by: Raghavendra D Prabhu <rprabhu@wnohang.net>
> ---
>  arch/x86/kernel/irq.c | 13 ++++++++-----
>  1 file changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c
> index d44f782..ddba63a 100644
> --- a/arch/x86/kernel/irq.c
> +++ b/arch/x86/kernel/irq.c
> @@ -184,21 +184,24 @@ unsigned int __irq_entry do_IRQ(struct pt_regs *regs)
>  
>  	/* high bit used in ret_from_ code  */
>  	unsigned vector = ~regs->orig_ax;
> -	unsigned irq;
> +	int irq;
>  
>  	irq_enter();
>  	exit_idle();
>  
> -	irq = __this_cpu_read(vector_irq[vector]);
> +	if (unlikely((irq = __this_cpu_read(vector_irq[vector])) == -1)) {
> +		pr_emerg_ratelimited("IRQ handler not setup for vector %u", vector);
> +		goto err_exit;
> +	}
>  
>  	if (!handle_irq(irq, regs)) {
>  		ack_APIC_irq();
>  
> -		if (printk_ratelimit())
> -			pr_emerg("%s: %d.%d No irq handler for vector (irq %d)\n",
> -				__func__, smp_processor_id(), vector, irq);
> +		pr_emerg_ratelimited("%s: %d.%d No irq handler for vector (irq %u)\n",
> +			__func__, smp_processor_id(), vector, irq);
>  	}
>  
> +err_exit:
>  	irq_exit();
>  
>  	set_irq_regs(old_regs);
> 

  reply	other threads:[~2012-09-10 13:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-09 19:25 [PATCH] IRQ: Add a check for uninitialized irqs raghu.prabhu13
2012-09-10 13:41 ` Paul Gortmaker [this message]
2012-09-15  2:55   ` Raghavendra D Prabhu

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=504DEE1D.3040704@windriver.com \
    --to=paul.gortmaker@windriver.com \
    --cc=chuansheng.liu@intel.com \
    --cc=fernando@oss.ntt.co.jp \
    --cc=hpa@zytor.com \
    --cc=jeremy@goop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=raghu.prabhu13@gmail.com \
    --cc=rprabhu@wnohang.net \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).