]> git.proxmox.com Git - mirror_ubuntu-zesty-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)
committerLuis Henriques <luis.henriques@canonical.com>
Tue, 8 Nov 2016 16:45:54 +0000 (16:45 +0000)
commita42e20d652deda346f265c00aa8032e582cd2aad
tree64ae0b495daaaafabdfcc564221c6dbc6bfcd2e0
parent0225ad4a97e6409f5f8c40ac162a27055cd37eca
arm64: percpu: rewrite ll/sc loops in assembly

BugLink: http://bugs.launchpad.net/bugs/1637510
commit 1e6e57d9b34a9075d5f9e2048ea7b09756590d11 upstream.

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.

Fixes: f97fc810798c ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
arch/arm64/include/asm/percpu.h