After 5 Years, FSGSBASE Support Finally Ready For Linux To Enhance AMD/Intel Performance
The Linux kernel work for making use of the x86_64 FSGSBASE instruction since Intel Ivy Bridge and since then AMD CPUs also is set to finally land with the in-development Linux 5.9 kernel. The FSGSBASE support has the possibility of helping Intel/AMD CPU performance especially in areas like context switching that had been hurt badly by Spectre/Meltdown and other CPU vulnerability mitigations largely on the Intel side.
Intel developers started the FSGSBASE Linux support around five years ago but never got through in getting it mainlined. Microsoft's Linux kernel engineer then a few months back decided to take up the work to try to get it mainlined as even Microsoft found value in the performance benefits.
In my benchmarking over the various patch series I've found performance improvements and the patches helping out well.
Thomas Gleixner who oversees this area of the Linux x86 code sent in the FSGSBASE pull request today. He noted in the PR, "Support for FSGSBASE. Almost 5 years after the first RFC to support it, this has been brought into a shape which is maintainable and actually works. This final version was done by Sasha Levin who took it up after Intel dropped the ball. Sasha discovered that the SGX (sic!) offerings out there ship rogue kernel modules enabling FSGSBASE behind the kernels back which opens an instantanious unpriviledged root hole. The FSGSBASE instructions provide a considerable speedup of the context switch path and enable user space to write GSBASE without kernel interaction."
So unless Linus Torvalds comes up with any last minute reservations around FSGSBASE, the support will be in Linux 5.9. I'll have out Linux 5.9 benchmarks, including new numbers on FSGSBASE with modern Intel/AMD CPUs soon.