The new patch allows the creation of Linux Kernel on the x86-64 microarchitecture functional level

A set of patches released this week, by adding support for the latest LLVM Clang and GCC compilers, allows easy creation of Linux Kernels on different x86-64 microarchitecture functional levels. In the past year, the x86-64 microarchitecture functional level has been adopted by AMD and Intel processors as a regular level, rather than just being compiled by the code compiler for each CPU/core series.

The x86-64 microarchitecture function level is very useful for HWCAPS like Glibc, and it also phases out the support for old X86-64 in many Linux distributions and other software. On the standard x86-64, the x86-64-v2 specification is roughly equivalent to Intel Nehalem and the newer SSE3/SSE4.1/SSE4.2/SSSE3, and x86-64-v3 is equivalent to the Haswell era CPU and the newer authorized AVX /AVX2/BMI2/FMA (and other extensions), and then x86-64-v4 as the latest feature level of the AVX-512 processor.

This week’s patch will add Kconfig options for building the Linux kernel. If you want to obtain a more optimized kernel by only satisfying newer processors, you can choose to target different x86-64 microarchitecture functional levels. The compiler that supports the x86-64 microarchitecture feature level is GCC 11 and newer, or LLVM Clang 12.0 and newer.

A fairly basic patch set for adding Kconfig build support around the x86-64 functional level is currently on the kernel mailing list, but I hope to enter the mainline tree soon. It will be interesting to benchmark it in practice to see how much of the impact these feature levels have on the Linux kernel of modern Intel/ AMD CPUs.

Leave a Comment