linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 0/2] genirq updates
@ 2006-06-10 10:15 Thomas Gleixner
  2006-06-10 10:15 ` [patch 1/2] genirq: allow usage of no_irq_chip Thomas Gleixner
  2006-06-10 10:15 ` [patch 2/2] genirq: Add reentrancy warning messages Thomas Gleixner
  0 siblings, 2 replies; 7+ messages in thread
From: Thomas Gleixner @ 2006-06-10 10:15 UTC (permalink / raw)
  To: Andrew Morton; +Cc: LKML, Ingo Molnar, Russell King

Andrew,

the dust has settled. Please add the following updates to genirq.

The simple one is to allow the usage of no_irq_chip for real dumb
PICs.

The deadlock problems seen by Russell on neponset and also by Kevin 
on omap turned out to be reentrancy problems. The original ARM 
implementation had no reentrancy check in the simple_irq handler 
and the network driver magically did not break when the interrupt 
handler was reentered. ARM related fixups are seperate.

	tglx

--


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [patch 1/2] genirq: allow usage of no_irq_chip
  2006-06-10 10:15 [patch 0/2] genirq updates Thomas Gleixner
@ 2006-06-10 10:15 ` Thomas Gleixner
  2006-06-21 23:12   ` Andrew Morton
  2006-06-10 10:15 ` [patch 2/2] genirq: Add reentrancy warning messages Thomas Gleixner
  1 sibling, 1 reply; 7+ messages in thread
From: Thomas Gleixner @ 2006-06-10 10:15 UTC (permalink / raw)
  To: Andrew Morton; +Cc: LKML, Ingo Molnar, Russell King

[-- Attachment #1: genirq-allow-usage-of-no-irq-chip.patch --]
[-- Type: text/plain, Size: 2099 bytes --]


Some dumb interrupt hardware has no way to ack/mask.... Instead of creating a
seperate chip structure we allow to reuse the already existing no_irq_chip

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

 kernel/irq/handle.c |    8 ++++++--
 kernel/irq/manage.c |    2 +-
 kernel/irq/proc.c   |    5 ++---
 3 files changed, 9 insertions(+), 6 deletions(-)

Index: linux-2.6.17-rc6-mm/kernel/irq/handle.c
===================================================================
--- linux-2.6.17-rc6-mm.orig/kernel/irq/handle.c	2006-06-10 10:32:51.000000000 +0200
+++ linux-2.6.17-rc6-mm/kernel/irq/handle.c	2006-06-10 10:42:22.000000000 +0200
@@ -63,8 +63,12 @@
  */
 static void ack_bad(unsigned int irq)
 {
-	print_irq_desc(irq, irq_desc + irq);
-	ack_bad_irq(irq);
+	struct irq_desc *desc = irq_desc + irq;
+
+	if (desc->handle_irq == handle_bad_irq) {
+		print_irq_desc(irq, desc);
+		ack_bad_irq(irq);
+	}
 }
 
 /*
@@ -89,6 +93,7 @@
 	.enable		= noop,
 	.disable	= noop,
 	.ack		= ack_bad,
+	.unmask		= noop,
 	.end		= noop,
 };
 
Index: linux-2.6.17-rc6-mm/kernel/irq/manage.c
===================================================================
--- linux-2.6.17-rc6-mm.orig/kernel/irq/manage.c	2006-06-10 10:32:53.000000000 +0200
+++ linux-2.6.17-rc6-mm/kernel/irq/manage.c	2006-06-10 10:42:22.000000000 +0200
@@ -199,7 +199,7 @@
 	if (irq >= NR_IRQS)
 		return -EINVAL;
 
-	if (desc->chip == &no_irq_chip)
+	if (desc->handle_irq == &handle_bad_irq)
 		return -ENOSYS;
 	/*
 	 * Some drivers like serial.c use request_irq() heavily,
Index: linux-2.6.17-rc6-mm/kernel/irq/proc.c
===================================================================
--- linux-2.6.17-rc6-mm.orig/kernel/irq/proc.c	2006-06-10 10:32:49.000000000 +0200
+++ linux-2.6.17-rc6-mm/kernel/irq/proc.c	2006-06-10 10:42:22.000000000 +0200
@@ -116,9 +116,8 @@
 {
 	char name [MAX_NAMELEN];
 
-	if (!root_irq_dir ||
-		(irq_desc[irq].chip == &no_irq_chip) ||
-			irq_desc[irq].dir)
+	if (!root_irq_dir || (irq_desc[irq].handle_irq == &handle_bad_irq) ||
+	    irq_desc[irq].dir)
 		return;
 
 	memset(name, 0, MAX_NAMELEN);

--


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [patch 2/2] genirq: Add reentrancy warning messages
  2006-06-10 10:15 [patch 0/2] genirq updates Thomas Gleixner
  2006-06-10 10:15 ` [patch 1/2] genirq: allow usage of no_irq_chip Thomas Gleixner
@ 2006-06-10 10:15 ` Thomas Gleixner
  1 sibling, 0 replies; 7+ messages in thread
From: Thomas Gleixner @ 2006-06-10 10:15 UTC (permalink / raw)
  To: Andrew Morton; +Cc: LKML, Ingo Molnar, Russell King

[-- Attachment #1: genirq-add-reentrancy-messages.patch --]
[-- Type: text/plain, Size: 1554 bytes --]


The simple and level irq handlers prevent reentrancy. For those irq types
reentrancy should not happen. Instead of silently going back omit a warning
message. Also do not reenable the interrupt in that case.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

 kernel/irq/chip.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

Index: linux-2.6.17-rc6-mm/kernel/irq/chip.c
===================================================================
--- linux-2.6.17-rc6-mm.orig/kernel/irq/chip.c	2006-06-10 10:32:49.000000000 +0200
+++ linux-2.6.17-rc6-mm/kernel/irq/chip.c	2006-06-10 10:42:40.000000000 +0200
@@ -208,8 +208,11 @@
 
 	spin_lock(&desc->lock);
 
-	if (unlikely(desc->status & IRQ_INPROGRESS))
+	if (unlikely(desc->status & IRQ_INPROGRESS)) {
+		printk(KERN_ERR "handle_simple_irq reentered while "
+		       "processing irq %d\n", irq);
 		goto out_unlock;
+	}
 	desc->status &= ~(IRQ_REPLAY | IRQ_WAITING);
 	kstat_cpu(cpu).irqs[irq]++;
 
@@ -251,8 +254,11 @@
 	spin_lock(&desc->lock);
 	mask_ack_irq(desc, irq);
 
-	if (unlikely(desc->status & IRQ_INPROGRESS))
+	if (unlikely(desc->status & IRQ_INPROGRESS)) {
+		printk(KERN_ERR "handle_level_irq reentered while "
+		       "processing irq %d\n", irq);
 		goto out;
+	}
 	desc->status &= ~(IRQ_REPLAY | IRQ_WAITING);
 	kstat_cpu(cpu).irqs[irq]++;
 
@@ -273,9 +279,9 @@
 
 	spin_lock(&desc->lock);
 	desc->status &= ~IRQ_INPROGRESS;
-out:
 	if (!(desc->status & IRQ_DISABLED) && desc->chip->unmask)
 		desc->chip->unmask(irq);
+out:
 	spin_unlock(&desc->lock);
 }
 

--


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [patch 1/2] genirq: allow usage of no_irq_chip
  2006-06-10 10:15 ` [patch 1/2] genirq: allow usage of no_irq_chip Thomas Gleixner
@ 2006-06-21 23:12   ` Andrew Morton
  2006-06-22  8:35     ` Russell King
  0 siblings, 1 reply; 7+ messages in thread
From: Andrew Morton @ 2006-06-21 23:12 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: linux-kernel, mingo, rmk+lkml

On Sat, 10 Jun 2006 10:15:11 -0000
Thomas Gleixner <tglx@linutronix.de> wrote:

> 
> Some dumb interrupt hardware has no way to ack/mask.... Instead of creating a
> seperate chip structure we allow to reuse the already existing no_irq_chip
> 
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> 
>  kernel/irq/handle.c |    8 ++++++--
>  kernel/irq/manage.c |    2 +-
>  kernel/irq/proc.c   |    5 ++---
>  3 files changed, 9 insertions(+), 6 deletions(-)
> 
> Index: linux-2.6.17-rc6-mm/kernel/irq/handle.c
> ===================================================================
> --- linux-2.6.17-rc6-mm.orig/kernel/irq/handle.c	2006-06-10 10:32:51.000000000 +0200
> +++ linux-2.6.17-rc6-mm/kernel/irq/handle.c	2006-06-10 10:42:22.000000000 +0200
> @@ -63,8 +63,12 @@
>   */
>  static void ack_bad(unsigned int irq)
>  {
> -	print_irq_desc(irq, irq_desc + irq);
> -	ack_bad_irq(irq);
> +	struct irq_desc *desc = irq_desc + irq;
> +
> +	if (desc->handle_irq == handle_bad_irq) {
> +		print_irq_desc(irq, desc);
> +		ack_bad_irq(irq);
> +	}
>  }
>  
>  /*
> @@ -89,6 +93,7 @@
>  	.enable		= noop,
>  	.disable	= noop,
>  	.ack		= ack_bad,
> +	.unmask		= noop,
>  	.end		= noop,
>  };
>  
> Index: linux-2.6.17-rc6-mm/kernel/irq/manage.c
> ===================================================================
> --- linux-2.6.17-rc6-mm.orig/kernel/irq/manage.c	2006-06-10 10:32:53.000000000 +0200
> +++ linux-2.6.17-rc6-mm/kernel/irq/manage.c	2006-06-10 10:42:22.000000000 +0200
> @@ -199,7 +199,7 @@
>  	if (irq >= NR_IRQS)
>  		return -EINVAL;
>  
> -	if (desc->chip == &no_irq_chip)
> +	if (desc->handle_irq == &handle_bad_irq)
>  		return -ENOSYS;
>  	/*
>  	 * Some drivers like serial.c use request_irq() heavily,
> Index: linux-2.6.17-rc6-mm/kernel/irq/proc.c
> ===================================================================
> --- linux-2.6.17-rc6-mm.orig/kernel/irq/proc.c	2006-06-10 10:32:49.000000000 +0200
> +++ linux-2.6.17-rc6-mm/kernel/irq/proc.c	2006-06-10 10:42:22.000000000 +0200
> @@ -116,9 +116,8 @@
>  {
>  	char name [MAX_NAMELEN];
>  
> -	if (!root_irq_dir ||
> -		(irq_desc[irq].chip == &no_irq_chip) ||
> -			irq_desc[irq].dir)
> +	if (!root_irq_dir || (irq_desc[irq].handle_irq == &handle_bad_irq) ||
> +	    irq_desc[irq].dir)
>  		return;
>  
>  	memset(name, 0, MAX_NAMELEN);
> 

This is the patch which causes powerpc to crash.  In a quite ugly manner:
early oops, falls into xmon, keeps oopsing from within xmon.  No serial
port, too early for netconsole.

I'll drop it.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [patch 1/2] genirq: allow usage of no_irq_chip
  2006-06-21 23:12   ` Andrew Morton
@ 2006-06-22  8:35     ` Russell King
  2006-06-22  8:51       ` Thomas Gleixner
  0 siblings, 1 reply; 7+ messages in thread
From: Russell King @ 2006-06-22  8:35 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Thomas Gleixner, linux-kernel, mingo

On Wed, Jun 21, 2006 at 04:12:36PM -0700, Andrew Morton wrote:
> On Sat, 10 Jun 2006 10:15:11 -0000
> Thomas Gleixner <tglx@linutronix.de> wrote:
> > Some dumb interrupt hardware has no way to ack/mask.... Instead of creating a
> > seperate chip structure we allow to reuse the already existing no_irq_chip
> 
> This is the patch which causes powerpc to crash.  In a quite ugly manner:
> early oops, falls into xmon, keeps oopsing from within xmon.  No serial
> port, too early for netconsole.
> 
> I'll drop it.

Note that dropping it makes the genirq stuff buggy on ARM, so this
needs to be resolved before it can go anywhere near Linus' tree.

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [patch 1/2] genirq: allow usage of no_irq_chip
  2006-06-22  8:35     ` Russell King
@ 2006-06-22  8:51       ` Thomas Gleixner
  2006-06-22 19:55         ` Thomas Gleixner
  0 siblings, 1 reply; 7+ messages in thread
From: Thomas Gleixner @ 2006-06-22  8:51 UTC (permalink / raw)
  To: Russell King; +Cc: Andrew Morton, linux-kernel, mingo

Russell,

On Thu, 2006-06-22 at 09:35 +0100, Russell King wrote:
> > Thomas Gleixner <tglx@linutronix.de> wrote:
> > > Some dumb interrupt hardware has no way to ack/mask.... Instead of creating a
> > > seperate chip structure we allow to reuse the already existing no_irq_chip
> > 
> > This is the patch which causes powerpc to crash.  In a quite ugly manner:
> > early oops, falls into xmon, keeps oopsing from within xmon.  No serial
> > port, too early for netconsole.
> > 
> > I'll drop it.
> 
> Note that dropping it makes the genirq stuff buggy on ARM, so this
> needs to be resolved before it can go anywhere near Linus' tree.

I'm aware of that. I'm looking into the problem, which might be resolved
by Bens outstanding patchset anyway.

	tglx



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [patch 1/2] genirq: allow usage of no_irq_chip
  2006-06-22  8:51       ` Thomas Gleixner
@ 2006-06-22 19:55         ` Thomas Gleixner
  0 siblings, 0 replies; 7+ messages in thread
From: Thomas Gleixner @ 2006-06-22 19:55 UTC (permalink / raw)
  To: Russell King; +Cc: Andrew Morton, linux-kernel, mingo, Benjamin Herrenschmidt

On Thu, 2006-06-22 at 10:51 +0200, Thomas Gleixner wrote:
> > Note that dropping it makes the genirq stuff buggy on ARM, so this
> > needs to be resolved before it can go anywhere near Linus' tree.
> 
> I'm aware of that. I'm looking into the problem, which might be resolved
> by Bens outstanding patchset anyway.

No, it is not. The patch was actually one of the brown paperbag
category. 

While Ben helped me to get my brain straight again, he mentioned that he
also could use an global extreme dumb irq_chip.

I came up with the following solution which allows us to keep the ARM
migration path smooth and might be of help for Ben too.

Also integrated into the latest armirq queue on top of 2.6.17: 
http://www.tglx.de/projects/armirq/2.6.17/patch-2.6.17-armirq2.patches.tar.bz2

	tglx


 include/linux/irq.h |    3 ++-
 kernel/irq/chip.c   |   15 ++++++++++++---
 kernel/irq/handle.c |   16 ++++++++++++++++
 3 files changed, 30 insertions(+), 4 deletions(-)

Index: linux-2.6.17-mm/include/linux/irq.h
===================================================================
--- linux-2.6.17-mm.orig/include/linux/irq.h	2006-06-22 21:36:29.000000000 +0200
+++ linux-2.6.17-mm/include/linux/irq.h	2006-06-22 21:36:30.000000000 +0200
@@ -348,8 +348,9 @@
 /* Checks whether the interrupt can be requested by request_irq(): */
 extern int can_request_irq(unsigned int irq, unsigned long irqflags);
 
-/* Dummy irq-chip implementation: */
+/* Dummy irq-chip implementations: */
 extern struct irq_chip no_irq_chip;
+extern struct irq_chip dummy_irq_chip;
 
 extern void
 set_irq_chip_and_handler(unsigned int irq, struct irq_chip *chip,
Index: linux-2.6.17-mm/kernel/irq/handle.c
===================================================================
--- linux-2.6.17-mm.orig/kernel/irq/handle.c	2006-06-22 21:36:30.000000000 +0200
+++ linux-2.6.17-mm/kernel/irq/handle.c	2006-06-22 21:36:30.000000000 +0200
@@ -93,6 +93,22 @@
 };
 
 /*
+ * Generic dummy implementation which can be used for
+ * real dumb interrupt sources
+ */
+struct irq_chip dummy_irq_chip = {
+	.name		= "dummy",
+	.startup	= noop_ret,
+	.shutdown	= noop,
+	.enable		= noop,
+	.disable	= noop,
+	.ack		= noop,
+	.mask		= noop,
+	.unmask		= noop,
+	.end		= noop,
+};
+
+/*
  * Special, empty irq handler:
  */
 irqreturn_t no_action(int cpl, void *dev_id, struct pt_regs *regs)
Index: linux-2.6.17-mm/kernel/irq/chip.c
===================================================================
--- linux-2.6.17-mm.orig/kernel/irq/chip.c	2006-06-22 21:36:29.000000000 +0200
+++ linux-2.6.17-mm/kernel/irq/chip.c	2006-06-22 21:36:30.000000000 +0200
@@ -459,9 +459,18 @@
 	if (!handle)
 		handle = handle_bad_irq;
 
-	if (is_chained && desc->chip == &no_irq_chip)
-		printk(KERN_WARNING "Trying to install "
-		       "chained interrupt type for IRQ%d\n", irq);
+	if (desc->chip == &no_irq_chip) {
+		printk(KERN_WARNING "Trying to install %sinterrupt handler "
+		       "for IRQ%d\n", is_chained ? "chained " : " ", irq);
+		/*
+		 * Some ARM implementations install a handler for really dumb
+		 * interrupt hardware without setting an irq_chip. This worked
+		 * with the ARM no_irq_chip but the check in setup_irq would
+		 * prevent us to setup the interrupt at all. Switch it to
+		 * dummy_irq_chip for easy transition.
+		 */
+		desc->chip = &dummy_irq_chip;
+	}
 
 	spin_lock_irqsave(&desc->lock, flags);
 






^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2006-06-22 19:53 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-10 10:15 [patch 0/2] genirq updates Thomas Gleixner
2006-06-10 10:15 ` [patch 1/2] genirq: allow usage of no_irq_chip Thomas Gleixner
2006-06-21 23:12   ` Andrew Morton
2006-06-22  8:35     ` Russell King
2006-06-22  8:51       ` Thomas Gleixner
2006-06-22 19:55         ` Thomas Gleixner
2006-06-10 10:15 ` [patch 2/2] genirq: Add reentrancy warning messages Thomas Gleixner

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).