Linux Landing XMM Register Rollback Workaround For AMD Zen 1 / Zen 2 CPUs
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.
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.
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.
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.
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.
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.
6 Comments