The Linux kernel will not get support for the fsgsbase instructions from Intel any time soon

From LinuxReviews
Jump to navigationJump to search

Intel submitted some patches which added support for the four FSGSBASE CPU assembler instructions to the kernel tip staging area two weeks ago. These were promptly shut down by kernel maintainer Thomas Gleixner on the grounds that they have "serious bugs" and they weren't even tested before they were submitted to the kernel mailing list. That is not something anyone wants in very critical kernel pathways.

The assembler instructions rdfsbase, rdgsbase, wrfsbase and wrgsbase which make up the FSGSBASE family have been supported by Intel and AMD CPUs for a very long time. AMD CPUs had them in the now ancient Bulldozer CPUs launched in 2011. The GNU GCC compiler supports them and it is possible to compile user-space programs using them to load general-purpose registers with the FS or GS segment base address. It is just the Linux Kernel that lacks code for taking advantage of these instructions. And it will not get any such support any time soon since the patches Intel submitted with support for these instructions were unacceptable.


Kernel developer and maintainer Thomas Gleixner warned Intel about their lack of professionalism back in March:

"So little or no benefit was measured. I don't see how that maps to your 'SWAPGS will be a lot faster' claim. One of those claims is obviously wrong.

Aside of this needs more than numbers:

1) Proper documentation how the mixed bag is managed.

2) Extensive comments explaining the subtle inner workings and caveats.

3) Proper changelogs.

You have a track record of not caring much about either of these, but I very much care for good reasons. I've been bitten by glued on and half baked patches from Intel in the past 10 years so many times, that I'm simply refusing to take anything which is not properly structured and documented.

Especially not when it is touching sensitive areas like this and also has an impact on the user space ABI."

This did not stop two Intel assets from trying to sneak bad code into the kernel during the 5.3 merge-window. They almost succeed, their code made it all the way into the kernels git tip tree.

Thomas Gleixner has now removed the bad code in kernel git tip commit 049331f277fef1c3f2527c2c9afa1d285e9a1247 and apologized deeply for letting it get as far as it did.

"The confidence in those changes has become close to zero especially as the test cases which have been shipped with that series were obviously never run before sending the final series out to LKML.

./fsgsbase_64 >/dev/null
Segmentation fault

As the merge window is close, the only sane decision is to revert FSGSBASE support. The revert is necessary as this branch has been merged into perf/core already and rebasing all of that a few days before the merge window is not the most brilliant idea.

I could definitely slap myself for not noticing the test case fail when merging that series, but TBH my expectations weren't that low back then. Won't happen again."

Thomas Gleixner in kernel git tip commit 049331f277fef1c3f2527c2c9afa1d285e9a1247

We do feel compelled to point out that while Intel's major incompetence and lack of professionalism in this matter is inexcusable and beyond belief they did in fact submit patches in an attempt to make the kernel take advantage of the rdfsbase, rdgsbase, wrfsbase and wrgsbase instructions. AMD CPUs do in fact have support for these instructions yet there has been absolutely no effort by AMD to add kernel support for fsgsbase instructions. Intel did at least bother to show up with something.

published 2019-07-06last edited 2019-07-06

Add your comment
LinuxReviews welcomes all comments. If you do not want to be anonymous, register or log in. It is free.

latest kernel news: