Linux PARISC architecture development
 help / color / mirror / Atom feed
* [PATCH] parisc: Fix extraction of hash lock bits in syscall.S
@ 2021-11-18 17:03 John David Anglin
  2021-11-18 19:24 ` Helge Deller
  2021-11-19 15:56 ` Helge Deller
  0 siblings, 2 replies; 7+ messages in thread
From: John David Anglin @ 2021-11-18 17:03 UTC (permalink / raw)
  To: linux-parisc; +Cc: Helge Deller, James Bottomley

The extru instruction leaves the most significant 32 bits of the target register in an undefined
state on PA 2.0 systems.  If any of these bits are nonzero, this will break the calculation of the
lock pointer.

Fix by using extrd,u instruction on 64-bit kernels.

Signed-off-by: John David Anglin <dave.anglin@bell.net>
---
diff --git a/arch/parisc/kernel/syscall.S b/arch/parisc/kernel/syscall.S
index 3f24a0af1e04..3f70528622eb 100644
--- a/arch/parisc/kernel/syscall.S
+++ b/arch/parisc/kernel/syscall.S
@@ -572,7 +572,11 @@ lws_compare_and_swap:
  	ldo	R%lws_lock_start(%r20), %r28

  	/* Extract eight bits from r26 and hash lock (Bits 3-11) */
+#ifdef CONFIG_64BIT
+	extrd,u  %r26, 60, 8, %r20
+#else
  	extru  %r26, 28, 8, %r20
+#endif

  	/* Find lock to use, the hash is either one of 0 to
  	   15, multiplied by 16 (keep it 16-byte aligned)
@@ -762,7 +761,11 @@ cas2_lock_start:
  	ldo	R%lws_lock_start(%r20), %r28

  	/* Extract eight bits from r26 and hash lock (Bits 3-11) */
+#ifdef CONFIG_64BIT
+	extrd,u  %r26, 60, 8, %r20
+#else
  	extru  %r26, 28, 8, %r20
+#endif

  	/* Find lock to use, the hash is either one of 0 to
  	   15, multiplied by 16 (keep it 16-byte aligned)

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-11-19 20:42 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-18 17:03 [PATCH] parisc: Fix extraction of hash lock bits in syscall.S John David Anglin
2021-11-18 19:24 ` Helge Deller
2021-11-18 19:47   ` John David Anglin
2021-11-18 19:55     ` John David Anglin
2021-11-19 15:56 ` Helge Deller
2021-11-19 20:27   ` John David Anglin
2021-11-19 20:41     ` Helge Deller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox