[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZvS8UhWRlfd5PjEn@xsang-OptiPlex-9020>
Date: Thu, 26 Sep 2024 09:43:46 +0800
From: Oliver Sang <oliver.sang@...el.com>
To: John <therealgraysky@...ton.me>
CC: <oe-lkp@...ts.linux.dev>, <lkp@...el.com>, <linux-kernel@...r.kernel.org>,
Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>,
Borislav Petkov <bp@...en8.de>, Dave Hansen <dave.hansen@...ux.intel.com>,
Unknown <x86@...nel.org>, "H. Peter Anvin" <hpa@...or.com>,
<oliver.sang@...el.com>
Subject: Re: [PATCH] x86: add more x86-64 micro-architecture levels
hi, John,
On Tue, Sep 24, 2024 at 05:40:36PM +0000, John wrote:
> On Tuesday, September 24th, 2024 at 3:00 AM, kernel test robot <oliver.sang@...el.com> wrote:
>
> > early crash happens 70 times out of 500 runs.
> > for parent, keeps clean when we run same tests almost 1000 times.
>
> Many thanks for this rigorous testing. Would you mind using the current revision of this patch (attached)
with this version, we cannot reproduced the early crash issue.
like previous version (178c2862ab0388f7de1ca23b7b4), we still apply new version
upon 70ad4cfb4d4a9f97. we run tests up to 1000 times.
70ad4cfb4d4a9f97 178c2862ab0388f7de1ca23b7b4 e9725b726c3c0bd129959c308fb
---------------- --------------------------- ---------------------------
fail:runs %reproduction fail:runs %reproduction fail:runs
| | | | |
:991 7% 70:500 0% :1000 dmesg.BUG:kernel_failed_in_early-boot_stage,last_printk:early_console_in_setup_code
> or accessible at my github linked below?
>
> https://github.com/graysky2/kernel_compiler_patch
> From 718155e6164b4bec45bcba8814c3f82e84f36db0 Mon Sep 17 00:00:00 2001
> From: graysky <therealgraysky AT proton DOT me>
> Date: Mon, 16 Sep 2024 14:47:03 -0400
>
> FEATURES
> This patch adds additional tunings via new x86-64 ISA levels to the
> Linux kernel.
>
> These are selectable under:
> Processor type and features ---> x86-64 compiler ISA level
>
> ??? x86-64 A value of (1) is the default
> ??? x86-64-v2 A value of (2) brings support for vector
> instructions up to Streaming SIMD Extensions 4.2 (SSE4.2)
> and Supplemental Streaming SIMD Extensions 3 (SSSE3), the
> POPCNT instruction, and CMPXCHG16B.
> ??? x86-64-v3 A value of (3) adds vector instructions up to AVX2, MOVBE,
> and additional bit-manipulation instructions.
>
> There is also x86-64-v4 but including this makes little sense as
> the kernel does not use any of the AVX512 instructions anyway.
>
> Users of glibc 2.33 and above can see which level is supported by running:
> /lib/ld-linux-x86-64.so.2 --help | grep supported
> Or
> /lib64/ld-linux-x86-64.so.2 --help | grep supported
>
> BENEFITS
> Small but real speed increases are measurable using a make endpoint comparing
> a generic kernel to one built with one of the respective microarchs.
>
> See the following experimental evidence supporting this statement:
> https://github.com/graysky2/kernel_compiler_patch?tab=readme-ov-file#benchmarks
>
> REQUIREMENTS
> linux version 6.8-rc3+
> gcc version >=9.0 or clang version >=9.0
>
> ACKNOWLEDGMENTS
> This patch builds on the seminal work by Jeroen.[2]
>
> REFERENCES
> 1. https://gitlab.com/x86-psABIs/x86-64-ABI/-/commit/77566eb03bc6a326811cb7e9
> 2. http://www.linuxforge.net/docs/linux/linux-gcc.php
>
> ---
> arch/x86/Kconfig.cpu | 24 ++++++++++++++++++++++++
> arch/x86/Makefile | 11 +++++++++--
> 2 files changed, 33 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/Kconfig.cpu b/arch/x86/Kconfig.cpu
> index 2a7279d80460..562a273be222 100644
> --- a/arch/x86/Kconfig.cpu
> +++ b/arch/x86/Kconfig.cpu
> @@ -308,6 +308,30 @@ config X86_GENERIC
> This is really intended for distributors who need more
> generic optimizations.
>
> +config X86_64_VERSION
> + int "x86-64 compiler ISA level"
> + range 1 3
> + depends on (CC_IS_GCC && GCC_VERSION > 110000) || (CC_IS_CLANG && CLANG_VERSION >= 120000)
> + depends on X86_64 && GENERIC_CPU
> + help
> + Specify a specific x86-64 compiler ISA level.
> +
> + There are three x86-64 ISA levels that work on top of
> + the x86-64 baseline, namely: x86-64-v2, x86-64-v3, and x86-64-v4.
> +
> + x86-64-v2 brings support for vector instructions up to Streaming SIMD
> + Extensions 4.2 (SSE4.2) and Supplemental Streaming SIMD Extensions 3
> + (SSSE3), the POPCNT instruction, and CMPXCHG16B.
> +
> + x86-64-v3 adds vector instructions up to AVX2, MOVBE, and additional
> + bit-manipulation instructions.
> +
> + x86-64-v4 is not included since the kernel does not use AVX512 instructions
> +
> + You can find the best version for your CPU by running one of the following:
> + /lib/ld-linux-x86-64.so.2 --help | grep supported
> + /lib64/ld-linux-x86-64.so.2 --help | grep supported
> +
> #
> # Define implied options from the CPU selection here
> config X86_INTERNODE_CACHE_SHIFT
> diff --git a/arch/x86/Makefile b/arch/x86/Makefile
> index 801fd85c3ef6..e1f88f846bed 100644
> --- a/arch/x86/Makefile
> +++ b/arch/x86/Makefile
> @@ -178,14 +178,21 @@ else
> cflags-$(CONFIG_MPSC) += -march=nocona
> cflags-$(CONFIG_MCORE2) += -march=core2
> cflags-$(CONFIG_MATOM) += -march=atom
> - cflags-$(CONFIG_GENERIC_CPU) += -mtune=generic
> + ifeq ($(CONFIG_X86_64_VERSION),1)
> + cflags-$(CONFIG_GENERIC_CPU) += -mtune=generic
> + rustflags-$(CONFIG_GENERIC_CPU) += -Ztune-cpu=generic
> + else
> + cflags-$(CONFIG_GENERIC_CPU) += -march=x86-64-v$(CONFIG_X86_64_VERSION)
> + rustflags-$(CONFIG_GENERIC_CPU) += -Ctarget-cpu=x86-64-v$(CONFIG_X86_64_VERSION)
> + endif
> + cflags-$(CONFIG_MATOM) += -march=bonnell
> + cflags-$(CONFIG_MCORE2) += -march=core2
> KBUILD_CFLAGS += $(cflags-y)
>
> rustflags-$(CONFIG_MK8) += -Ctarget-cpu=k8
> rustflags-$(CONFIG_MPSC) += -Ctarget-cpu=nocona
> rustflags-$(CONFIG_MCORE2) += -Ctarget-cpu=core2
> rustflags-$(CONFIG_MATOM) += -Ctarget-cpu=atom
> - rustflags-$(CONFIG_GENERIC_CPU) += -Ztune-cpu=generic
> KBUILD_RUSTFLAGS += $(rustflags-y)
>
> KBUILD_CFLAGS += -mno-red-zone
> --
> 2.46.1
>
Powered by blists - more mailing lists