diff options
author | Michael Ellerman <mpe@ellerman.id.au> | 2023-11-30 23:50:45 +1100 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2024-03-03 22:20:29 +1100 |
commit | 4eb20bf34ea296f648971a8528e32cd80efcbe89 (patch) | |
tree | ef530697adb634bd75f8e322d9ba9a325ba31b9c /arch/powerpc/kernel/irq.c | |
parent | 2a066ae11861257223500d7515e1541199cb7832 (diff) | |
download | linux-4eb20bf34ea296f648971a8528e32cd80efcbe89.tar.gz linux-4eb20bf34ea296f648971a8528e32cd80efcbe89.tar.bz2 linux-4eb20bf34ea296f648971a8528e32cd80efcbe89.zip |
powerpc/irq: Allow softirq to hardirq stack transition
Allow a transition from the softirq stack to the hardirq stack when
handling a hardirq. Doing so means a hardirq received while deep in
softirq processing is less likely to cause a stack overflow of the
softirq stack.
Previously it wasn't safe to do so because irq_exit() (which initiates
softirq processing) was called on the hardirq stack.
That was changed in commit 1b1b6a6f4cc0 ("powerpc: handle irq_enter/
irq_exit in interrupt handler wrappers") and 1346d00e1bdf ("powerpc:
Don't select HAVE_IRQ_EXIT_ON_IRQ_STACK").
The allowed transitions are now:
- process stack -> hardirq stack
- process stack -> softirq stack
- process stack -> softirq stack -> hardirq stack
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20231130125045.3080961-1-mpe@ellerman.id.au
Diffstat (limited to 'arch/powerpc/kernel/irq.c')
-rw-r--r-- | arch/powerpc/kernel/irq.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c index 6f7d4edaa0bc..7504ceec5c58 100644 --- a/arch/powerpc/kernel/irq.c +++ b/arch/powerpc/kernel/irq.c @@ -284,15 +284,14 @@ static __always_inline void call_do_irq(struct pt_regs *regs, void *sp) void __do_IRQ(struct pt_regs *regs) { struct pt_regs *old_regs = set_irq_regs(regs); - void *cursp, *irqsp, *sirqsp; + void *cursp, *irqsp; /* Switch to the irq stack to handle this */ cursp = (void *)(current_stack_pointer & ~(THREAD_SIZE - 1)); irqsp = hardirq_ctx[raw_smp_processor_id()]; - sirqsp = softirq_ctx[raw_smp_processor_id()]; /* Already there ? If not switch stack and call */ - if (unlikely(cursp == irqsp || cursp == sirqsp)) + if (unlikely(cursp == irqsp)) __do_irq(regs, current_stack_pointer); else call_do_irq(regs, irqsp); |