Skip to content

Commit 4eb20bf

Browse files
committed
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 1b1b6a6 ("powerpc: handle irq_enter/ irq_exit in interrupt handler wrappers") and 1346d00 ("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
1 parent 2a066ae commit 4eb20bf

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

arch/powerpc/kernel/irq.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -284,15 +284,14 @@ static __always_inline void call_do_irq(struct pt_regs *regs, void *sp)
284284
void __do_IRQ(struct pt_regs *regs)
285285
{
286286
struct pt_regs *old_regs = set_irq_regs(regs);
287-
void *cursp, *irqsp, *sirqsp;
287+
void *cursp, *irqsp;
288288

289289
/* Switch to the irq stack to handle this */
290290
cursp = (void *)(current_stack_pointer & ~(THREAD_SIZE - 1));
291291
irqsp = hardirq_ctx[raw_smp_processor_id()];
292-
sirqsp = softirq_ctx[raw_smp_processor_id()];
293292

294293
/* Already there ? If not switch stack and call */
295-
if (unlikely(cursp == irqsp || cursp == sirqsp))
294+
if (unlikely(cursp == irqsp))
296295
__do_irq(regs, current_stack_pointer);
297296
else
298297
call_do_irq(regs, irqsp);

0 commit comments

Comments
 (0)