Skip to content

Commit b39898c

Browse files
committed
genirq: Prevent spurious detection for unconditionally polled interrupts
On a 68k platform a couple of interrupts are demultiplexed and "polled" from a top level interrupt. Unfortunately there is no way to determine which of the sub interrupts raised the top level interrupt, so all of the demultiplexed interrupt handlers need to be invoked. Given a high enough frequency this can trigger the spurious interrupt detection mechanism, if one of the demultiplex interrupts returns IRQ_NONE continuously. But this is a false positive as the polling causes this behaviour and not buggy hardware/software. Introduce IRQ_POLLED which can be set at interrupt chip setup time via irq_set_status_flags(). The flag excludes the interrupt from the spurious detector and from all core polling activities. Reported-and-tested-by: Michael Schmitz <schmitzmic@gmail.com> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Cc: linux-m68k@vger.kernel.org Link: http://lkml.kernel.org/r/alpine.DEB.2.02.1311061149250.23353@ionos.tec.linutronix.de
1 parent 9b66bfb commit b39898c

3 files changed

Lines changed: 22 additions & 4 deletions

File tree

‎include/linux/irq.h‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ typedef void (*irq_preflow_handler_t)(struct irq_data *data);
7070
* IRQ_MOVE_PCNTXT - Interrupt can be migrated from process context
7171
* IRQ_NESTED_TRHEAD - Interrupt nests into another thread
7272
* IRQ_PER_CPU_DEVID - Dev_id is a per-cpu variable
73+
* IRQ_IS_POLLED - Always polled by another interrupt. Exclude
74+
* it from the spurious interrupt detection
75+
* mechanism and from core side polling.
7376
*/
7477
enum {
7578
IRQ_TYPE_NONE = 0x00000000,
@@ -94,12 +97,14 @@ enum {
9497
IRQ_NESTED_THREAD = (1 << 15),
9598
IRQ_NOTHREAD = (1 << 16),
9699
IRQ_PER_CPU_DEVID = (1 << 17),
100+
IRQ_IS_POLLED = (1 << 18),
97101
};
98102

99103
#define IRQF_MODIFY_MASK \
100104
(IRQ_TYPE_SENSE_MASK | IRQ_NOPROBE | IRQ_NOREQUEST | \
101105
IRQ_NOAUTOEN | IRQ_MOVE_PCNTXT | IRQ_LEVEL | IRQ_NO_BALANCING | \
102-
IRQ_PER_CPU | IRQ_NESTED_THREAD | IRQ_NOTHREAD | IRQ_PER_CPU_DEVID)
106+
IRQ_PER_CPU | IRQ_NESTED_THREAD | IRQ_NOTHREAD | IRQ_PER_CPU_DEVID | \
107+
IRQ_IS_POLLED)
103108

104109
#define IRQ_NO_BALANCING_MASK (IRQ_PER_CPU | IRQ_NO_BALANCING)
105110

‎kernel/irq/settings.h‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ enum {
1414
_IRQ_NO_BALANCING = IRQ_NO_BALANCING,
1515
_IRQ_NESTED_THREAD = IRQ_NESTED_THREAD,
1616
_IRQ_PER_CPU_DEVID = IRQ_PER_CPU_DEVID,
17+
_IRQ_IS_POLLED = IRQ_IS_POLLED,
1718
_IRQF_MODIFY_MASK = IRQF_MODIFY_MASK,
1819
};
1920

@@ -26,6 +27,7 @@ enum {
2627
#define IRQ_NOAUTOEN GOT_YOU_MORON
2728
#define IRQ_NESTED_THREAD GOT_YOU_MORON
2829
#define IRQ_PER_CPU_DEVID GOT_YOU_MORON
30+
#define IRQ_IS_POLLED GOT_YOU_MORON
2931
#undef IRQF_MODIFY_MASK
3032
#define IRQF_MODIFY_MASK GOT_YOU_MORON
3133

@@ -147,3 +149,8 @@ static inline bool irq_settings_is_nested_thread(struct irq_desc *desc)
147149
{
148150
return desc->status_use_accessors & _IRQ_NESTED_THREAD;
149151
}
152+
153+
static inline bool irq_settings_is_polled(struct irq_desc *desc)
154+
{
155+
return desc->status_use_accessors & _IRQ_IS_POLLED;
156+
}

‎kernel/irq/spurious.c‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,13 @@ static int try_one_irq(int irq, struct irq_desc *desc, bool force)
6767

6868
raw_spin_lock(&desc->lock);
6969

70-
/* PER_CPU and nested thread interrupts are never polled */
71-
if (irq_settings_is_per_cpu(desc) || irq_settings_is_nested_thread(desc))
70+
/*
71+
* PER_CPU, nested thread interrupts and interrupts explicitely
72+
* marked polled are excluded from polling.
73+
*/
74+
if (irq_settings_is_per_cpu(desc) ||
75+
irq_settings_is_nested_thread(desc) ||
76+
irq_settings_is_polled(desc))
7277
goto out;
7378

7479
/*
@@ -268,7 +273,8 @@ try_misrouted_irq(unsigned int irq, struct irq_desc *desc,
268273
void note_interrupt(unsigned int irq, struct irq_desc *desc,
269274
irqreturn_t action_ret)
270275
{
271-
if (desc->istate & IRQS_POLL_INPROGRESS)
276+
if (desc->istate & IRQS_POLL_INPROGRESS ||
277+
irq_settings_is_polled(desc))
272278
return;
273279

274280
/* we get here again via the threaded handler */

0 commit comments

Comments
 (0)