[PATCH] powerpc/book3s64/kuap: SPRN_AMR modification need CSI instructions before and after

Nicholas Piggin npiggin at gmail.com
Wed Apr 22 17:45:33 AEST 2020


Excerpts from Michael Ellerman's message of April 20, 2020 5:04 pm:
> Nicholas Piggin <npiggin at gmail.com> writes:
>> Excerpts from Nicholas Piggin's message of April 20, 2020 10:17 am:
>>> Excerpts from Aneesh Kumar K.V's message of April 19, 2020 11:53 pm:
>>>> As per the ISA, context synchronizing instructions is needed before and after
>>>> SPRN_AMR update. Use isync before and the CSI after is implied by the rfid
>>>> that we will use to switch to a new context.
>>> 
>>> Not entirely sure if we need this. This will restore AMR to more 
>>> permissive, so if it executes ahead of a stray load from this
>>> context, it won't make it fault.
> 
> I thought we'd convinced ourselves it didn't matter in practice due to
> the proximity of the entry/exit.

I don't remember exactly. We can always drop the isync from the side 
that pairs with an entry or exit.

If we drop it from the other side, what it means in theory is it could 
float past some of the accesses we're doing in the interrupt context 
that we thought were protected. So we won't take faults, but it's 
possible we would let through a user access.

I think it's likey that we'd end up executing the mtspr before anything 
much can take advantage of it, but you never know, and I guess the 
problem is it becomes impossile to audit and be sure.

Thanks,
Nick


More information about the Linuxppc-dev mailing list