Skip to contentSkip to conversation

irqchip/bcm2836: Prevent spurious interrupts

PATCH In review Eric Anholt 2 participants 6 messages Oct 27, 2016 – Oct 31, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 irqchip/bcm2836: Prevent spurious interrupts

From: Phil Elwell <[email protected]>

The old arch-specific IRQ macros included a dsb to ensure the write to clear the mailbox interrupt completed before returning from the interrupt. The BCM2836 irqchip driver needs the same precaution to avoid spurious interrupts.

---
 drivers/irqchip/irq-bcm2836.c | 1 +
 1 file changed, 1 insertion(+)
drivers/irqchip/irq-bcm2836.c +1 -0
index d96b2c947e74..93e3f7660c42 100644
@@ -175,6 +175,7 @@ __exception_irq_entry bcm2836_arm_irqchip_handle_irq(struct pt_regs *regs)
 		u32 ipi = ffs(mbox_val) - 1;
 
 		writel(1 << ipi, mailbox0);
+		dsb(sy);
 		handle_IPI(ipi, regs);
 #endif
 	} else if (stat) {
Signature · 1 line
2.9.3
#1 lore raw
Quoted 6 lines · Eric Anholt

From: Phil Elwell <[email protected]>

The old arch-specific IRQ macros included a dsb to ensure the write to clear the mailbox interrupt completed before returning from the interrupt. The BCM2836 irqchip driver needs the same precaution to avoid spurious interrupts.

This is missing a fixes tag. I have no idea when that problem was introduced, so I have no way to decide whether this needs to be tagged stable or not.

Thanks,

tglx

Quoted 23 lines
---
 drivers/irqchip/irq-bcm2836.c | 1 +
 1 file changed, 1 insertion(+)
drivers/irqchip/irq-bcm2836.c +1 -0
index d96b2c947e74..93e3f7660c42 100644
@@ -175,6 +175,7 @@ __exception_irq_entry bcm2836_arm_irqchip_handle_irq(struct pt_regs *regs)
 		u32 ipi = ffs(mbox_val) - 1;
 
 		writel(1 << ipi, mailbox0);
+		dsb(sy);
 		handle_IPI(ipi, regs);
 #endif
 	} else if (stat) {
Signature · 1 line
2.9.3
#2 lore raw
Quoted 4 lines · Thomas Gleixner
Quoted 2 lines · Eric Anholt

From: Phil Elwell <[email protected]>

Quoted 8 lines
Quoted 4 lines

The old arch-specific IRQ macros included a dsb to ensure the write to clear the mailbox interrupt completed before returning from the interrupt. The BCM2836 irqchip driver needs the same precaution to avoid spurious interrupts.

This is missing a fixes tag. I have no idea when that problem was introduced, so I have no way to decide whether this needs to be tagged stable or not.

This code has been there since introduction of the driver, so:

Fixes 1a15aaa998dc ("irqchip: Add bcm2836 interrupt controller for Raspberry Pi 2")
#3 lore raw
Quoted 7 lines · Eric Anholt
Quoted 5 lines · Thomas Gleixner
Quoted 3 lines · Eric Anholt

From: Phil Elwell <[email protected]>

The old arch-specific IRQ macros included a dsb to ensure the

Which old arch-specific macros?

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

write to clear the mailbox interrupt completed before returning from the interrupt.

That's not what the patch does. It makes sure that the interrupt it cleared _before_ the IPI handler is called.

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

The BCM2836 irqchip driver needs the same precaution to avoid spurious interrupts.

Please describe issues proper. Something like this:

The interrupt demultiplexer code clears a pending mailbox interrupt by writing the pending bit back to the hardware, but it does not ensure that the write is completed before proceeding. This causes the machine to catch fire and scares my cat. <<-- Replace by a proper description.

The write() macro which was used, when the driver was developed, contained the necessary data sycnhronization barrier, but it was replaced by writel() when the driver got merged without adding the explicit barrier after the write.

Add and document the barrier.

Can you spot the difference?

Quoted 1 line

writel(1 << ipi, mailbox0);

		/* Barriers need to be documented with a comment */
Quoted 10 lines
drivers/irqchip/irq-bcm2836.c +1 -0
+		dsb(sy);
		handle_IPI(ipi, regs);
Quoted 3 lines

This is missing a fixes tag. I have no idea when that problem was introduced, so I have no way to decide whether this needs to be tagged stable or not.

This code has been there since introduction of the driver, so:

Fixes 1a15aaa998dc ("irqchip: Add bcm2836 interrupt controller for Raspberry Pi 2")

So it want's a stable tag, right?

Thanks,

tglx

#4 lore raw
Quoted 7 lines · Thomas Gleixner
Quoted 5 lines · Eric Anholt
Quoted 3 lines · Thomas Gleixner

This is missing a fixes tag. I have no idea when that problem was introduced, so I have no way to decide whether this needs to be tagged stable or not.

Quoted 5 lines
Quoted 3 lines

This code has been there since introduction of the driver, so:

Fixes 1a15aaa998dc ("irqchip: Add bcm2836 interrupt controller for Raspberry Pi 2")

So it want's a stable tag, right?

I'm not the author here, and I was just trying to provide an assist with
upstreaming, so I'm not going to get too involved. I'd say this is an
edge case for being a stable tree candidate (it's produces a scary dmesg
warning but no other functional problems that I know of), and I didn't
add a fixes tag myself because of that.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 800 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20161031/9eb0eb34/attachment.sig>

#5 lore raw
Quoted 13 lines · Eric Anholt
Quoted 11 lines · Thomas Gleixner
Quoted 8 lines · Eric Anholt
Quoted 3 lines · Thomas Gleixner

This is missing a fixes tag. I have no idea when that problem was introduced, so I have no way to decide whether this needs to be tagged stable or not.

This code has been there since introduction of the driver, so:

Fixes 1a15aaa998dc ("irqchip: Add bcm2836 interrupt controller for Raspberry Pi 2")
Quoted 7 lines
Quoted 1 line

So it want's a stable tag, right?

I'm not the author here, and I was just trying to provide an assist with upstreaming, so I'm not going to get too involved. I'd say this is an edge case for being a stable tree candidate (it's produces a scary dmesg warning but no other functional problems that I know of), and I didn't add a fixes tag myself because of that.

A fixes tag is not the same as a stable tag, I really want to see Fixes tags on patches which are bug fixes as it makes it simple to see the context in which a bug was introduced.

vs. the stable tag: scary warnings tend to confuse users and cause people to send bug reports. So in this case I'd add one.

Thanks,

tglx