Linux Kernel Prepping To Make Use Of Intel's New SERIALIZE Instruction

Written by Michael Larabel in Intel on 27 July 2020 at 07:15 AM EDT. 18 Comments
INTEL
As outlined a few months ago, Intel's future Sapphire Rapids and Alder Lake processors are set to add a SERIALIZE instruction. That SERIALIZE instruction ensures all flags/register/memory modifications are complete as well as draining all buffered writes to memory before the next instruction is executed. Linux is moving forward with preparing to make use of this new CPU instruction in its function for stopping speculative execution and prefetching of modified code.

On Sunday a patch series was sent out by an Intel Linux engineer for making use of the Intel SERIALIZE instruction within the kernel's sync_core() function. Linux's sync_core function is called for stopping the speculative execution and prefetching of modified code.

Sync_core has traditionally used CPUID within this function but there are complications with that or using IRET-to-self works on newer CPUs but is slower. Or come Sapphire Rapids and Alder Lake this new SERIALIZE instruction can be used. The performance cost of this new SERIALIZE instruction will be interesting to see in practice.

The patch notes one of the benefits of using SERIALIZE is that there are no "side effects" like clobbering of registers or exiting to a hypervisor.

Thus the work is moving forward for the Linux kernel to begin making use of SERIALIZE. The SERIALIZE instruction can also be used from user mode as well so we'll see how well adopted this instruction is by the time Sapphire Rapids and Alder Lake finally ship.

Three of the four patches in this series have already been queued up in x86/cpu as prep work while the actual SERIALIZE patch within sync_core() was said by x86/cpu maintainer Ingo Molnar as still needing more work before it will be ready. Thus the SERIALIZE usage might not make it into the upcoming Linux 5.9 cycle but come for a later release, which still should be fine given the timing of Alder Lake and Sapphire Rapids.
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