LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Tor Vic <torvic9@mailbox.org>
To: Nick Desaulniers <ndesaulniers@google.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"x86@kernel.org" <x86@kernel.org>,
"clang-built-linux@googlegroups.com"
<clang-built-linux@googlegroups.com>,
"graysky@archlinux.us" <graysky@archlinux.us>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
"H. Peter Anvin" <hpa@zytor.com>,
Masahiro Yamada <masahiroy@kernel.org>
Subject: Re: [PATCH 2/2] x86, Makefile: Add new generic x86-64 settings v2/v3/v4
Date: Tue, 17 Aug 2021 18:31:06 +0000 [thread overview]
Message-ID: <ec0f00b1-04c7-9972-d28b-122964a127dd@mailbox.org> (raw)
In-Reply-To: <CAKwvOdk+fwHQDe23Ttva46tyB9yGGxB73zXzNPkcMCggSRWUdQ@mail.gmail.com>
On 17.08.21 18:22, Nick Desaulniers wrote:
> On Tue, Aug 17, 2021 at 11:17 AM Nick Desaulniers
> <ndesaulniers@google.com> wrote:
>>
>> On Tue, Aug 17, 2021 at 7:24 AM torvic9 via Clang Built Linux
>> <clang-built-linux@googlegroups.com> wrote:
>>>
>>> Add new generic x86-64 CPU tunings introduced with recent versions of
>>> gcc and clang, as documented in x86-64-psABI [1].
>>>
>>> This is taken straight from graysky's CPU optimization patch with minor
>>> modifications [2].
>>>
>>> [1] https://gitlab.com/x86-psABIs/x86-64-ABI/-/commit/77566eb03bc6a326811cb7e9a6b9396884b67c7c
>>> [2] https://github.com/graysky2/kernel_compiler_patch
>>>
>>> Signed-off-by: Tor Vic <torvic9@mailbox.org>
>>> ---
>>> arch/x86/Kconfig.cpu | 26 +++++++++++++++++++++++++-
>>> arch/x86/Makefile.cpu | 6 ++++++
>>> 2 files changed, 31 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/arch/x86/Kconfig.cpu b/arch/x86/Kconfig.cpu
>>> index 814fe0d349b0..a2c872aa5a0b 100644
>>> --- a/arch/x86/Kconfig.cpu
>>> +++ b/arch/x86/Kconfig.cpu
>>> @@ -294,6 +294,30 @@ config GENERIC_CPU
>>> Generic x86-64 CPU.
>>> Run equally well on all x86-64 CPUs.
>>>
>>> +config GENERIC_CPU_V2
>>> + bool "Generic-x86-64-v2"
>>> + depends on ( CC_IS_GCC && GCC_VERSION > 110000 ) || ( CC_IS_CLANG && CLANG_VERSION >= 120000 )
>>
>> Can we stick with either > or >=, but at least be consistent? Also,
>> there's unnecessary whitespace inside the parens that could be
>> removed.
>
> Ah, cc-option can be used from Kconfig. Perhaps a cc-option call to
> -march=x86-64-vX with a comment about which compiler versions first
> supported these (so that we can remove the feature test when the
> minimum supported toolchains are advanced) would be better?
>
That makes sense. Will do a v2.
Which of these possibilities is more "expensive"?
I remember a recent patch where some of these calls were removed.
>>
>>> + depends on X86_64
>>> + help
>>> + Generic x86-64 CPU.
>>> + Run equally well on all x86-64 CPUs with min support of x86-64-v2.
>>> +
>>> +config GENERIC_CPU_V3
>>> + bool "Generic-x86-64-v3"
>>> + depends on ( CC_IS_GCC && GCC_VERSION > 110000 ) || ( CC_IS_CLANG && CLANG_VERSION >= 120000 )
>>> + depends on X86_64
>>> + help
>>> + Generic x86-64-v3 CPU with v3 instructions.
>>> + Run equally well on all x86-64 CPUs with min support of x86-64-v3.
>>> +
>>> +config GENERIC_CPU_V4
>>> + bool "Generic-x86-64-v4"
>>> + depends on ( CC_IS_GCC && GCC_VERSION > 110000 ) || ( CC_IS_CLANG && CLANG_VERSION >= 120000 )
>>> + depends on X86_64
>>> + help
>>> + Generic x86-64 CPU with v4 instructions.
>>> + Run equally well on all x86-64 CPUs with min support of x86-64-v4.
>>> +
>>> endchoice
>>>
>>> config X86_GENERIC
>>> @@ -318,7 +342,7 @@ config X86_INTERNODE_CACHE_SHIFT
>>> config X86_L1_CACHE_SHIFT
>>> int
>>> default "7" if MPENTIUM4 || MPSC
>>> - default "6" if MK7 || MK8 || MPENTIUMM || MCORE2 || MATOM || MVIAC7 || X86_GENERIC || GENERIC_CPU
>>> + default "6" if MK7 || MK8 || MPENTIUMM || MCORE2 || MATOM || MVIAC7 || X86_GENERIC || GENERIC_CPU || GENERIC_CPU_V2 || GENERIC_CPU_V3 || GENERIC_CPU_V4
>>> default "4" if MELAN || M486SX || M486 || MGEODEGX1
>>> default "5" if MWINCHIP3D || MWINCHIPC6 || MCRUSOE || MEFFICEON || MCYRIXIII || MK6 || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || M586 || MVIAC3_2 || MGEODE_LX
>>>
>>> diff --git a/arch/x86/Makefile.cpu b/arch/x86/Makefile.cpu
>>> index fb407ae94d90..f190feefe964 100644
>>> --- a/arch/x86/Makefile.cpu
>>> +++ b/arch/x86/Makefile.cpu
>>> @@ -10,3 +10,9 @@ cflags-$(CONFIG_MCORE2) += \
>>> cflags-$(CONFIG_MATOM) += $(call cc-option,-march=atom) \
>>> $(call cc-option,-mtune=atom,$(call cc-option,-mtune=generic))
>>> cflags-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mtune=generic)
>>> +
>>> +# New generic x86-64 CPU options.
>>> +# Don't call the compiler, we have Kconfig compiler checks for these.
>>
>> You'd be surprised how quickly using time-relative words like "New"
>> bitrot. My copy of "Modern C++" already doesn't feel very "modern" for
>> example. I'd just drop the comment block here; we don't need a
>> comment every time we skip cc-option checks. Thanks for the patches!
>>
>>> +cflags-$(CONFIG_GENERIC_CPU_V2) += -march=x86-64-v2
>>> +cflags-$(CONFIG_GENERIC_CPU_V3) += -march=x86-64-v3
>>> +cflags-$(CONFIG_GENERIC_CPU_V4) += -march=x86-64-v4
>>> --
>> --
>> Thanks,
>> ~Nick Desaulniers
>
>
>
next prev parent reply other threads:[~2021-08-17 18:31 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-17 14:23 [PATCH 1/2] x86, Makefile: Move the CPU-specific 64-bit tuning settings to arch/x86/Makefile.cpu torvic9
2021-08-17 14:24 ` [PATCH 2/2] x86, Makefile: Add new generic x86-64 settings v2/v3/v4 torvic9
2021-08-17 18:17 ` Nick Desaulniers
2021-08-17 18:22 ` Nick Desaulniers
2021-08-17 18:31 ` Tor Vic [this message]
2021-08-17 18:47 ` Nick Desaulniers
2021-08-17 18:36 ` Borislav Petkov
2021-08-17 19:12 ` Tor Vic
2021-08-18 15:08 ` torvic9
2021-08-18 17:59 ` Borislav Petkov
2021-08-18 18:28 ` Tor Vic
2021-08-18 18:43 ` Borislav Petkov
2021-08-18 7:15 ` Christoph Hellwig
2021-08-18 9:46 ` torvic9
2021-08-19 21:58 ` David Laight
2021-08-17 17:58 ` [PATCH 1/2] x86, Makefile: Move the CPU-specific 64-bit tuning settings to arch/x86/Makefile.cpu Nick Desaulniers
2021-08-17 18:28 ` Tor Vic
2021-08-18 7:11 ` Christoph Hellwig
2021-08-18 9:46 ` torvic9
2021-08-18 14:51 ` Masahiro Yamada
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=ec0f00b1-04c7-9972-d28b-122964a127dd@mailbox.org \
--to=torvic9@mailbox.org \
--cc=bp@alien8.de \
--cc=clang-built-linux@googlegroups.com \
--cc=graysky@archlinux.us \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=masahiroy@kernel.org \
--cc=mingo@redhat.com \
--cc=ndesaulniers@google.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
--subject='Re: [PATCH 2/2] x86, Makefile: Add new generic x86-64 settings v2/v3/v4' \
/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
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).