From: hpa@zytor.com
To: Borislav Petkov <bp@suse.de>
Cc: Logan Gunthorpe <logang@deltatee.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Tony Luck <tony.luck@intel.com>,
Al Viro <viro@zeniv.linux.org.uk>,
the arch/x86 maintainers <x86@kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: Question Regarding ERMS memcpy
Date: Sat, 04 Mar 2017 16:23:17 -0800 [thread overview]
Message-ID: <BF3D2B38-BC19-4B66-840E-6E9DF9C3E649@zytor.com> (raw)
In-Reply-To: <20170305001447.kcxignj3nsq35vci@pd.tnic>
On March 4, 2017 4:14:47 PM PST, Borislav Petkov <bp@suse.de> wrote:
>On Sat, Mar 04, 2017 at 03:55:27PM -0800, hpa@zytor.com wrote:
>> For newer processors, as determined by -mtune=, it is actually the
>> best option for an arbitrary copy.
>
>So his doesn't have ERMS - it is a SNB - so if for SNB REP_GOOD is
>the best option for memcpy, then we should probably build with
>-fno-builtin-memcpy unconditionally. Otherwise gcc apparently inserts
>its own memcpy variant.
>
>And this is probably wrong because we do the detection at boot time and
>not at build time.
>
>For example here it generates REP; MOVSL for the call in
>drivers/firmware/dmi_scan.c::dmi_scan_machine() which looks wrong to
>me.
>Length is 32 so it could just as well do REP; MOVSQ.
>
>IOW, we could do something like this:
>
>---
>diff --git a/arch/x86/Makefile b/arch/x86/Makefile
>index 2d449337a360..c1b68d147b8d 100644
>--- a/arch/x86/Makefile
>+++ b/arch/x86/Makefile
>@@ -142,10 +142,7 @@ ifdef CONFIG_X86_X32
> endif
> export CONFIG_X86_X32_ABI
>
>-# Don't unroll struct assignments with kmemcheck enabled
>-ifeq ($(CONFIG_KMEMCHECK),y)
>- KBUILD_CFLAGS += $(call cc-option,-fno-builtin-memcpy)
>-endif
>+KBUILD_CFLAGS += $(call cc-option,-fno-builtin-memcpy)
>
> # Stackpointer is addressed different for 32 bit and 64 bit x86
> sp-$(CONFIG_X86_32) := esp
What are the compilation flags? It may be that gcc still does TRT depending on this call site. I'd check what gcc6 or 7 generates, though.
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
next prev parent reply other threads:[~2017-03-05 0:23 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-04 20:08 Logan Gunthorpe
2017-03-04 22:43 ` Borislav Petkov
[not found] ` <c675a6c8-e87a-ece2-2350-cdd079b1b610@deltatee.com>
2017-03-04 23:55 ` hpa
2017-03-05 0:14 ` Borislav Petkov
2017-03-05 0:23 ` hpa [this message]
2017-03-05 0:33 ` Borislav Petkov
2017-03-05 0:56 ` hpa
2017-03-05 9:50 ` Borislav Petkov
2017-03-05 11:18 ` Borislav Petkov
2017-03-05 13:05 ` Borislav Petkov
2017-03-05 19:19 ` Linus Torvalds
2017-03-05 19:54 ` Borislav Petkov
2017-03-05 20:19 ` Linus Torvalds
2017-03-06 7:01 ` Logan Gunthorpe
2017-03-06 7:28 ` H. Peter Anvin
2017-03-06 17:12 ` Logan Gunthorpe
2017-03-06 18:53 ` hpa
2017-03-06 13:33 ` Borislav Petkov
2017-03-06 13:41 ` hpa
2017-03-06 14:00 ` Borislav Petkov
2017-03-05 4:58 ` Logan Gunthorpe
2017-03-05 9:54 ` Borislav Petkov
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=BF3D2B38-BC19-4B66-840E-6E9DF9C3E649@zytor.com \
--to=hpa@zytor.com \
--cc=bp@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=logang@deltatee.com \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=tony.luck@intel.com \
--cc=viro@zeniv.linux.org.uk \
--cc=x86@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
all inboxes | Powered by JetHome®