[v2 PATCH] arm64: mm: force write fault for atomic RMW instructions

Christoph Lameter (Ampere) cl at linux.com
Thu May 23 12:43:34 PDT 2024


On Thu, 23 May 2024, Catalin Marinas wrote:

>>> While this class includes all atomics that currently require write
>>> permission, there's some unallocated space in this range and we don't
>>> know what future architecture versions may introduce. Unfortunately we
>>> need to check each individual atomic op in this class (not sure what the
>>> overhead will be).
>>
>> Can you tell us which bits or pattern is not allocated? Maybe we can exclude
>> that from the pattern.
>
> Yes, it may be easier to exclude those patterns. See the Arm ARM K.a
> section C4.1.94.29 (page 791).

Hmmm. We could consult an exception table once the pattern matches to 
reduce the overhead.

However, the harm done I think is acceptable even if we leave things as 
is. In the worst case we create unnecesssary write fault processing for an 
"atomic op" that does not need write access. Also: Why would it need to be 
atomic if it does not write???

It is more likely that new atomic ops are added that require write 
permissions. Those will then just work. Otherwise we would need to 
maintain an exception table of unallocated instructions that would then 
have to shrink depending on new atomics added.

The ultimate solution would be to change the spec so that arm processors 
can skip useless read faults.




More information about the linux-arm-kernel mailing list