From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Michael Ellerman <mpe@ellerman.id.au>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Paul Mackerras <paulus@samba.org>,
Kumar Gala <galak@kernel.crashing.org>
Cc: linuxppc-dev <linuxppc-dev@lists.ozlabs.org>
Subject: Re: powerpc: Incorrect stw operand modifier in __set_pte_at
Date: Wed, 8 Jul 2020 18:16:54 +0200 [thread overview]
Message-ID: <582c7ca7-a7a4-9861-cd53-8e34ff10c942@csgroup.eu> (raw)
In-Reply-To: <873469922.2744.1594219513228.JavaMail.zimbra@efficios.com>
Le 08/07/2020 à 16:45, Mathieu Desnoyers a écrit :
> Hi,
>
> Reviewing use of the patterns "Un%Xn" with lwz and stw instructions
> (where n should be the operand number) within the Linux kernel led
> me to spot those 2 weird cases:
>
> arch/powerpc/include/asm/nohash/pgtable.h:__set_pte_at()
>
> __asm__ __volatile__("\
> stw%U0%X0 %2,%0\n\
> eieio\n\
> stw%U0%X0 %L2,%1"
> : "=m" (*ptep), "=m" (*((unsigned char *)ptep+4))
> : "r" (pte) : "memory");
>
> I would have expected the stw to be:
>
> stw%U1%X1 %L2,%1"
>
> and:
> arch/powerpc/include/asm/book3s/32/pgtable.h:__set_pte_at()
>
> __asm__ __volatile__("\
> stw%U0%X0 %2,%0\n\
> eieio\n\
> stw%U0%X0 %L2,%1"
> : "=m" (*ptep), "=m" (*((unsigned char *)ptep+4))
> : "r" (pte) : "memory");
>
> where I would have expected:
>
> stw%U1%X1 %L2,%1"
>
> Is it a bug or am I missing something ?
Well spotted. I guess it's definitly a bug.
Introduced 12 years ago by commit
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=9bf2b5cd
("powerpc: Fixes for CONFIG_PTE_64BIT for SMP support").
It's gone unnoticed until now it seems.
Can you submit a patch for it ?
Christophe
next prev parent reply other threads:[~2020-07-08 16:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-08 14:45 powerpc: Incorrect stw operand modifier in __set_pte_at Mathieu Desnoyers
2020-07-08 16:16 ` Christophe Leroy [this message]
2020-07-09 0:30 ` Segher Boessenkool
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=582c7ca7-a7a4-9861-cd53-8e34ff10c942@csgroup.eu \
--to=christophe.leroy@csgroup.eu \
--cc=benh@kernel.crashing.org \
--cc=galak@kernel.crashing.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mpe@ellerman.id.au \
--cc=paulus@samba.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;
as well as URLs for NNTP newsgroup(s).