Subject: Re: powerpc/64s: Remove MSR_RI optimisation in system_call_exit()

From: Michael Ellerman <[email-masked]>
Date: Tue, 26 Feb 2019 14:27:49 +1100 (AEDT)

On Thu, 2019-01-17 at 11:35:10 UTC, Michael Ellerman wrote:
> Currently in system_call_exit() we have an optimisation where we
> disable MSR_RI (recoverable interrupt) and MSR_EE (external interrupt
> enable) in a single mtmsrd instruction.
> 
> Unfortunately this will no longer work with THREAD_INFO_IN_TASK,
> because then the load of TI_FLAGS might fault and faulting with MSR_RI
> clear is treated as an unrecoverable exception which leads to a
> panic().
> 
> So change the code to only clear MSR_EE prior to loading TI_FLAGS,
> leaving the clear of MSR_RI until later. We have some latitude in
> where do the clear of MSR_RI. A bit of experimentation has shown that
> this location gives the least slow down.
> 
> This still causes a noticeable slow down in our null_syscall
> performance. On a Power9 DD2.2:
> 
>   Before        After         Delta     Delta %
>   955 cycles    999 cycles    -44	-4.6%
> 
> On the plus side this does simplify the code somewhat, because we
> don't have to reenable MSR_RI on the restore_math() or
> syscall_exit_work() paths which was necessitated previously by the
> optimisation.
> 
> Signed-off-by: Michael Ellerman <[email-masked]>
> Reviewed-by: Nicholas Piggin <[email-masked]>

Applied to powerpc next.

https://git.kernel.org/powerpc/c/e7fda7e569e1776d4dccbcef52d34882

cheers