arm64: futex: Bound number of LDXR/STXR loops in FUTEX_WAKE_OP
authorWill Deacon <will.deacon@arm.com>
Mon, 8 Apr 2019 13:23:17 +0000 (14:23 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 11 May 2019 05:49:56 +0000 (07:49 +0200)
commit022ccef6d1c3e52148392cf17c25d6957a50e69f
tree676e5d94db0ed4f17e71fd99aacb77e6ca30c2de
parent325d0a18d3ff0d0392dcbb624f0818b7dade2420
arm64: futex: Bound number of LDXR/STXR loops in FUTEX_WAKE_OP

commit 03110a5cb2161690ae5ac04994d47ed0cd6cef75 upstream.

Our futex implementation makes use of LDXR/STXR loops to perform atomic
updates to user memory from atomic context. This can lead to latency
problems if we end up spinning around the LL/SC sequence at the expense
of doing something useful.

Rework our futex atomic operations so that we return -EAGAIN if we fail
to update the futex word after 128 attempts. The core futex code will
reschedule if necessary and we'll try again later.

Cc: <stable@kernel.org>
Fixes: 6170a97460db ("arm64: Atomic operations")
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/arm64/include/asm/futex.h