From: Michael Ellerman <mpe@ellerman.id.au>
To: Segher Boessenkool <segher@kernel.crashing.org>,
Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: linux-kernel@vger.kernel.org, npiggin@gmail.com,
Paul Mackerras <paulus@samba.org>,
linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH v4 1/2] powerpc/uaccess: Implement unsafe_put_user() using 'asm goto'
Date: Wed, 06 May 2020 11:36:00 +1000 [thread overview]
Message-ID: <87lfm5dev3.fsf@mpe.ellerman.id.au> (raw)
In-Reply-To: <20200505155944.GO31009@gate.crashing.org>
Segher Boessenkool <segher@kernel.crashing.org> writes:
> On Tue, May 05, 2020 at 05:40:21PM +0200, Christophe Leroy wrote:
>> >>+#define __put_user_asm_goto(x, addr, label, op) \
>> >>+ asm volatile goto( \
>> >>+ "1: " op "%U1%X1 %0,%1 # put_user\n" \
>> >>+ EX_TABLE(1b, %l2) \
>> >>+ : \
>> >>+ : "r" (x), "m<>" (*addr) \
>> >
>> >The "m<>" here is breaking GCC 4.6.3, which we allegedly still support.
>> >
>> >Plain "m" works, how much does the "<>" affect code gen in practice?
>> >
>> >A quick diff here shows no difference from removing "<>".
>>
>> It was recommended by Segher, there has been some discussion about it on
>> v1 of this patch, see
>> https://patchwork.ozlabs.org/project/linuxppc-dev/patch/4fdc2aba6f5e51887d1cd0fee94be0989eada2cd.1586942312.git.christophe.leroy@c-s.fr/
>>
>> As far as I understood that's mandatory on recent gcc to get the
>> pre-update form of the instruction. With older versions "m" was doing
>> the same, but not anymore.
>
> Yes. How much that matters depends on the asm. On older CPUs (6xx/7xx,
> say) the update form was just as fast as the non-update form. On newer
> or bigger CPUs it is usually executed just the same as an add followed
> by the memory access, so it just saves a bit of code size.
The update-forms are stdux, sthux etc. right?
I don't see any change in the number of those with or without the
constraint. That's using GCC 9.3.0.
>> Should we ifdef the "m<>" or "m" based on GCC
>> version ?
>
> That will be a lot of churn. Just make 4.8 minimum?
As I said in my other mail that's not really up to us. We could mandate
a higher minimum for powerpc, but I'd rather not.
I think for now I'm inclined to just drop the "<>", and we can revisit
in a release or two when hopefully GCC 4.8 has become the minimum.
cheers
next prev parent reply other threads:[~2020-05-06 1:38 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-17 17:08 [PATCH v4 1/2] powerpc/uaccess: Implement unsafe_put_user() using 'asm goto' Christophe Leroy
2020-04-17 17:08 ` [PATCH v4 2/2] powerpc/uaccess: Implement unsafe_copy_to_user() as a simple loop Christophe Leroy
2020-05-29 4:24 ` Michael Ellerman
2020-05-05 14:27 ` [PATCH v4 1/2] powerpc/uaccess: Implement unsafe_put_user() using 'asm goto' Michael Ellerman
2020-05-05 15:32 ` Segher Boessenkool
2020-05-06 0:58 ` Michael Ellerman
2020-05-06 17:58 ` Segher Boessenkool
2020-05-06 18:10 ` Christophe Leroy
2020-05-06 22:18 ` Segher Boessenkool
2020-05-05 15:40 ` Christophe Leroy
2020-05-05 15:59 ` Segher Boessenkool
2020-05-06 1:36 ` Michael Ellerman [this message]
2020-05-06 18:09 ` Segher Boessenkool
2020-05-29 4:24 ` Michael Ellerman
2020-06-11 22:43 ` Nick Desaulniers
2020-06-11 23:52 ` Segher Boessenkool
2020-06-12 21:33 ` Nick Desaulniers
2020-06-13 1:08 ` Segher Boessenkool
2020-06-13 6:46 ` Christophe Leroy
2020-06-13 10:47 ` Michael Ellerman
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=87lfm5dev3.fsf@mpe.ellerman.id.au \
--to=mpe@ellerman.id.au \
--cc=christophe.leroy@csgroup.eu \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=npiggin@gmail.com \
--cc=paulus@samba.org \
--cc=segher@kernel.crashing.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).