Linux Landing XMM Register Rollback Workaround For AMD Zen 1 / Zen 2 CPUs

Written by Michael Larabel in AMD on 12 March 2023 at 12:08 PM EDT. 6 Comments
AMD
Sent in this morning via x86/urgent for integration into Linux 6.3 and also for back-porting to stable kernel series is disabling the XSAVES instruction for AMD Zen 1 and Zen 2 processors to workaround an AMD processor erratum made public last year.

Last July AMD published Erratum 1386 that is about the XSAVES instruction use may fail to save XMM registers to the provided state save area. Affected Zen 1 / Zen 2 processors could find their XMM register values to be effectively rolled back to a previous value from the same process. AMD was working around this issue for the aging Zen 1 and Zen 2 processors via a system BIOS update providing the latest AMD CPU microcode.

AMD Erratum documentation


But as this doesn't affect Zen 3 and newer processors, not all system/motherboard vendors were pushing out corrected firmware with updated microcode or not otherwise running new enough Linux distributions for otherwise obtaining the more recent AMD CPU microcode binaries. Thus recently there were some Linux bug reports around this %xmm register values occasionally being reverted to earlier values due to AMD Zen 1 / Zen 2 systems on older microcode versions.

Sent in as the sole patch of today's x86/urgent pull request ahead of Linux 6.3-rc2 is a patch to disable the XSAVES instruction for AMD Zen 1 and Zen 2 (Family 17h) processors, thereby also working around this known erratum. Once the patch lands in the mainline Linux 6.3 Git in the next few hours, it will then be on its way to back-porting to the stable Linux kernel series.

AMD Ryzen Zen 1 / Zen 1+ CPUs


Disabling the XSAVES instruction on these older AMD CPUs is fine. The instruction is for saving the processor extended states and for the affected processors they have no supervisor XSAVE states so it can fallback to using the XSAVEC instruction just fine, which is not affected by this bug.

So with tonight's Linux 6.3-rc2 release this kernel workaround for AMD Erratum 1386 should be in place and then in the days ahead for prior stable kernel versions for benefiting AMD Zen 1 / Zen 2 owners on CPU microcode prior to mid-2022.

Update: The workaround has been merged.
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