Commit 37250ecf authored by John David Anglin's avatar John David Anglin Committed by Thadeu Lima de Souza Cascardo

parisc: Fix double-word compare and exchange in LWS code on 32-bit kernels

BugLink: http://bugs.launchpad.net/bugs/1729107

commit 374b3bf8 upstream.

As discussed on the debian-hppa list, double-wordcompare and exchange
operations fail on 32-bit kernels.  Looking at the code, I realized that
the ",ma" completer does the wrong thing in the  "ldw,ma  4(%r26), %r29"
instruction.  This increments %r26 and causes the following store to
write to the wrong location.

Note by Helge Deller:
The patch applies cleanly to stable kernel series if this upstream
commit is merged in advance:
f4125cfd ("parisc: Avoid trashing sr2 and sr3 in LWS code").
Signed-off-by: default avatarJohn David Anglin <dave.anglin@bell.net>
Tested-by: default avatarChristoph Biedl <debian.axhn@manchmal.in-ulm.de>
Fixes: 89206491 ("parisc: Implement new LWS CAS supporting 64 bit operations.")
Signed-off-by: default avatarHelge Deller <deller@gmx.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent d676839b
...@@ -740,7 +740,7 @@ lws_compare_and_swap_2: ...@@ -740,7 +740,7 @@ lws_compare_and_swap_2:
10: ldd 0(%r25), %r25 10: ldd 0(%r25), %r25
11: ldd 0(%r24), %r24 11: ldd 0(%r24), %r24
#else #else
/* Load new value into r22/r23 - high/low */ /* Load old value into r22/r23 - high/low */
10: ldw 0(%r25), %r22 10: ldw 0(%r25), %r22
11: ldw 4(%r25), %r23 11: ldw 4(%r25), %r23
/* Load new value into fr4 for atomic store later */ /* Load new value into fr4 for atomic store later */
...@@ -832,11 +832,11 @@ cas2_action: ...@@ -832,11 +832,11 @@ cas2_action:
copy %r0, %r28 copy %r0, %r28
#else #else
/* Compare first word */ /* Compare first word */
19: ldw,ma 0(%r26), %r29 19: ldw 0(%r26), %r29
sub,= %r29, %r22, %r0 sub,= %r29, %r22, %r0
b,n cas2_end b,n cas2_end
/* Compare second word */ /* Compare second word */
20: ldw,ma 4(%r26), %r29 20: ldw 4(%r26), %r29
sub,= %r29, %r23, %r0 sub,= %r29, %r23, %r0
b,n cas2_end b,n cas2_end
/* Perform the store */ /* Perform the store */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment