arm64: spinlock: retry trylock operation if strex fails on free lock
authorCatalin Marinas <catalin.marinas@arm.com>
Fri, 31 May 2013 15:30:58 +0000 (16:30 +0100)
committerMark Brown <broonie@linaro.org>
Wed, 14 May 2014 11:16:14 +0000 (12:16 +0100)
commitec2a2a7f53125cf8e1c9ec40fa433909521647c2
tree14ed2d73f4fbbd0fbc3642b110f7b8c18945a3c1
parentff5ec2d401f7ab457cece4b1c00587e8af26d74c
arm64: spinlock: retry trylock operation if strex fails on free lock

commit 4ecf7ccb1973fd826456b6ab1e6dfafe9023c753 upstream.

An exclusive store instruction may fail for reasons other than lock
contention (e.g. a cache eviction during the critical section) so, in
line with other architectures using similar exclusive instructions
(alpha, mips, powerpc), retry the trylock operation if the lock appears
to be free but the strex reported failure.

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Reported-by: Tony Thompson <anthony.thompson@arm.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Cc: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 42b5bb47a62b7b2d8cd0b9af58f914c5e83ef76e)
Signed-off-by: Mark Brown <broonie@linaro.org>
arch/arm64/include/asm/spinlock.h