From: Thomas Gleixner <tglx@linutronix.de>
To: "Uwe Kleine-König" <Uwe.Kleine-Koenig@digi.com>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>
Subject: Re: [PATCH] let setup_irq reenable a shared irq
Date: Mon, 28 Apr 2008 15:03:29 +0200 (CEST) [thread overview]
Message-ID: <alpine.LFD.1.10.0804281443090.3261@apollo.tec.linutronix.de> (raw)
In-Reply-To: <1209381171-5520-1-git-send-email-Uwe.Kleine-Koenig@digi.com>
[-- Attachment #1: Type: TEXT/PLAIN, Size: 2129 bytes --]
On Mon, 28 Apr 2008, Uwe Kleine-König wrote:
> Consider two devices A and B sharing an irq and B already asserts the irq on
> a booting machine.
> If the driver for A is loaded first the irq starts triggering and gets
> disabled after some time by note_interrupt(). Later when the driver for B
> is loaded the interrupt should be reenabled---other wise both A and B don't
> work properly.
Oh no. There is lots of code in drivers, which does:
disable_irq();
do_some_protected_stuff();
enable_irq();
So when the second driver is loaded on another CPU it would see the
IRQ_DISABLED bit set and unconditionally reenable the interrupt.
This unprotects the protected operation and definitely triggers the
WARN_ON() in enable_irq() where we check for desc->depth == 0.
I can see the rationale for your patch, as we have no way to silence
stupid hardware or hardware which was left in that state by the BIOS
other than disabling the interrupt line completely.
Waht kind of scenario/devices do you have which trigger this ?
Thanks,
tglx
> Signed-off-by: Uwe Kleine-König <Uwe.Kleine-Koenig@digi.com>
> Cc: Ingo Molnar <mingo@elte.hu>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> ---
> kernel/irq/manage.c | 9 ++++++++-
> 1 files changed, 8 insertions(+), 1 deletions(-)
>
> diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
> index 438a014..831ebb2 100644
> --- a/kernel/irq/manage.c
> +++ b/kernel/irq/manage.c
> @@ -365,11 +365,18 @@ int setup_irq(unsigned int irq, struct irqaction *new)
>
> desc->status &= ~(IRQ_AUTODETECT | IRQ_WAITING |
> IRQ_INPROGRESS);
> + }
> +
> + /* in the shared case the interrupt might be disabled if a device
> + * asserts the irq but the corresponding driver wasn't the first to be
> + * loaded. So retry enabling the irq.
> + */
> + if (!shared || desc->status & IRQ_DISABLED) {
>
> if (!(desc->status & IRQ_NOAUTOEN)) {
> desc->depth = 0;
> desc->status &= ~IRQ_DISABLED;
> - if (desc->chip->startup)
> + if (!shared && desc->chip->startup)
> desc->chip->startup(irq);
> else
> desc->chip->enable(irq);
> --
> 1.5.5.1
>
next prev parent reply other threads:[~2008-04-28 13:03 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-28 11:12 Uwe Kleine-König
2008-04-28 13:03 ` Thomas Gleixner [this message]
2008-04-28 14:11 ` Uwe Kleine-König
2008-04-28 16:10 ` Thomas Gleixner
2008-04-29 13:08 ` Uwe Kleine-König
2008-04-29 16:23 ` Thomas Gleixner
2008-04-30 21:19 ` Eric W. Biederman
2008-04-30 21:36 ` Thomas Gleixner
[not found] <1209557398-8228-1-git-send-email-Uwe.Kleine-Koenig@digi.com>
2008-04-30 12:32 ` Thomas Gleixner
2008-04-30 12:38 ` Andrew Morton
2008-04-30 12:43 ` Thomas Gleixner
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=alpine.LFD.1.10.0804281443090.3261@apollo.tec.linutronix.de \
--to=tglx@linutronix.de \
--cc=Uwe.Kleine-Koenig@digi.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/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
all inboxes | Powered by JetHome®