Skip to contentSkip to conversation

: handle_IRQ_event() - fix thinko

PATCH In review Sebastien Dugue 2 participants 4 messages Sep 23, 2008 – Sep 27, 2008 IRQ

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 : handle_IRQ_event() - fix thinko

handle_IRQ_event() reenables interrupts for threaded IRQ handlers,
provided said handler does not need to run with IRQF_DISABLED.

Therefore, unless I'm missing something, in the following:

if (!hardirq_count() || !(action->flags & IRQF_DISABLED))

	local_irq_enable();

the logical OR should be a logical AND:

if (!hardirq_count() && !(action->flags & IRQF_DISABLED))

	local_irq_enable();

Or maybe I've not yet reached my daily cafeine dose. (Damned addiction)

---
 kernel/irq/handle.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/irq/handle.c +1 -1
index 9ea9f73..f1579b9 100644
@@ -144,7 +144,7 @@ irqreturn_t handle_IRQ_event(unsigned int irq, struct irqaction *action)
 	 * Unconditionally enable interrupts for threaded
 	 * IRQ handlers:
 	 */
-	if (!hardirq_count() || !(action->flags & IRQF_DISABLED))
+	if (!hardirq_count() && !(action->flags & IRQF_DISABLED))
 		local_irq_enable();
 
 	do {
Signature · 1 line
1.6.0.1.308.gede4c
#1 lore raw
Quoted 6 lines · Sebastien Dugue

handle_IRQ_event() reenables interrupts for threaded IRQ handlers,
provided said handler does not need to run with IRQF_DISABLED.

Therefore, unless I'm missing something, in the following:

Quoted 7 lines

if (!hardirq_count() || !(action->flags & IRQF_DISABLED))

	local_irq_enable();

the logical OR should be a logical AND:

if (!hardirq_count() && !(action->flags & IRQF_DISABLED))

	local_irq_enable();

No. We don't want to run the threaded handler with interrupts disabled.

!hardirq_count() tells us that we are in thread context.

Quoted 1 line

Or maybe I've not yet reached my daily cafeine dose. (Damned addiction)

Looks like. :)

Thanks,

tglx

#2 lore raw
Quoted 11 lines · On Wed, 24 Sep 2008 17:45:36 +0200 (CEST) Thomas Gleixner <[email protected]>…
Quoted 9 lines · Sebastien Dugue

handle_IRQ_event() reenables interrupts for threaded IRQ handlers,
provided said handler does not need to run with IRQF_DISABLED.

Therefore, unless I'm missing something, in the following:

if (!hardirq_count() || !(action->flags & IRQF_DISABLED))

	local_irq_enable();
Quoted 8 lines
Quoted 4 lines

the logical OR should be a logical AND:

if (!hardirq_count() && !(action->flags & IRQF_DISABLED))

	local_irq_enable();

No. We don't want to run the threaded handler with interrupts disabled.

!hardirq_count() tells us that we are in thread context.

OK, but then if a driver asked to run with IRQ disabled it will not
be honored with threaded hardirq.

Sebastien.

#3 lore raw
Quoted 18 lines · Sebastien Dugue
Quoted 16 lines · On Wed, 24 Sep 2008 17:45:36 +0200 (CEST) Thomas Gleixner <[email protected]>…
Quoted 13 lines · Sebastien Dugue

handle_IRQ_event() reenables interrupts for threaded IRQ handlers,
provided said handler does not need to run with IRQF_DISABLED.

Therefore, unless I'm missing something, in the following:

if (!hardirq_count() || !(action->flags & IRQF_DISABLED))

	local_irq_enable();

the logical OR should be a logical AND:

if (!hardirq_count() && !(action->flags & IRQF_DISABLED))

	local_irq_enable();
Quoted 6 lines
Quoted 3 lines

No. We don't want to run the threaded handler with interrupts disabled.

!hardirq_count() tells us that we are in thread context.

OK, but then if a driver asked to run with IRQ disabled it will not
be honored with threaded hardirq.

Err, no. We switch all interrupts (except timer) to threaded with PREEMPT_RT=y. And we simply keep interrupts enabled across the thread the same way as we ignore the interrupt disable/enable of the spinlock_irqXX functions when we switch them to sleeping rt_mutex based locks.

Thanks,

tglx