From: Dave Hansen <dave.hansen@intel.com>
To: John <therealgraysky@proton.me>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
Unknown <x86@kernel.org>, "H. Peter Anvin" <hpa@zytor.com>
Subject: Re: [PATCH] x86: add more x86-64 micro-architecture levels
Date: Sun, 15 Sep 2024 04:40:04 -0700 [thread overview]
Message-ID: <e5081e3b-0f14-4e1e-975a-a4fd22944fc7@intel.com> (raw)
In-Reply-To: <W22JX8eWQctCiWIDKGjx4IUU4ZgYmKa1zPOZSKHHVZ74zpUEmVV1VoPMMNcyc-zhraUayW0d4d7OIUYZHuiEqllnAc1tB8DthZahsHZuw0Y=@proton.me>
On 9/15/24 04:05, John wrote:
> +config MAMD_CPU_V2
> + bool "AMD x86-64-v2"
> + depends on (CC_IS_GCC && GCC_VERSION > 110000) || (CC_IS_CLANG && CLANG_VERSION >= 120000)
> + depends on X86_64
> + help
> + AMD x86-64 CPU with v2 instructions.
> + Run equally well on all AMD x86-64 CPUs with min support of -march=x86-64-v2.
If these are going to be exposed to end users, we need *some* kind of
help text that helps end users select among these options and what the
pitfalls are.
I actually don't have the foggiest idea what an "AMD x86-64 CPU with v2
instructions" even is. Even saying "AMD x86-64 CPU" isn't super helpful
because "AMD x86_64" is kinda a generic way to refer to all the 64-bit
x86 CPUs, Intel included.
I assume that the compilers have grouped the CPUs into epochs that have
some similarity. That's great and all, but we need to tell users what
those are.
Why are there v4's for both AMD and Intel that do the exact same thing?
+ cflags-$(CONFIG_MAMD_CPU_V4) += -march=x86-64-v4
...
+ cflags-$(CONFIG_MINTEL_CPU_V4) += -march=x86-64-v4
Why is this copied and pasted six times?
+ depends on (CC_IS_GCC && GCC_VERSION > 110000)...
I'm also _kinda_ surprised we don't have some kind of Kconfig option to
just pass random flags into the compiler. That would be another way to
do this. That would also be a, maybe, 10-line patch.
Alternatively, anyone wanting to do this could just hack their makefile
or (I assume) pass CFLAGS= into the build command-line. Why is
something like that insufficient.
In the *WORST* case, we shouldn't be doing this with bools. Do this:
config X86_MARCH_VER
int "Compiler Micro-Architecture Level"
range 2 4
depends on (CC_IS_GCC && GCC_VERSION > 110000) ||
(CC_IS_CLANG && CLANG_VERSION >= 120000)
depends on EXPERT
depends on X86_64
help
Specify a specific compiler "micro-architecture" version.
You might want to do this when...
You can find the best version for your CPU here...
The pitfalls of this option are...
Then you can do fun like:
config X86_L1_CACHE_SHIFT
int
default "7" if MPENTIUM4 || MPSC
+ default "6" if MK7 || MK8 || MPENTIUMM || MCORE2 || ...
+ X86_MARCH_VER >= 2
which has the added advantage of never needing to be touched when v5
gets added.
Oh, and this:
> config X86_HAVE_PAE
> def_bool y
> - depends on MCRUSOE || MEFFICEON || MCYRIXIII || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || MK8 || MVIAC7 || MCORE2 || MATOM || X86_64
> + depends on MCRUSOE || MEFFICEON || MCYRIXIII || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || MK8 || MVIAC7 || MCORE2 || MATOM || X86_64 || MAMD_CPU_V2 || MAMD_CPU_V3 || MAMD_CPU_V4 || MINTEL_CPU_V2 || MINTEL_CPU_V3 || MINTEL_CPU_V4
is rather silly when M*_CPU_V* all:
depends on X86_64
right?
So, taking a step back: Please convince us that this is something we
want to expose to end users in the first place, as opposed to having
them hack makefiles or just allowing users a string instead of using the
existing CONFIG_M* Kconfig options.
Then, we can discuss the structure of these options. Should these
"versions" be new "Processor family" options? Or, should they be
_instead_ of selecting a "Processor family"
Then, should the new Kconfig options be a series of bools, or an int?
Last, how do we deal with multiple vendors? Or do we need it at all?
I'm not actually sure at all why this has the AMD versus Intel
distinction at all.
next prev parent reply other threads:[~2024-09-15 11:40 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-15 11:05 [PATCH] x86: add more x86-64 micro-architecture levels John
2024-09-15 11:40 ` Dave Hansen [this message]
2024-09-15 12:25 ` John
2024-09-15 12:58 ` Dave Hansen
2024-09-15 18:42 ` John
2024-09-17 18:22 ` John
2024-09-17 18:45 ` H. Peter Anvin
2024-09-15 12:49 ` Borislav Petkov
2024-09-15 12:53 ` Dave Hansen
2024-09-17 21:33 ` Hanabishi
2024-09-18 19:02 ` John
2024-09-18 20:25 ` Hanabishi
2024-09-18 21:14 ` John
2024-09-18 21:48 ` Hanabishi
2024-09-18 23:07 ` John
2024-09-16 5:14 ` WangYuli
2024-09-24 7:00 ` kernel test robot
2024-09-24 13:38 ` Dave Hansen
2024-09-24 17:40 ` John
2024-09-26 1:43 ` Oliver Sang
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=e5081e3b-0f14-4e1e-975a-a4fd22944fc7@intel.com \
--to=dave.hansen@intel.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=therealgraysky@proton.me \
--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