Re: [RFC IRQ] genirq: fix handle_nested_irq for lazy disable

From: Abhijeet Dharmapurikar
Date: Thu Oct 28 2010 - 13:23:38 EST


Thomas Gleixner wrote:
diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index baa5c4a..35ccc41 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -419,6 +419,7 @@ void handle_nested_irq(unsigned int irq)
{
struct irq_desc *desc = irq_to_desc(irq);
struct irqaction *action;
+ int mask_this_irq = 0;
irqreturn_t action_ret;
might_sleep();
@@ -428,8 +429,10 @@ void handle_nested_irq(unsigned int irq)
kstat_incr_irqs_this_cpu(irq, desc);
action = desc->action;
- if (unlikely(!action || (desc->status & IRQ_DISABLED)))
+ if (unlikely(!action || (desc->status & IRQ_DISABLED))) {
+ mask_this_irq = 1;
goto out_unlock;
+ }
desc->status |= IRQ_INPROGRESS;
raw_spin_unlock_irq(&desc->lock);e
@@ -443,6 +446,11 @@ void handle_nested_irq(unsigned int irq)
out_unlock:
raw_spin_unlock_irq(&desc->lock);
+ if (unlikely(mask_this_irq)) {
+ chip_bus_lock(irq, desc);
+ desc->chip->mask(irq);

That does not work with current mainline due to the irq_chip changes,
can you please respin against linus latest?
Sure will address this in the next patch.

Also there is no requirement for irq_chip instances to implement the
mask function, so this might crash the kernel for innocent users of
that infrastructure. mask_irq() is your friend.
Thanks, this one too.

Aside of that this wont work for edge triggered interrupts, as you'd
loose the edge, so this needs more thought and a thorough look at the
users of handle_nested_irq().

I didn't understand this though. This patch will mask the interrupt in the controller even if it were edge. My interrupt controller latches
edges and wants a mask (or an ack) to be executed to deactivate the line summary line. Do you mean that I should mark the interrupt IRQ_PENDING if it were an edge before masking it? If not, can you please explain.

Thanks,
Abhijeet
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/