Re: Irq handler reentrancy ?

From: Robert Love (rml@tech9.net)
Date: Wed Sep 04 2002 - 17:29:28 EST


On Wed, 2002-09-04 at 18:18, Jean Tourrilhes wrote:

> Just a quick question : can an interrupt handler be preempted
> or reenter itself ?

It is not supposed to.

There is a bug in 2.5, with a fix from Linus currently in bitkeeper. I
have attached the patch.

        Robert Love


# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
# ChangeSet 1.610 -> 1.611
# arch/i386/kernel/irq.c 1.17 -> 1.18
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/09/04 torvalds@home.transmeta.com 1.611
# Fix IO-APIC edge IRQ handling. IRQ_INPROGRESS was cleared spuriously
# if a new edge happened while we were still processing the previous
# one.
#
# Then, if a _third_ edge came in, it would actually cause a reentrant
# irq handler invocation, because the original INPROGRESS bit was now
# lost.
#
# This was actually seen on IDE in PIO mode.
# --------------------------------------------
#
diff -Nru a/arch/i386/kernel/irq.c b/arch/i386/kernel/irq.c
--- a/arch/i386/kernel/irq.c Wed Sep 4 12:00:11 2002
+++ b/arch/i386/kernel/irq.c Wed Sep 4 12:00:11 2002
@@ -380,8 +380,9 @@
                         break;
                 desc->status &= ~IRQ_PENDING;
         }
-out:
         desc->status &= ~IRQ_INPROGRESS;
+
+out:
         /*
          * The ->end() handler has to deal with interrupts which got
          * disabled while the handler was running.
@@ -768,7 +769,7 @@
 
         if (!shared) {
                 desc->depth = 0;
- desc->status &= ~(IRQ_DISABLED | IRQ_AUTODETECT | IRQ_WAITING);
+ desc->status &= ~(IRQ_DISABLED | IRQ_AUTODETECT | IRQ_WAITING | IRQ_INPROGRESS);
                 desc->handler->startup(irq);
         }
         spin_unlock_irqrestore(&desc->lock,flags);

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



This archive was generated by hypermail 2b29 : Sat Sep 07 2002 - 22:00:23 EST