diff options
author | Will Deacon <will.deacon@arm.com> | 2016-06-02 18:40:07 +0100 |
---|---|---|
committer | Will Deacon <will.deacon@arm.com> | 2016-06-15 11:23:14 +0100 |
commit | c56bdcac153e60d96a619a59c7981f2a78cba598 (patch) | |
tree | 059c7c94fd3b0b0e608a993724108583ee6219f3 /arch/arm64/kernel/kgdb.c | |
parent | 3a5facd09da848193f5bcb0dea098a298bc1a29d (diff) | |
download | linux-stable-c56bdcac153e60d96a619a59c7981f2a78cba598.tar.gz linux-stable-c56bdcac153e60d96a619a59c7981f2a78cba598.tar.bz2 linux-stable-c56bdcac153e60d96a619a59c7981f2a78cba598.zip |
arm64: spinlock: Ensure forward-progress in spin_unlock_wait
Rather than wait until we observe the lock being free (which might never
happen), we can also return from spin_unlock_wait if we observe that the
lock is now held by somebody else, which implies that it was unlocked
but we just missed seeing it in that state.
Furthermore, in such a scenario there is no longer a need to write back
the value that we loaded, since we know that there has been a lock
hand-off, which is sufficient to publish any stores prior to the
unlock_wait because the ARm architecture ensures that a Store-Release
instruction is multi-copy atomic when observed by a Load-Acquire
instruction.
The litmus test is something like:
AArch64
{
0:X1=x; 0:X3=y;
1:X1=y;
2:X1=y; 2:X3=x;
}
P0 | P1 | P2 ;
MOV W0,#1 | MOV W0,#1 | LDAR W0,[X1] ;
STR W0,[X1] | STLR W0,[X1] | LDR W2,[X3] ;
DMB SY | | ;
LDR W2,[X3] | | ;
exists
(0:X2=0 /\ 2:X0=1 /\ 2:X2=0)
where P0 is doing spin_unlock_wait, P1 is doing spin_unlock and P2 is
doing spin_lock.
Signed-off-by: Will Deacon <will.deacon@arm.com>
Diffstat (limited to 'arch/arm64/kernel/kgdb.c')
0 files changed, 0 insertions, 0 deletions