release 6.16.3 (preliminary)
This commit is contained in:
@@ -1,10 +1,6 @@
|
||||
From 906ed24dfc7e1bbceacc087ba38aecfd22a9890b Mon Sep 17 00:00:00 2001
|
||||
From 6b1d270f55e3143bcb3ad914adf920774351a6b9 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 and
|
||||
more micro-architecture options to the Linux kernel in three classes.
|
||||
Date: Mon, 18 Aug 2025 04:14:48 -0400
|
||||
|
||||
1. New generic x86-64 ISA levels
|
||||
|
||||
@@ -103,7 +99,7 @@ See the following experimental evidence supporting this statement:
|
||||
https://github.com/graysky2/kernel_compiler_patch?tab=readme-ov-file#benchmarks
|
||||
|
||||
REQUIREMENTS
|
||||
linux version 6.1.79+
|
||||
linux version 6.16+
|
||||
gcc version >=9.0 or clang version >=9.0
|
||||
|
||||
ACKNOWLEDGMENTS
|
||||
@@ -116,9 +112,9 @@ REFERENCES
|
||||
4. http://www.linuxforge.net/docs/linux/linux-gcc.php
|
||||
|
||||
---
|
||||
arch/x86/Kconfig.cpu | 462 ++++++++++++++++++++++++++++++++++++++++++-
|
||||
arch/x86/Makefile | 222 +++++++++++++++++++++
|
||||
2 files changed, 675 insertions(+), 9 deletions(-)
|
||||
arch/x86/Kconfig.cpu | 427 ++++++++++++++++++++++++++++++++++++++++++-
|
||||
arch/x86/Makefile | 213 ++++++++++++++++++++-
|
||||
2 files changed, 631 insertions(+), 9 deletions(-)
|
||||
|
||||
--- a/arch/x86/Kconfig.cpu
|
||||
+++ b/arch/x86/Kconfig.cpu
|
||||
@@ -163,38 +159,15 @@ REFERENCES
|
||||
|
||||
config MK6
|
||||
bool "K6/K6-II/K6-III"
|
||||
@@ -245,6 +260,435 @@ config MATOM
|
||||
@@ -281,6 +296,402 @@ config X86_GENERIC
|
||||
This is really intended for distributors who need more
|
||||
generic optimizations.
|
||||
|
||||
endchoice
|
||||
|
||||
+config CC_HAS_MARCH_NATIVE
|
||||
+ # This flag might not be available in cross-compilers:
|
||||
+ def_bool $(cc-option, -march=native)
|
||||
+ # LLVM 18 has an easily triggered internal compiler error in core
|
||||
+ # networking code with '-march=native' on certain systems:
|
||||
+ # https://github.com/llvm/llvm-project/issues/72026
|
||||
+ # LLVM 19 introduces an optimization that resolves some high stack
|
||||
+ # usage warnings that only appear wth '-march=native'.
|
||||
+ depends on CC_IS_GCC || CLANG_VERSION >= 190100
|
||||
+
|
||||
+choice
|
||||
+ prompt "x86_64 Compiler Build Optimization"
|
||||
+ depends on !X86_NATIVE_CPU
|
||||
+ default GENERIC_CPU
|
||||
+
|
||||
+config X86_NATIVE_CPU
|
||||
+ bool "Build and optimize for local/native CPU"
|
||||
+ depends on X86_64
|
||||
+ depends on CC_HAS_MARCH_NATIVE
|
||||
+ help
|
||||
+ Optimize for the current CPU used to compile the kernel.
|
||||
+ Use this option if you intend to build the kernel for your
|
||||
+ local machine.
|
||||
+
|
||||
+ Note that such a kernel might not work optimally on a
|
||||
+ different x86 machine.
|
||||
+
|
||||
+ If unsure, say N.
|
||||
+
|
||||
+config GENERIC_CPU
|
||||
+ bool "Generic-x86-64"
|
||||
+ depends on X86_64
|
||||
@@ -202,26 +175,6 @@ REFERENCES
|
||||
+ Generic x86-64 CPU.
|
||||
+ Runs equally well on all x86-64 CPUs.
|
||||
+
|
||||
+config MNATIVE_INTEL
|
||||
+ bool "Intel-Native optimizations autodetected by the compiler"
|
||||
+ help
|
||||
+
|
||||
+ Clang 3.8, GCC 4.2 and above support -march=native, which automatically detects
|
||||
+ the optimum settings to use based on your processor. Do NOT use this
|
||||
+ for AMD CPUs. Intel Only!
|
||||
+
|
||||
+ Enables -march=native
|
||||
+
|
||||
+config MNATIVE_AMD
|
||||
+ bool "AMD-Native optimizations autodetected by the compiler"
|
||||
+ help
|
||||
+
|
||||
+ Clang 3.8, GCC 4.2 and above support -march=native, which automatically detects
|
||||
+ the optimum settings to use based on your processor. Do NOT use this
|
||||
+ for Intel CPUs. AMD Only!
|
||||
+
|
||||
+ Enables -march=native
|
||||
+
|
||||
+config MK8
|
||||
+ bool "AMD Opteron/Athlon64/Hammer/K8"
|
||||
+ help
|
||||
@@ -445,20 +398,20 @@ REFERENCES
|
||||
+ Enables -march=skylake
|
||||
+
|
||||
+config MSKYLAKEX
|
||||
+ bool "Intel Skylake X"
|
||||
+ bool "Intel Skylake-X (7th Gen Core i7/i9)"
|
||||
+ depends on X86_64
|
||||
+ help
|
||||
+
|
||||
+ Select this for 6th Gen Core processors in the Skylake X family.
|
||||
+ Select this for 7th Gen Core i7/i9 processors in the Skylake-X family.
|
||||
+
|
||||
+ Enables -march=skylake-avx512
|
||||
+
|
||||
+config MCANNONLAKE
|
||||
+ bool "Intel Cannon Lake"
|
||||
+ bool "Intel Coffee Lake/Kaby Lake Refresh (8th Gen Core i3/i5/i7)"
|
||||
+ depends on X86_64
|
||||
+ help
|
||||
+
|
||||
+ Select this for 8th Gen Core processors
|
||||
+ Select this for 8th Gen Core i3/i5/i7 processors in the Coffee Lake or Kaby Lake Refresh families.
|
||||
+
|
||||
+ Enables -march=cannonlake
|
||||
+
|
||||
@@ -472,11 +425,11 @@ REFERENCES
|
||||
+ Enables -march=icelake-client
|
||||
+
|
||||
+config MICELAKE_SERVER
|
||||
+ bool "Intel Ice Lake Server"
|
||||
+ bool "Intel Ice Lake-SP (3rd Gen Xeon Scalable)"
|
||||
+ depends on X86_64
|
||||
+ help
|
||||
+
|
||||
+ Select this for 10th Gen Core server processors in the Ice Lake family.
|
||||
+ Select this for 3rd Gen Xeon Scalable processors in the Ice Lake-SP family.
|
||||
+
|
||||
+ Enables -march=icelake-server
|
||||
+
|
||||
@@ -566,10 +519,20 @@ REFERENCES
|
||||
+ depends on (CC_IS_GCC && GCC_VERSION > 130000) || (CC_IS_CLANG && CLANG_VERSION >= 150500)
|
||||
+ help
|
||||
+
|
||||
+ Select this for fifth-generation 10 nm process processors in the Emerald Rapids family.
|
||||
+ Select this for fifth-generation Xeon Scalable processors in the Emerald Rapids family.
|
||||
+
|
||||
+ Enables -march=emeraldrapids
|
||||
+
|
||||
+config MDIAMONDRAPIDS
|
||||
+ bool "Intel Diamond Rapids (7th Gen Xeon Scalable)"
|
||||
+ depends on X86_64
|
||||
+ depends on (CC_IS_GCC && GCC_VERSION > 150000) || (CC_IS_CLANG && CLANG_VERSION >= 200000)
|
||||
+ help
|
||||
+
|
||||
+ Select this for seventh-generation Xeon Scalable processors in the Diamond Rapids family.
|
||||
+
|
||||
+ Enables -march=diamondrapids
|
||||
+
|
||||
+endchoice
|
||||
+
|
||||
+config X86_64_VERSION
|
||||
@@ -596,31 +559,31 @@ REFERENCES
|
||||
+ /lib/ld-linux-x86-64.so.2 --help | grep supported
|
||||
+ /lib64/ld-linux-x86-64.so.2 --help | grep supported
|
||||
+
|
||||
config X86_GENERIC
|
||||
bool "Generic x86 support"
|
||||
depends on X86_32
|
||||
@@ -266,8 +710,8 @@ config X86_INTERNODE_CACHE_SHIFT
|
||||
#
|
||||
# Define implied options from the CPU selection here
|
||||
config X86_INTERNODE_CACHE_SHIFT
|
||||
@@ -290,8 +701,8 @@ config X86_INTERNODE_CACHE_SHIFT
|
||||
|
||||
config X86_L1_CACHE_SHIFT
|
||||
int
|
||||
- default "7" if MPENTIUM4
|
||||
- default "6" if MK7 || MPENTIUMM || MATOM || MVIAC7 || X86_GENERIC || X86_64
|
||||
+ default "7" if MPENTIUM4 || MPSC
|
||||
+ default "6" if MK7 || MK8 || MPENTIUMM || MCORE2 || MATOM || MVIAC7 || X86_GENERIC || GENERIC_CPU || MK8SSE3 || MK10 || MBARCELONA || MBOBCAT || MJAGUAR || MBULLDOZER || MPILEDRIVER || MSTEAMROLLER || MEXCAVATOR || MZEN || MZEN2 || MZEN3 || MZEN4 || MZEN5 || MNEHALEM || MWESTMERE || MSILVERMONT || MGOLDMONT || MGOLDMONTPLUS || MSANDYBRIDGE || MIVYBRIDGE || MHASWELL || MBROADWELL || MSKYLAKE || MSKYLAKEX || MCANNONLAKE || MICELAKE_CLIENT || MICELAKE_SERVER || MCASCADELAKE || MCOOPERLAKE || MTIGERLAKE || MSAPPHIRERAPIDS || MROCKETLAKE || MALDERLAKE || MRAPTORLAKE || MMETEORLAKE || MEMERALDRAPIDS || MNATIVE_INTEL || MNATIVE_AMD
|
||||
+ default "6" if MK7 || MK8 || MPENTIUMM || MCORE2 || MATOM || MVIAC7 || X86_GENERIC || GENERIC_CPU || MK8SSE3 || MK10 || MBARCELONA || MBOBCAT || MJAGUAR || MBULLDOZER || MPILEDRIVER || MSTEAMROLLER || MEXCAVATOR || MZEN || MZEN2 || MZEN3 || MZEN4 || MZEN5 || MNEHALEM || MWESTMERE || MSILVERMONT || MGOLDMONT || MGOLDMONTPLUS || MSANDYBRIDGE || MIVYBRIDGE || MHASWELL || MBROADWELL || MSKYLAKE || MSKYLAKEX || MCANNONLAKE || MICELAKE_CLIENT || MICELAKE_SERVER || MCASCADELAKE || MCOOPERLAKE || MTIGERLAKE || MSAPPHIRERAPIDS || MROCKETLAKE || MALDERLAKE || MRAPTORLAKE || MMETEORLAKE || MEMERALDRAPIDS || MDIAMONDRAPIDS || X86_NATIVE_CPU
|
||||
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
|
||||
|
||||
@@ -285,19 +729,19 @@ config X86_ALIGNMENT_16
|
||||
@@ -309,19 +720,19 @@ config X86_ALIGNMENT_16
|
||||
|
||||
config X86_INTEL_USERCOPY
|
||||
def_bool y
|
||||
- depends on MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M586MMX || X86_GENERIC || MK7 || MEFFICEON
|
||||
+ depends on MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M586MMX || X86_GENERIC || MK8 || MK7 || MEFFICEON || MCORE2 || MNEHALEM || MWESTMERE || MSILVERMONT || MGOLDMONT || MGOLDMONTPLUS || MSANDYBRIDGE || MIVYBRIDGE || MHASWELL || MBROADWELL || MSKYLAKE || MSKYLAKEX || MCANNONLAKE || MICELAKE_CLIENT || MICELAKE_SERVER || MCASCADELAKE || MCOOPERLAKE || MTIGERLAKE || MSAPPHIRERAPIDS || MROCKETLAKE || MALDERLAKE || MRAPTORLAKE || MMETEORLAKE || MEMERALDRAPIDS || MNATIVE_INTEL
|
||||
+ depends on MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M586MMX || X86_GENERIC || MK8 || MK7 || MEFFICEON || MCORE2 || MNEHALEM || MWESTMERE || MSILVERMONT || MGOLDMONT || MGOLDMONTPLUS || MSANDYBRIDGE || MIVYBRIDGE || MHASWELL || MBROADWELL || MSKYLAKE || MSKYLAKEX || MCANNONLAKE || MICELAKE_CLIENT || MICELAKE_SERVER || MCASCADELAKE || MCOOPERLAKE || MTIGERLAKE || MSAPPHIRERAPIDS || MROCKETLAKE || MALDERLAKE || MRAPTORLAKE || MMETEORLAKE || MEMERALDRAPIDS || MDIAMONDRAPIDS
|
||||
|
||||
config X86_USE_PPRO_CHECKSUM
|
||||
def_bool y
|
||||
- depends on MWINCHIP3D || MWINCHIPC6 || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || MVIAC3_2 || MVIAC7 || MEFFICEON || MGEODE_LX || MATOM
|
||||
+ depends on MWINCHIP3D || MWINCHIPC6 || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || MK8 || MVIAC3_2 || MVIAC7 || MEFFICEON || MGEODE_LX || MCORE2 || MATOM || MK8SSE3 || MK10 || MBARCELONA || MBOBCAT || MJAGUAR || MBULLDOZER || MPILEDRIVER || MSTEAMROLLER || MEXCAVATOR || MZEN || MZEN2 || MZEN3 || MZEN4 || MZEN5 || MNEHALEM || MWESTMERE || MSILVERMONT || MGOLDMONT || MGOLDMONTPLUS || MSANDYBRIDGE || MIVYBRIDGE || MHASWELL || MBROADWELL || MSKYLAKE || MSKYLAKEX || MCANNONLAKE || MICELAKE_CLIENT || MICELAKE_SERVER || MCASCADELAKE || MCOOPERLAKE || MTIGERLAKE || MSAPPHIRERAPIDS || MROCKETLAKE || MALDERLAKE || MRAPTORLAKE || MMETEORLAKE || MEMERALDRAPIDS || MNATIVE_INTEL || MNATIVE_AMD
|
||||
+ depends on MWINCHIP3D || MWINCHIPC6 || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || MK8 || MVIAC3_2 || MVIAC7 || MEFFICEON || MGEODE_LX || MCORE2 || MATOM || MK8SSE3 || MK10 || MBARCELONA || MBOBCAT || MJAGUAR || MBULLDOZER || MPILEDRIVER || MSTEAMROLLER || MEXCAVATOR || MZEN || MZEN2 || MZEN3 || MZEN4 || MZEN5 || MNEHALEM || MWESTMERE || MSILVERMONT || MGOLDMONT || MGOLDMONTPLUS || MSANDYBRIDGE || MIVYBRIDGE || MHASWELL || MBROADWELL || MSKYLAKE || MSKYLAKEX || MCANNONLAKE || MICELAKE_CLIENT || MICELAKE_SERVER || MCASCADELAKE || MCOOPERLAKE || MTIGERLAKE || MSAPPHIRERAPIDS || MROCKETLAKE || MALDERLAKE || MRAPTORLAKE || MMETEORLAKE || MEMERALDRAPIDS || MDIAMONDRAPIDS
|
||||
|
||||
config X86_TSC
|
||||
def_bool y
|
||||
@@ -634,7 +597,7 @@ REFERENCES
|
||||
|
||||
config X86_CX8
|
||||
def_bool y
|
||||
@@ -307,13 +751,13 @@ config X86_CX8
|
||||
@@ -331,12 +742,12 @@ config X86_CX8
|
||||
# generates cmov.
|
||||
config X86_CMOV
|
||||
def_bool y
|
||||
@@ -645,33 +608,16 @@ REFERENCES
|
||||
int
|
||||
default "64" if X86_64
|
||||
- default "6" if X86_32 && (MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || MVIAC3_2 || MVIAC7 || MEFFICEON || MATOM || MK7)
|
||||
- default "5" if X86_32 && X86_CX8
|
||||
+ default "6" if X86_32 && (MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || MVIAC3_2 || MVIAC7 || MEFFICEON || MATOM || MCORE2 || MK7 || MK8)
|
||||
+ default "5" if X86_32 && X86_CMPXCHG64
|
||||
default "5" if X86_32 && X86_CX8
|
||||
default "4"
|
||||
|
||||
config X86_DEBUGCTLMSR
|
||||
--- a/arch/x86/Makefile
|
||||
+++ b/arch/x86/Makefile
|
||||
@@ -173,8 +173,230 @@ else
|
||||
# Use -mskip-rax-setup if supported.
|
||||
KBUILD_CFLAGS += $(call cc-option,-mskip-rax-setup)
|
||||
|
||||
+ifdef CONFIG_X86_NATIVE_CPU
|
||||
+ KBUILD_CFLAGS += -march=native
|
||||
+ KBUILD_RUSTFLAGS += -Ctarget-cpu=native
|
||||
+endif
|
||||
+
|
||||
+ifdef CONFIG_MNATIVE_INTEL
|
||||
+ KBUILD_CFLAGS += -march=native
|
||||
+ KBUILD_RUSTFLAGS += -Ctarget-cpu=native
|
||||
+endif
|
||||
+
|
||||
+ifdef CONFIG_MNATIVE_AMD
|
||||
+ KBUILD_CFLAGS += -march=native
|
||||
+ KBUILD_RUSTFLAGS += -Ctarget-cpu=native
|
||||
+endif
|
||||
+
|
||||
@@ -177,10 +177,221 @@ ifdef CONFIG_X86_NATIVE_CPU
|
||||
KBUILD_CFLAGS += -march=native
|
||||
KBUILD_RUSTFLAGS += -Ctarget-cpu=native
|
||||
else
|
||||
+ifdef CONFIG_MK8
|
||||
+ KBUILD_CFLAGS += -march=k8
|
||||
+ KBUILD_RUSTFLAGS += -Ctarget-cpu=k8
|
||||
@@ -872,6 +818,11 @@ REFERENCES
|
||||
+ KBUILD_RUSTFLAGS += -Ctarget-cpu=emeraldrapids
|
||||
+endif
|
||||
+
|
||||
+ifdef CONFIG_MDIAMONDRAPIDS
|
||||
+ KBUILD_CFLAGS += -march=diamondrapids
|
||||
+ KBUILD_RUSTFLAGS += -Ctarget-cpu=diamondrapids
|
||||
+endif
|
||||
+
|
||||
+ifdef CONFIG_GENERIC_CPU
|
||||
+ifeq ($(CONFIG_X86_64_VERSION),1)
|
||||
KBUILD_CFLAGS += -march=x86-64 -mtune=generic
|
||||
@@ -879,8 +830,10 @@ REFERENCES
|
||||
+else
|
||||
+ KBUILD_CFLAGS +=-march=x86-64-v$(CONFIG_X86_64_VERSION)
|
||||
+ KBUILD_RUSTFLAGS += -Ctarget-cpu=x86-64-v$(CONFIG_X86_64_VERSION)
|
||||
+endif # CONFIG_X86_64_VERSION
|
||||
+endif # CONFIG_GENERIC_CPU
|
||||
|
||||
+endif
|
||||
+endif
|
||||
endif
|
||||
-
|
||||
KBUILD_CFLAGS += -mno-red-zone
|
||||
KBUILD_CFLAGS += -mcmodel=kernel
|
||||
KBUILD_RUSTFLAGS += -Cno-redzone=y
|
||||
|
Reference in New Issue
Block a user