Skip to content

Commit fcc65ab

Browse files
danglin44gregkh
authored andcommitted
parisc: Fix double-word compare and exchange in LWS code on 32-bit kernels
commit 374b3bf8e8b519f61eb9775888074c6e46b3bf0c 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: f4125cfdb300 ("parisc: Avoid trashing sr2 and sr3 in LWS code"). Signed-off-by: John David Anglin <dave.anglin@bell.net> Tested-by: Christoph Biedl <debian.axhn@manchmal.in-ulm.de> Fixes: 8920649 ("parisc: Implement new LWS CAS supporting 64 bit operations.") Signed-off-by: Helge Deller <deller@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 558ca24 commit fcc65ab

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

arch/parisc/kernel/syscall.S

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -740,7 +740,7 @@ lws_compare_and_swap_2:
740740
10: ldd 0(%r25), %r25
741741
11: ldd 0(%r24), %r24
742742
#else
743-
/* Load new value into r22/r23 - high/low */
743+
/* Load old value into r22/r23 - high/low */
744744
10: ldw 0(%r25), %r22
745745
11: ldw 4(%r25), %r23
746746
/* Load new value into fr4 for atomic store later */
@@ -832,11 +832,11 @@ cas2_action:
832832
copy %r0, %r28
833833
#else
834834
/* Compare first word */
835-
19: ldw,ma 0(%r26), %r29
835+
19: ldw 0(%r26), %r29
836836
sub,= %r29, %r22, %r0
837837
b,n cas2_end
838838
/* Compare second word */
839-
20: ldw,ma 4(%r26), %r29
839+
20: ldw 4(%r26), %r29
840840
sub,= %r29, %r23, %r0
841841
b,n cas2_end
842842
/* Perform the store */

0 commit comments

Comments
 (0)