Skip to contentSkip to conversation

powerpc/irq: Don't switch to irq stack from softirq stack

PATCH In review Benjamin Herrenschmidt 2 participants 2 messages Oct 7, 2013 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc/irq: Don't switch to irq stack from softirq stack

irq_exit() is now called on the irq stack, which can trigger a switch to the softirq stack from the irq stack. If an interrupt happens at that point, we will not properly detect the re-entrancy and clobber the original return context on the irq stack.

This fixes it. The side effect is to prevent all nesting from softirq stack to irq stack even in the "safe" case but it's simpler that way and matches what x86_64 does.

---

Linus, I don't have my git repo at hand right now and this is pretty urgent, can you apply it directly please ?

Cheers,
Ben.

 arch/powerpc/kernel/irq.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
arch/powerpc/kernel/irq.c +3 -2
index 57d286a..c7cb8c2 100644
@@ -495,14 +495,15 @@ void __do_irq(struct pt_regs *regs)
 void do_IRQ(struct pt_regs *regs)
 {
 	struct pt_regs *old_regs = set_irq_regs(regs);
-	struct thread_info *curtp, *irqtp;
+	struct thread_info *curtp, *irqtp, *sirqtp;
 
 	/* Switch to the irq stack to handle this */
 	curtp = current_thread_info();
 	irqtp = hardirq_ctx[raw_smp_processor_id()];
+	sirqtp = softirq_ctx[raw_smp_processor_id()];
 
 	/* Already there ? */
-	if (unlikely(curtp == irqtp)) {
+	if (unlikely(curtp == irqtp || curtp == sirqtp)) {
 		__do_irq(regs);
 		set_irq_regs(old_regs);
 		return;
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 3 lines · Benjamin Herrenschmidt

Linus, I don't have my git repo at hand right now and this is pretty urgent, can you apply it directly please ?

Done.

Linus