Linux 5.1 Getting A Minor Spectre V2 Retpolines Optimization For Select Instances
Written by Michael Larabel in Linux Security on 8 March 2019 at 12:02 AM EST. 20 Comments
LINUX SECURITY --
As the latest on the Spectre/Meltdown front for the Linux kernel, the in-development Linux 5.1 kernel is bringing an optimization for Retpolines "return trampolines" so GCC will generate more efficient code on x86/x86_64 in its mitigations against Spectre Variant Two.

The x86/build updates for Linux 5.1 brings a change to raise the limit for generating indirect calls from switch cases.

The actual commit explains, "Recent work on XDP from Björn and Magnus additionally found that manually transforming the XDP return code switch statement with more than 5 cases into if-else combination would result in a considerable speedup in XDP layer due to avoidance of indirect calls in CONFIG_RETPOLINE enabled builds. On i40e driver with XDP prog attached, a 20-26% speedup has been observed."

With the newest Linux Git code, the CFLAGS specifies a threshold of 20 now rather than 4~5 to avoid generating these expensive indirect jumps subject to Retpolines. This is only relevant on x86/x86_64 and when using the GCC compiler with the Linux kernel but in select switch cases should help in generating faster code.
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 10,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 or contacted via MichaelLarabel.com.

Related Linux Security News
Popular News This Week