]> git.baikalelectronics.ru Git - kernel.git/commit
arm64: percpu: rewrite ll/sc loops in assembly
authorWill Deacon <will.deacon@arm.com>
Mon, 4 Jul 2016 16:44:48 +0000 (17:44 +0100)
committerWill Deacon <will.deacon@arm.com>
Wed, 19 Oct 2016 14:37:29 +0000 (15:37 +0100)
commit4ce5f8bc366b8f1b149702a3d600f1c6ac5055ed
treeb5708d14f64b03758cb18b795ef18077fdac9b55
parent4250632a725ed80d620400879e9b3e884d8a7536
arm64: percpu: rewrite ll/sc loops in assembly

Writing the outer loop of an LL/SC sequence using do {...} while
constructs potentially allows the compiler to hoist memory accesses
between the STXR and the branch back to the LDXR. On CPUs that do not
guarantee forward progress of LL/SC loops when faced with memory
accesses to the same ERG (up to 2k) between the failed STXR and the
branch back, we may end up livelocking.

This patch avoids this issue in our percpu atomics by rewriting the
outer loop as part of the LL/SC inline assembly block.

Cc: <stable@vger.kernel.org>
Fixes: 1fe609637cfb ("arm64: percpu: Implement this_cpu operations")
Reviewed-by: Mark Rutland <mark.rutland@arm.com>
Tested-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
arch/arm64/include/asm/percpu.h