Intel FSGSBASE Linux Support Revived For A Performance Boost On Intel/AMD Processors

Written by Michael Larabel in Intel on 24 April 2020 at 12:09 PM EDT. 5 Comments
INTEL
Earlier this month I reported that Linux developers were reviving work on the Intel FSGSBASE patches as a performance helper going back to Ivy Bridge CPUs but for which past patch series never got over the finish line for mainlining. On Thursday a new version of the FSGSBASE patches were sent out.

One of Microsoft's Linux kernel hacker, Sasha Levin, has taken up the patches in trying to get the mainlined with Intel seemingly not in a rush to get the patches merged that have been sent out a few times in recent years. He explained with the revised patches:
Currently a user process that wishes to read or write the FS/GS base must make a system call. But recent X86 processors have added new instructions for use in 64-bit mode that allow direct access to the FS and GS segment base addresses. The operating system controls whether applications can use these instructions with a %cr4 control bit.

In addition to benefits to applications, performance improvements to the OS context switch code are possible by making use of these instructions. A third party reported out promising performance numbers out of their initial benchmarking of the previous version of this patch series.

We were the ones last year benchmarking the Linux FS/GS BASE patches and at the time did find them to indeed help the performance in various workloads. I'll be testing these newer patches soon. In those benchmarks from last year, the patches provided around a 3% performance boost in tested workloads.


FSGSBASE support is found on Intel CPUs going back to Ivy Bridge. On the AMD side the support is there at least for Zen. The presence of the capability can be found by checking for "fsgsbase" within /proc/cpuinfo.

Here's to hoping these performance-helping patches will get reviewed and ready for inclusion in Linux 5.8, especially given these patches help in particular for workloads previously hurt by the Spectre/Meltdown/SWAPGS mitigation patches.

With this tenth revision to the FSGSBASE patches, the code is re-based against Linux 5.7-rc1 and various workarounds applied. Stay tuned for benchmarks.
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