AMD’s next-gen Zen 4 processors are about to get a nifty performance bump with the Linux 6.3 kernel as advanced Spectre mitigations are implemented. The Automatic IBRS mitigation for Spectre V2 is a step up from the primitive retpoline mitigation currently used by most Intel and AMD processors. The Zen 4 core brings a new feature called Automatic IBRS. (Indirect Branch Restricted Speculation). Unlike retpoline, it is a hardware-based mitigation that performs better than existing models.
The said mitigation will be added via three patches. Patch 1 adds support for the CPUID_8000_0021_EAX leaf that has the bit that identifies X86_FEATURE_AUTOIBRS. Patch 2 adds support for Auto IBRS. Patch 3 makes the Auto IBRS feature available for VM guests. Phoronix conducted some testing to determine the performance gains over retpoline.
Using a Ryzen 9 7950X, it was found that the hardware-based mitigation technique provides a nominal performance boost of 2-4%, with certain server workloads like Redis seeing an uplift of 22%. Keep in mind that this optimization will also affect the Epyc Genoa CPUs. Like Intel’s Sapphire Rapids-SP, they feature support for a slew of advanced instructions like AVX-512, where they beat the Xeons. Unfortunately, it will be a while before Auto IBRS is rolled out across a wider range of systems.