Intel Preps The Linux Kernel For LKGS - Part Of FRED

Written by Michael Larabel in Intel on 7 October 2022 at 10:30 AM EDT. Add A Comment
INTEL --
Intel on Thursday sent out the initial Linux kernel patches for supporting the LKGS instruction coming with future processors.

LKGS is a new x86_64 instruction Intel originally documented last year as part of FRED, the Flexible Return and Event Delivery specification. The Flexible Return and Event Delivery (FRED) specification overhauls how transitions are handled between privilege levels / CPU rings with goals of allowing lower latency transitions between privilege levels and allowing for more robust software use.

The LKGS instruction is added as part of FRED but also can be supported independent of that change to processor interrupt handling. LKGS is a new instruction for managing the state of the GS segment register in a more flexible manner. LKGS stands for "load into IA32_KERNEL_GS_BASE" and similar to MOV to GS except for loading into the kernel GS base MSR rather than the GS segment's descriptor cache.


LKGS is documented as part of FRED with the specification originally published last year.

These kernel patches out on Thursday add LKGS instruction support by the Linux kernel independent of FRED. Intel engineer Xin Li commented, "LKGS behaves like the MOV to GS instruction except that it loads the base address into the IA32_KERNEL_GS_BASE MSR instead of the GS segment’s descriptor cache, which is exactly what Linux kernel does to load user level GS base. Thus, with LKGS, there is no need to SWAPGS away from the kernel GS base."

I don't believe Intel has publicly commented on when to expect FRED support with their processors, but based on the timing of these patches coming up now, FRED and LKGS might be found with Xeon Scalable "Emerald Rapids" and then Meteor Lake on the client side.
Related News
About The Author
Author picture

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