From: John David Anglin <dave.anglin@bell.net>
To: Helge Deller <deller@gmx.de>,
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 14:47:40 -0500 [thread overview]
Message-ID: <ce526095-e6b3-bb1e-aa8e-e97f85e57223@bell.net> (raw)
In-Reply-To: <bce8449a-1bdb-ccc5-48cf-09a2a06751aa@gmx.de>
On 2021-11-18 2:24 p.m., Helge Deller wrote:
> 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?
No. I tend to think the bits are always zero but the arch says they are undefined.
> If so, could this be one of the reasons we saw strange
> issues or even memory corruption?
Possibly but I wouldn't be too hopeful that it will make a big difference.
>
> Sadly I sent a pull request to Linus a few hours ago,
> otherwise I would have added this patch...
I just noticed the problem yesterday. I was looking at the failure of glibc's tst-cleanupx4:
dave@mx3210:~/gnu/glibc/objdir$ env GCONV_PATH=/home/dave/gnu/glibc/objdir/iconvdata LOCPATH=/home/dave/gnu/glibc/objdir/localedata LC_ALL=C
/home/dave/gnu/glibc/objdir/elf/ld.so.1 --library-path
/home/dave/gnu/glibc/objdir:/home/dave/gnu/glibc/objdir/math:/home/dave/gnu/glibc/objdir/elf:/home/dave/gnu/glibc/objdir/dlfcn:/home/dave/gnu/glibc/objdir/nss:/home/dave/gnu/glibc/objdir/nis:/home/dave/gnu/glibc/objdir/rt:/home/dave/gnu/glibc/objdir/resolv:/home/dave/gnu/glibc/objdir/mathvec:/home/dave/gnu/glibc/objdir/support:/home/dave/gnu/glibc/objdir/crypt:/home/dave/gnu/glibc/objdir/nptl
/home/dave/gnu/glibc/objdir/nptl/tst-cleanupx4
test 0
clh (2)
clh (1)
clh (3)
global = 12, expected 15
[...]
As far as I can tell, clh() is called in the wrong order - should be 1, 2, 3. This gives the expected value of 15. 2, 1, 3 yields 12.
This suggests our atomic operations are broken. I think the problem may be that atomic loads may need to be sequenced
with the LWS lock. While sequencing stores is obvious, this is not obvious for loads. Anyway, I starting hacking on syscall.S
to provide lws_atomic_load and lws_atomic_store operations. Currently, atomic stores are done using CAS operation. This
is less efficient than it could be.
Another little issue is "because" is misspelled in a couple of places in syscall.S.
Dave
--
John David Anglin dave.anglin@bell.net
next prev parent reply other threads:[~2021-11-18 19:47 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
2021-11-18 19:47 ` John David Anglin [this message]
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=ce526095-e6b3-bb1e-aa8e-e97f85e57223@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.