Show Your Support: Did you know that you can get Phoronix Premium for under $4 per month? Try it today to view our site ad-free, multi-page articles on a single page, and more while the proceeds allow us to write more Linux hardware reviews. At the very least, please disable your ad-blocker.
OpenSUSE's Spectre Mitigation Approach Is One Of The Reasons For Its Slower Performance
A Phoronix reader pointed out this opensuse-factory mailing list thread citing a "huge single-core performance loss" on a Lenovo laptop when using openSUSE. There's a ~21% performance loss in single-threaded performance around the Spectre Variant Two mitigations, which itself isn't surprising as we've shown time and time again about the performance costs of the Spectre/Meltdown mitigations.
OpenSUSE's kernel is using IBRS (Indirect Branch Restricted Speculation) with the latest Intel CPU microcode images while most Linux distributions are relying upon Retpolines as return trampolines. The IBRS mitigation technique has the potential of incurring more of a performance loss than Retpolines, which has been known to incur a greater performance hit due to the more restricted speculation behavior when paired with the updated Intel CPU microcode.
Switching over to Retpolines for the workload in question restored the performance, per the mailing list discussion.
OpenSUSE users wanting to use that non-default approach can opt for it using the spectre_v2=retpoline,generic kernel command line parameter, which matches the behavior of most other Linux distributions' kernels.
As for openSUSE changing their defaults, at least from the aforelinked mailing list discussion it doesn't appear their kernel engineers have any interest in changing their Spectre mitigation default but are just blaming the poor performance on Intel as their problem.
Some have also suggested the openSUSE installer pick-up a toggle within its installer for informing users of security vs. performance preferences in better providing sane/informed defaults, but so far we haven't seen any action taken to make that happen. It would make sense though considering some of openSUSE's conservative defaults do have performance ramifications compared to most other Linux distributions, which we've shown in past benchmarks, albeit just written off by openSUSE as "mostly crap."
Previously a barrier to Retpolines usage was needing the Retpolines compiler support, but that support has now been available for quite some time. There was also reported Retpolines issues with Skylake in the past, but those appear to have been resolved as well.