Linux PARISC architecture development
 help / color / mirror / Atom feed
From: John David Anglin <dave.anglin@bell.net>
To: linux-parisc <linux-parisc@vger.kernel.org>
Cc: Helge Deller <deller@gmx.de>,
	James Bottomley <James.Bottomley@HansenPartnership.com>
Subject: [PATCH] parisc: Fix extraction of hash lock bits in syscall.S
Date: Thu, 18 Nov 2021 12:03:51 -0500	[thread overview]
Message-ID: <df51e873-4576-d4c2-7d86-b607cbb714b4@bell.net> (raw)

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)

             reply	other threads:[~2021-11-18 17:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-18 17:03 John David Anglin [this message]
2021-11-18 19:24 ` [PATCH] parisc: Fix extraction of hash lock bits in syscall.S 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=df51e873-4576-d4c2-7d86-b607cbb714b4@bell.net \
    --to=dave.anglin@bell.net \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=deller@gmx.de \
    --cc=linux-parisc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox