From: Helge Deller <deller@gmx.de>
To: John David Anglin <dave.anglin@bell.net>,
linux-parisc <linux-parisc@vger.kernel.org>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Subject: Re: [PATCH] parisc: Fix extraction of hash lock bits in syscall.S
Date: Thu, 18 Nov 2021 20:24:08 +0100 [thread overview]
Message-ID: <bce8449a-1bdb-ccc5-48cf-09a2a06751aa@gmx.de> (raw)
In-Reply-To: <df51e873-4576-d4c2-7d86-b607cbb714b4@bell.net>
On 11/18/21 18:03, John David Anglin wrote:
> 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.
Good catch!!
Did you checked if it actually happened that the most
significant 32 bits were non-zero?
If so, could this be one of the reasons we saw strange
issues or even memory corruption?
Sadly I sent a pull request to Linus a few hours ago,
otherwise I would have added this patch...
Helge
> 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)
next prev parent reply other threads:[~2021-11-18 19:24 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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=bce8449a-1bdb-ccc5-48cf-09a2a06751aa@gmx.de \
--to=deller@gmx.de \
--cc=James.Bottomley@HansenPartnership.com \
--cc=dave.anglin@bell.net \
--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