[PATCH 10/14] powerpc/64: use interrupt restart table to speed up return from interrupt

Christophe Leroy christophe.leroy at csgroup.eu
Wed Mar 17 06:34:39 AEDT 2021



Le 15/03/2021 à 23:03, Nicholas Piggin a écrit :
> The restart table facility is used to return from interrupt without
> disabling MSR EE or RI.

What happens when an interrupt happens between the point you restore the user r1 and the rfi which 
returns to user ?
If an interrupt happens there, the interrupt prolog sees it as an interrupt coming from kernel, so 
it uses r1 as is, but r1 points to user stack.

Don't we end up in kernel_bad_stack() ?

Or we take a KUAP fault and end-up in an infinite loop ?

> 
> Interrupt return code is put into the low soft-masked region.
> 
> Critical code that has no exit work, SRRs set, soft-masked state set to
> return state, saves r1 in the PACA and then begins to run instructions
> that have an alternate return handler.
> 
> In this region, pending interrupts are checked, and if any exist then
> it branches directly to the restart handler.
> 
> If it does not branch, then no masked interrupts are pending, and if any
> interrupts do hit, we will go out the restart handler.
> 
> The restart handler re-loads the saved r1, and from there we can find
> regs, and reload critical state before setting things up to replay
> interrupts and go around the exit prepare sequence again.
> 
> Signed-off-by: Nicholas Piggin <npiggin at gmail.com>


More information about the Linuxppc-dev mailing list