]> git.baikalelectronics.ru Git - kernel.git/commit
arm64: spinlock: fix spin_unlock_wait for LSE atomics
authorWill Deacon <will.deacon@arm.com>
Wed, 8 Jun 2016 14:10:57 +0000 (15:10 +0100)
committerWill Deacon <will.deacon@arm.com>
Wed, 15 Jun 2016 08:51:36 +0000 (09:51 +0100)
commitb508f6de5e872d7710d0667944534565168929f7
tree179c031fe6a5e8d9ce4b27ea966a2e09356bf847
parentc3931aa2a328c13a65c499390b248309e62c8452
arm64: spinlock: fix spin_unlock_wait for LSE atomics

Commit dc7cb7ce99cd ("arm64: spinlock: serialise spin_unlock_wait against
concurrent lockers") fixed spin_unlock_wait for LL/SC-based atomics under
the premise that the LSE atomics (in particular, the LDADDA instruction)
are indivisible.

Unfortunately, these instructions are only indivisible when used with the
-AL (full ordering) suffix and, consequently, the same issue can
theoretically be observed with LSE atomics, where a later (in program
order) load can be speculated before the write portion of the atomic
operation.

This patch fixes the issue by performing a CAS of the lock once we've
established that it's unlocked, in much the same way as the LL/SC code.

Fixes: dc7cb7ce99cd ("arm64: spinlock: serialise spin_unlock_wait against concurrent lockers")
Signed-off-by: Will Deacon <will.deacon@arm.com>
arch/arm64/include/asm/spinlock.h