The Mitigation Impact Difference On AMD Ryzen 9 3900X vs. Intel Core i9 9900K Performance
Last week I shared benchmark results of the AMD Ryzen 9 3900X vs. Intel Core i9 9900K in 400+ benchmarks in the largest comparison ever for these two competing ~$500 USD processors. If that wasn't enough, I repeated the hundreds of CPU/system benchmarks again but without any of the recent CPU security mitigations in place to see how the situation would have played out pre-2018.
Immediately following those tests last week, I restarted the large benchmark queue with the 300+ system/CPU tests (foregoing the gaming benchmarks with the various CPU speculative execution vulnerabilities having little impact on gaming/graphics performance). As a reminder, both the Intel and AMD systems were tested on Ubuntu 19.10 with the Linux 5.3 kernel and all of the other latest software components for this H2'2019 update to Ubuntu Linux.
The Core i9 9900K was running with the ASUS PRIME Z390-A motherboard and the Ryzen 9 3900X with the ROG CROSSHAIR VIII HERO WiFi motherboard, both boards using their very latest public BIOS releases as of testing. Both systems were tested with the same GSKILL 2 x 8GB DDR4-3600 memory, 280GB Intel Optane 900p NVMe SSD, and Radeon RX Vega 64 graphics card.
With this second round of testing for the Core i9 9900K vs. Ryzen 9 3900X, the same kernels were booted but using the "mitigations=off" flag for disabling all of the Spectre / Zombieload mitigations as relevant to each of the processors.
In the case of the Core i9 9900K with its partial hardware mitigations, it's not affected by L1TF/Foreshadow or Meltdown. But it still has mitigations for MDS with mitigations of clear buffers, Spectre V4 speculative store bypass via prctl and seccomp interfaces, Spectre V1 mitigations with usercopy/SWAPGS barriers and __user pointer sanitization, and Spectre V2 mitigations with generic retpoline IBPB, conditional IBRS_FW STIBP, and conditional RSB filling.
The Zen 2 CPU with the Ryzen 9 3900X has various hardware mitigations but still relies upon seccomp and prctl interfaces for speculative store bypass (Spectre V4), Spectre V1 mitigations with usercopy/SWAPGS barriers and __user pointer sanitization, and Spectre V2 mitigations via AMD Retpoline IBPB, conditional STIBP with always-on RSB filling. AMD Ryzen 3000 series CPUs are still relying upon "always-on" RSB filling for this return stack buffer behavior rather than conditional. Technically this is over-applying the mitigation compared to Intel's "conditional" filling and that conditional filling also being what is done for EPYC 7002 series processors. I haven't heard back from AMD if/when they will issue a microcode update to change the default behavior to conditional RSB filling but if doing so that can help their performance further by default. SMT / Hyper Threading was kept on for all of these tests.
Even with the Core i9 9900K and Ryzen 9 3900X shipping with some hardware mitigations in place, disabling the mitigations with "mitigations=off" does still boost the performance. Here is the geometric mean from the 322 benchmarks carried out on both systems:
The unmitigated Core i9 9900K comes slightly ahead of the mitigated Ryzen 9 3900X results, but avoiding the mitigations on the AMD Zen 2 CPU still helps out a bit. Across the 322 benchmarks, going without the mitigations improved the Core i9 9900K performance by 5.7% while the Ryzen 9 3900X performance unmitigated went up by just under 4%. So, yes, even with these latest Intel/AMD CPUs having some hardware mitigations, there still is some costs involved. Of course, of the 300+ benchmarks, many of them are workloads not involving the kernel or areas where the mitigations play a role. So the rest of this article is looking at some of the relevant workloads of the benchmarks carried out.