All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jaswinder Singh Rajput <jaswinder@kernel.org>
To: mingo@redhat.com, hpa@zytor.com, linux-kernel@vger.kernel.org,
	henrix@sapo.pt, tglx@linutronix.de
Cc: linux-tip-commits@vger.kernel.org
Subject: Re: [tip:irq/genirq] genirq: do not execute DEBUG_SHIRQ when irq setup failed
Date: Thu, 02 Apr 2009 20:02:27 +0530	[thread overview]
Message-ID: <1238682747.3099.16.camel@ht.satnam> (raw)
In-Reply-To: <tip-ba71604fad348656071a2a76eef9a67dab85a773@git.kernel.org>

On Thu, 2009-04-02 at 14:03 +0000, Luis Henriques wrote:
> Commit-ID:  ba71604fad348656071a2a76eef9a67dab85a773
> Gitweb:     http://git.kernel.org/tip/ba71604fad348656071a2a76eef9a67dab85a773
> Author:     Luis Henriques <henrix@sapo.pt>
> AuthorDate: Wed, 1 Apr 2009 18:06:35 +0100
> Committer:  Thomas Gleixner <tglx@linutronix.de>
> CommitDate: Thu, 2 Apr 2009 16:02:39 +0200
> 
> genirq: do not execute DEBUG_SHIRQ when irq setup failed
> 
> When requesting an IRQ, the DEBUG_SHIRQ code executes a fake IRQ just to make
> sure the driver is ready to receive an IRQ immediately.  The problem was that
> this fake IRQ was being executed even if interrupt line failed to be allocated
> by __setup_irq.
> 
> Signed-off-by: Luis Henriques <henrix@sapo.pt>
> LKML-Reference: <20090401170635.GA4392@hades.domain.com>
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> 
> 
> ---
>  kernel/irq/manage.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
> index 1516ab7..beeb7d1 100644
> --- a/kernel/irq/manage.c
> +++ b/kernel/irq/manage.c
> @@ -768,7 +768,7 @@ int request_irq(unsigned int irq, irq_handler_t handler,
>  		kfree(action);
>  
>  #ifdef CONFIG_DEBUG_SHIRQ
> -	if (irqflags & IRQF_SHARED) {
> +	if (!retval & (irqflags & IRQF_SHARED)) {
>  		/*
>  		 * It's a shared IRQ -- the driver ought to be prepared for it
>  		 * to happen immediately, so let's make sure....

What is this ?

There is no retval:

http://git.kernel.org/?p=linux/kernel/git/x86/linux-2.6-tip.git;a=blob;f=kernel/irq/manage.c;h=a3eb7baf1e46f2c735edb4cc44e0386cfbc4989e;hb=HEAD

*/
696 static struct irqaction *__free_irq(unsigned int irq, void *dev_id)
697 {
698         struct irq_desc *desc = irq_to_desc(irq);
699         struct irqaction *action, **action_ptr;
700         struct task_struct *irqthread;
701         unsigned long flags;
702 
703         WARN(in_interrupt(), "Trying to free IRQ %
d from IRQ context!\n", irq);
704 
705         if (!desc)
706                 return NULL;
707 
708         spin_lock_irqsave(&desc->lock, flags);
709 
710         /*
711
         * There can be multiple actions per IRQ descriptor, find the right
712          * one based on the dev_id:
713          */
714         action_ptr = &desc->action;
715         for (;;) {
716                 action = *action_ptr;
717 
718                 if (!action) {
719                         WARN(1, "Trying to free already-free IRQ %d
\n", irq);
720                         spin_unlock_irqrestore(&desc->lock, flags);
721 
722                         return NULL;
723                 }
724 
725                 if (action->dev_id == dev_id)
726                         break;
727                 action_ptr = &action->next;
728         }
729 
730         /* Found it - now remove it from the list of entries: */
731         *action_ptr = action->next;
732 
733         /* Currently used only by UML, might disappear one day: */
734 #ifdef CONFIG_IRQ_RELEASE_METHOD
735         if (desc->chip->release)
736                 desc->chip->release(irq, dev_id);
737 #endif
738 
739         /* If this was the last handler, shut down the IRQ line: */
740         if (!desc->action) {
741                 desc->status |= IRQ_DISABLED;
742                 if (desc->chip->shutdown)
743                         desc->chip->shutdown(irq);
744                 else
745                         desc->chip->disable(irq);
746         }
747 
748         irqthread = action->thread;
749         action->thread = NULL;
750 
751         spin_unlock_irqrestore(&desc->lock, flags);
752 
753         unregister_handler_proc(irq, action);
754 
755         /* Make sure it's not being used on another CPU: */
756         synchronize_irq(irq);
757 
758         if (irqthread) {
759                 if (!test_bit(IRQTF_DIED, &action->thread_flags))
760                         kthread_stop(irqthread);
761                 put_task_struct(irqthread);
762         }
763 
764 #ifdef CONFIG_DEBUG_SHIRQ
765         /*
766
         * It's a shared IRQ -- the driver ought to be prepared for an IRQ
767
         * event to happen even now it's being freed, so let's make sure that
768          * is so by doing an extra call to the handler ....
769          *
770
         * ( We do this after actually deregistering it, to make sure that a
771          *   'real' IRQ doesn't run in * parallel with our fake. )
772          */
773         if (action->flags & IRQF_SHARED) {
774                 local_irq_save(flags);
775                 action->handler(irq, dev_id);
776                 local_irq_restore(flags);
777         }
778 #endif
779         return action;
780 }



  reply	other threads:[~2009-04-02 14:33 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-01 17:06 [RESEND][PATCH -tip] irq: DEBUG_SHIRQ executed on irq setup failure Luis Henriques
2009-04-02 14:03 ` [tip:irq/genirq] genirq: do not execute DEBUG_SHIRQ when irq setup failed Luis Henriques
2009-04-02 14:32   ` Jaswinder Singh Rajput [this message]
2009-04-02 15:21     ` Thomas Gleixner
2009-04-02 15:41       ` Jaswinder Singh Rajput
2009-04-02 16:08         ` Thomas Gleixner
2009-04-02 16:20           ` Jaswinder Singh Rajput
2009-04-02 16:38             ` Thomas Gleixner
2009-04-02 16:45               ` Jaswinder Singh Rajput
2009-04-02 17:16                 ` Luis Henriques
2009-04-02 17:32             ` Ingo Molnar
2009-04-02 17:46               ` Jaswinder Singh Rajput
2009-04-02 18:01                 ` Ingo Molnar
2009-04-23  6:48 ` tip-bot for Luis Henriques

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=1238682747.3099.16.camel@ht.satnam \
    --to=jaswinder@kernel.org \
    --cc=henrix@sapo.pt \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@redhat.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.