Skip to content

Commit c7259cd

Browse files
committed
genirq: Do not poll disabled, percpu and timer interrupts
There is no point in polling disabled lines. percpu does not make sense at all because we only poll on the cpu we're currently running on. Also polling per_cpu interrupts is racy as hell. The handler runs without locking so we might get a huge surprise. If the timer interrupt needs polling, then we wont get there anyway. Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
1 parent fa27271 commit c7259cd

1 file changed

Lines changed: 26 additions & 14 deletions

File tree

‎kernel/irq/spurious.c‎

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,30 +25,42 @@ static DEFINE_TIMER(poll_spurious_irq_timer, poll_spurious_irqs, 0, 0);
2525
/*
2626
* Recovery handler for misrouted interrupts.
2727
*/
28-
static int try_one_irq(int irq, struct irq_desc *desc)
28+
static int try_one_irq(int irq, struct irq_desc *desc, bool force)
2929
{
3030
struct irqaction *action;
3131
int ok = 0, work = 0;
3232

3333
raw_spin_lock(&desc->lock);
34+
35+
/* PER_CPU and nested thread interrupts are never polled */
36+
if (desc->status & (IRQ_PER_CPU | IRQ_NESTED_THREAD))
37+
goto out;
38+
39+
/*
40+
* Do not poll disabled interrupts unless the spurious
41+
* disabled poller asks explicitely.
42+
*/
43+
if ((desc->status & IRQ_DISABLED) && !force)
44+
goto out;
45+
46+
/*
47+
* All handlers must agree on IRQF_SHARED, so we test just the
48+
* first. Check for action->next as well.
49+
*/
50+
action = desc->action;
51+
if (!action || !(action->flags & IRQF_SHARED) ||
52+
(action->flags & __IRQF_TIMER) || !action->next)
53+
goto out;
54+
3455
/* Already running on another processor */
3556
if (desc->status & IRQ_INPROGRESS) {
3657
/*
3758
* Already running: If it is shared get the other
3859
* CPU to go looking for our mystery interrupt too
3960
*/
40-
if (desc->action && (desc->action->flags & IRQF_SHARED))
41-
desc->status |= IRQ_PENDING;
42-
raw_spin_unlock(&desc->lock);
43-
return ok;
44-
}
45-
/*
46-
* All handlers must agree on IRQF_SHARED, so we test just the
47-
* first. Check for action->next as well.
48-
*/
49-
action = desc->action;
50-
if (!action || !(action->flags & IRQF_SHARED) || !action->next)
61+
desc->status |= IRQ_PENDING;
5162
goto out;
63+
}
5264

5365
/* Honour the normal IRQ locking */
5466
desc->status |= IRQ_INPROGRESS;
@@ -87,7 +99,7 @@ static int misrouted_irq(int irq)
8799
if (i == irq) /* Already tried */
88100
continue;
89101

90-
if (try_one_irq(i, desc))
102+
if (try_one_irq(i, desc, false))
91103
ok = 1;
92104
}
93105
/* So the caller can adjust the irq error counts */
@@ -112,7 +124,7 @@ static void poll_spurious_irqs(unsigned long dummy)
112124
continue;
113125

114126
local_irq_disable();
115-
try_one_irq(i, desc);
127+
try_one_irq(i, desc, true);
116128
local_irq_enable();
117129
}
118130

0 commit comments

Comments
 (0)