genirq updates
cover genirq updates
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
--
PATCH 1/2 genirq: allow usage of no_irq_chip
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
kernel/irq/handle.c | 8 ++++++-- kernel/irq/manage.c | 2 +- kernel/irq/proc.c | 5 ++--- 3 files changed, 9 insertions(+), 6 deletions(-)
kernel/irq/handle.c +7 -2
@@ -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, };
kernel/irq/manage.c +1 -1
@@ -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,
kernel/irq/proc.c +2 -3
@@ -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 );
--
Re: [patch 1/2] genirq: allow usage of no_irq_chip
Quoted 58 lines · On Sat, 10 Jun 2006 10:15:11 -0000 Thomas Gleixner <[email protected]> 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_chipSigned-off-by Thomas Gleixner <[email protected]>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
===================================================================kernel/irq/handle.c +7
-2@@ -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
===================================================================kernel/irq/manage.c +1
-1@@ -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
===================================================================kernel/irq/proc.c +0
-0@@ -116,9 +116,8 @@ {
kernel/irq/proc.c line 123
Quoted 10 lines
kernel/irq/proc.c +2
-3char 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.
Re: [patch 1/2] genirq: allow usage of no_irq_chip
Quoted 10 lines · Andrew Morton
Quoted 2 lines · On Sat, 10 Jun 2006 10:15:11 -0000 Thomas Gleixner <[email protected]> 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_chipThis 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.
Signature · 3 lines
Russell King Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/ maintainer of: 2.6 Serial core
Re: [patch 1/2] genirq: allow usage of no_irq_chip
Russell,
Quoted 4 lines · Russell King
Quoted 4 lines
Quoted 2 lines · Thomas Gleixner
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
Quoted 8 lines
Quoted 5 lines
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
Re: [patch 1/2] genirq: allow usage of no_irq_chip
Quoted 5 lines · Thomas Gleixner
Quoted 2 lines
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(-)
include/linux/irq.h +2 -1
@@ -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,
kernel/irq/handle.c +16 -0
@@ -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)
kernel/irq/chip.c +12 -3
@@ -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);
PATCH 2/2 genirq: Add reentrancy warning messages
In reply to Thomas GleixnerThe 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.
kernel/irq/chip.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
kernel/irq/chip.c +9 -3
@@ -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); }
--