LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Ralf Baechle <ralf@linux-mips.org>
To: Rob Landley <rob@landley.net>
Cc: linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org
Subject: [PATCH 1/2] IRQ_NOPROBE helper functions
Date: Tue, 29 Jan 2008 11:20:48 +0000	[thread overview]
Message-ID: <20080129112048.GA8665@linux-mips.org> (raw)
In-Reply-To: <20080129111622.GC7237@linux-mips.org>

Probing non-ISA interrupts using the handle_percpu_irq as their handle_irq
method may crash the system because handle_percpu_irq does not check
IRQ_WAITING.  This for example hits the MIPS Qemu configuration.

This patch provides two helper functions set_irq_noprobe and set_irq_probe
to set rsp. clear the IRQ_NOPROBE flag.  The only current caller is MIPS
code but this really belongs into generic code.

As an aside, interrupt probing these days has become a mostly obsolete if
not dangerous art.  I think Linux interrupts should be changed to default
to non-probing but that's subject of this patch.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

 include/linux/irq.h |    3 +++
 kernel/irq/chip.c   |   36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 39 insertions(+)

Index: linux-mips/include/linux/irq.h
===================================================================
--- linux-mips.orig/include/linux/irq.h
+++ linux-mips/include/linux/irq.h
@@ -367,6 +367,9 @@ set_irq_chained_handler(unsigned int irq
 	__set_irq_handler(irq, handle, 1, NULL);
 }
 
+extern void set_irq_noprobe(unsigned int irq);
+extern void set_irq_probe(unsigned int irq);
+
 /* Handle dynamic irq creation and destruction */
 extern int create_irq(void);
 extern void destroy_irq(unsigned int irq);
Index: linux-mips/kernel/irq/chip.c
===================================================================
--- linux-mips.orig/kernel/irq/chip.c
+++ linux-mips/kernel/irq/chip.c
@@ -589,3 +589,39 @@ set_irq_chip_and_handler_name(unsigned i
 	set_irq_chip(irq, chip);
 	__set_irq_handler(irq, handle, 0, name);
 }
+
+void __init set_irq_noprobe(unsigned int irq)
+{
+	struct irq_desc *desc;
+	unsigned long flags;
+
+	if (irq >= NR_IRQS) {
+		printk(KERN_ERR "Trying to mark IRQ%d non-probeable\n", irq);
+
+		return;
+	}
+
+	desc = irq_desc + irq;
+
+	spin_lock_irqsave(&desc->lock, flags);
+	desc->status |= IRQ_NOPROBE;
+	spin_unlock_irqrestore(&desc->lock, flags);
+}
+
+void __init set_irq_probe(unsigned int irq)
+{
+	struct irq_desc *desc;
+	unsigned long flags;
+
+	if (irq >= NR_IRQS) {
+		printk(KERN_ERR "Trying to mark IRQ%d probeable\n", irq);
+
+		return;
+	}
+
+	desc = irq_desc + irq;
+
+	spin_lock_irqsave(&desc->lock, flags);
+	desc->status &= ~IRQ_NOPROBE;
+	spin_unlock_irqrestore(&desc->lock, flags);
+}

  reply	other threads:[~2008-01-29 11:21 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-28  8:17 2.6.24 panics initializing ne2k in mips Rob Landley
2008-01-29  5:51 ` Rob Landley
2008-01-29 11:16 ` Ralf Baechle
2008-01-29 11:20   ` Ralf Baechle [this message]
2008-01-29 11:21     ` [PATCH 2/2] MIPS: Mark all but i8259 interrupts as no-probe Ralf Baechle
2008-01-31  7:56     ` [PATCH 1/2] IRQ_NOPROBE helper functions Rob Landley
2008-02-22 14:17   ` 2.6.24 panics initializing ne2k in mips Samuel Masham
2008-02-22 22:19     ` Rob Landley
2008-02-23  7:56       ` Samuel Masham
2008-02-23 21:43         ` Rob Landley

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=20080129112048.GA8665@linux-mips.org \
    --to=ralf@linux-mips.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=rob@landley.net \
    /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).