[PATCH v3] powerpc/64: system call implement the bulk of the logic in C
Nicholas Piggin
npiggin at gmail.com
Fri Sep 6 08:29:22 AEST 2019
Christophe Leroy's on September 6, 2019 2:29 am:
>
>
> Le 05/09/2019 à 14:35, Nicholas Piggin a écrit :
>> -.Lsyscall_error_cont:
>> - ld r7,_NIP(r1)
>> BEGIN_FTR_SECTION
>> stdcx. r0,0,r1 /* to clear the reservation */
>> END_FTR_SECTION_IFCLR(CPU_FTR_STCX_CHECKS_ADDRESS)
>> - andi. r6,r8,MSR_PR
>> - ld r4,_LINK(r1)
>>
>> - kuap_check_amr r10, r11
>> + mtspr SPRN_SRR0,r4
>> + mtspr SPRN_SRR1,r5
>
> That looks dangerous. Once you have modified SRR0 and SRR1, your
> exception becomes unrecoverable, so this should be done as close as
> possible to the rfi.
Worse than that even, when we set MSR[RI]=0 the exception becomes
unrecoverable, and that happens in the C code!
> Here you seem to do many thinks inbetween,
> including restoring some registers from the stack.
The code it replaces has a pretty large non-recoverable window as
well, interrupt entry has large ones particularly for KVM. It's an
unfortunate quirk of the architecture but it's not worth getting
too worried about or sacrificing too much performance for.
I do have some later patches which improves this a lot, but that will
wait until after the interrupt return is also changed to C.
Thanks,
Nick
More information about the Linuxppc-dev
mailing list