Skip to content
Commit 1e570f51 authored by Dave Martin's avatar Dave Martin Committed by Will Deacon
Browse files

arm64/sve: Eliminate data races on sve_default_vl



sve_default_vl can be modified via the /proc/sys/abi/sve_default_vl
sysctl concurrently with use, and modified concurrently by multiple
threads.

Adding a lock for this seems overkill, and I don't want to think any
more than necessary, so just define wrappers using READ_ONCE()/
WRITE_ONCE().

This will avoid the possibility of torn accesses and repeated loads
and stores.

There's no evidence yet that this is going wrong in practice: this
is just hygiene.  For generic sysctl users, it would be better to
build this kind of thing into the sysctl common code somehow.

Reported-by: default avatarWill Deacon <will@kernel.org>
Signed-off-by: default avatarDave Martin <Dave.Martin@arm.com>
Link: https://lore.kernel.org/r/1591808590-20210-3-git-send-email-Dave.Martin@arm.com


[will: move set_sve_default_vl() inside #ifdef to squash allnoconfig warning]
Signed-off-by: default avatarWill Deacon <will@kernel.org>
parent 9ba6a9ef
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment