[PATCH] powerpc/64s: Remove MSR_RI optimisation in system_call_exit()

Michael Ellerman mpe at ellerman.id.au
Mon Feb 4 23:15:16 AEDT 2019


Nicholas Piggin <npiggin at gmail.com> writes:

> Michael Ellerman's on January 17, 2019 9:35 pm:
>> 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 <mpe at ellerman.id.au>
>
> Reviewed-by: Nicholas Piggin <npiggin at gmail.com>
>
> But only because spectre and meltdown broke my spirit.

😭😭😭😭😭😭😭😭😭😭

Thanks for reviewing it anyway.

cheers


More information about the Linuxppc-dev mailing list