Skip to contentSkip to conversation

irq: Warn when shared interrupts do not match on NO_SUSPEND

PATCH In review Peter Zijlstra 4 participants 6 messages Jul 24, 2014 – Jul 31, 2014 IRQ

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 irq: Warn when shared interrupts do not match on NO_SUSPEND

Subject: irq: Warn when shared interrupts do not match on NO_SUSPEND

When suspend_device_irqs() iterates all descriptors, its pointless if one has NO_SUSPEND set while another has not.

Validate on request_irq() that NO_SUSPEND state maches for SHARED interrupts.

Cc "Rafael J. Wysocki" <[email protected]>
Cc Thomas Gleixner <[email protected]>
---
 kernel/irq/manage.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
kernel/irq/manage.c +5 -2
index 88657d7bc9dd..27a1fe028afb 100644
@@ -1077,9 +1077,12 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new)
 		 * set the trigger type must match. Also all must
 		 * agree on ONESHOT.
 		 */
+
+#define IRQF_MISMATCH \
+	(IRQF_TRIGGER_MASK | IRQF_ONESHOT | IRQF_NO_SUSPEND)
+
 		if (!((old->flags & new->flags) & IRQF_SHARED) ||
-		    ((old->flags ^ new->flags) & IRQF_TRIGGER_MASK) ||
-		    ((old->flags ^ new->flags) & IRQF_ONESHOT))
+		    ((old->flags ^ new->flags) & IRQF_MISMATCH))
 			goto mismatch;
 
 		/* All handlers must agree on per-cpuness */
#1 lore raw
Quoted 7 lines · Peter Zijlstra

Subject: irq: Warn when shared interrupts do not match on NO_SUSPEND

When suspend_device_irqs() iterates all descriptors, its pointless if one has NO_SUSPEND set while another has not.

Validate on request_irq() that NO_SUSPEND state maches for SHARED interrupts.

I'm happy to take that patch, but you are aware that it is going to break a few things?

25: .... PCI-MSI-edge aerdrv, PCIe PME

Thanks,

tglx

Quoted 27 lines
Cc "Rafael J. Wysocki" <[email protected]>
Cc Thomas Gleixner <[email protected]>
---
 kernel/irq/manage.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
kernel/irq/manage.c +5 -2
index 88657d7bc9dd..27a1fe028afb 100644
@@ -1077,9 +1077,12 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new)
 		 * set the trigger type must match. Also all must
 		 * agree on ONESHOT.
 		 */
+
+#define IRQF_MISMATCH \
+	(IRQF_TRIGGER_MASK | IRQF_ONESHOT | IRQF_NO_SUSPEND)
+
 		if (!((old->flags & new->flags) & IRQF_SHARED) ||
-		    ((old->flags ^ new->flags) & IRQF_TRIGGER_MASK) ||
-		    ((old->flags ^ new->flags) & IRQF_ONESHOT))
+		    ((old->flags ^ new->flags) & IRQF_MISMATCH))
 			goto mismatch;
 
 		/* All handlers must agree on per-cpuness */
#2 lore raw
Quoted 7 lines · Thomas Gleixner
Quoted 5 lines · Peter Zijlstra

Subject: irq: Warn when shared interrupts do not match on NO_SUSPEND

When suspend_device_irqs() iterates all descriptors, its pointless if one has NO_SUSPEND set while another has not.

Quoted 7 lines
Quoted 2 lines

Validate on request_irq() that NO_SUSPEND state maches for SHARED interrupts.

I'm happy to take that patch, but you are aware that it is going to break a few things?

25: .... PCI-MSI-edge aerdrv, PCIe PME

Better an obvious splat than non obvious misbehaviour in my book.

#3 lore raw
Quoted 11 lines · Peter Zijlstra
Quoted 10 lines · Thomas Gleixner
Quoted 7 lines · Peter Zijlstra

Subject: irq: Warn when shared interrupts do not match on NO_SUSPEND

When suspend_device_irqs() iterates all descriptors, its pointless if one has NO_SUSPEND set while another has not.

Validate on request_irq() that NO_SUSPEND state maches for SHARED interrupts.

Quoted 6 lines
Quoted 4 lines

I'm happy to take that patch, but you are aware that it is going to break a few things?

25: .... PCI-MSI-edge aerdrv, PCIe PME

Better an obvious splat than non obvious misbehaviour in my book.

And it will only break things that are already broken.

ACK for the patch.

Rafael

#4 lore raw
In reply to Peter Zijlstra
irq: Warn when shared interrupts do not match on NO_SUSPEND
Commit-ID:  4fae4e7624653ef498d0e2a38f00620b9701ab04
Gitweb:     http://git.kernel.org/tip/4fae4e7624653ef498d0e2a38f00620b9701ab04
Author:     Peter Zijlstra <[email protected]>
AuthorDate: Thu, 24 Jul 2014 15:39:21 +0200
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Thu, 24 Jul 2014 17:32:56 +0200

irq: Warn when shared interrupts do not match on NO_SUSPEND

When suspend_device_irqs() iterates all descriptors, its pointless if one has NO_SUSPEND set while another has not.

Validate on request_irq() that NO_SUSPEND state maches for SHARED interrupts.

---
 kernel/irq/manage.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
kernel/irq/manage.c +5 -2
index 88657d7..27a1fe0 100644
@@ -1077,9 +1077,12 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new)
 		 * set the trigger type must match. Also all must
 		 * agree on ONESHOT.
 		 */
+
+#define IRQF_MISMATCH \
+	(IRQF_TRIGGER_MASK | IRQF_ONESHOT | IRQF_NO_SUSPEND)
+
 		if (!((old->flags & new->flags) & IRQF_SHARED) ||
-		    ((old->flags ^ new->flags) & IRQF_TRIGGER_MASK) ||
-		    ((old->flags ^ new->flags) & IRQF_ONESHOT))
+		    ((old->flags ^ new->flags) & IRQF_MISMATCH))
 			goto mismatch;
 
 		/* All handlers must agree on per-cpuness */
#5 lore raw

Hi Thomas,

Quoted 8 lines · tip-bot for Peter Zijlstra
Commit-ID:  4fae4e7624653ef498d0e2a38f00620b9701ab04
Gitweb:     http://git.kernel.org/tip/4fae4e7624653ef498d0e2a38f00620b9701ab04
Author:     Peter Zijlstra <[email protected]>
AuthorDate: Thu, 24 Jul 2014 15:39:21 +0200
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Thu, 24 Jul 2014 17:32:56 +0200

irq: Warn when shared interrupts do not match on NO_SUSPEND

Please revert this one as it is likely to break existing stuff (I'm mostly worried about the ACPI interrupt, but also about a number of drivers that have been using NO_SUSPEND along with SHARED for quite some time).

Rafael