Proposed: Allow Building The Linux Kernel With x86-64 Microarchitecture Feature Levels

Written by Michael Larabel in Linux Kernel on 18 August 2021 at 06:00 AM EDT. 29 Comments
LINUX KERNEL
A set of two patches posted this week would allow the Linux kernel to be easily built with the different x86-64 micro-architecture feature levels supported by the latest LLVM Clang and GCC compilers.

Rather than just having per-CPU/core family targeting by the code compilers, over the past year the "x86-64 micro-architecture feature levels" have gained adoption as some common levels for both AMD and Intel processors to group CPU capabilities into a few tiers.

The x86-64 micro-architecture feature levels is useful for matters like Glibc's HWCAPS, phasing out older x86-64 support in Linux distributions or other software, and similar use-cases.

Over standard x86-64, the x86-64-v2 specification translates to roughly Intel Nehalem and newer with SSE3/SSE4.1/SSE4.2/SSSE3, x86-64-v3 to Haswell era CPUs and newer with mandating AVX / AVX2 / BMI2 / FMA (and other extensions), or then x86-64-v4 as the latest feature level with AVX-512 processors.

The patches this week would add Kconfig options for building the Linux kernel to optionally target the different x86-64 micro-architecture feature levels if desiring a more optimized kernel by catering to only a newer set of processors.

Compilers supporting the x86-64 micro-architecture feature levels are GCC 11 and newer or LLVM Clang 12.0 and newer.

The rather basic set of patches adding the Kconfig build support around x86-64 feature levels is currently on the kernel mailing list but will hopefully make it soon to the mainline tree. It will be fun to benchmark it in practice though to see how much of an impact the feature levels have on the Linux kernel with modern Intel/AMD CPUs.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week