Red Hat Bugzilla – Bug 1476039
Microcode on AMD family 16h processors not updated early in the boot process
Last modified: 2018-04-10 14:10:22 EDT
Created attachment 1305689 [details] Bugfix for dracut-functions.sh Description of problem: Microcode on AMD family 16h (22) processors (Jaguar microarchitecture) is not updated early in the boot process, only later. Version-Release number of selected component (if applicable): dracut-033-463.el7_3.2.x86_64 Bug is also present in current git version. How reproducible: Every time. Steps to Reproduce: 1. Boot RHEL/CentOS 7.3 on a system with AMD family 16h CPU. 2. 3. Actual results: $ dmesg | grep microcode [ 1.287156] microcode: CPU0: patch_level=0x0700010b [ 1.287168] microcode: CPU1: patch_level=0x0700010b [ 1.287180] microcode: CPU2: patch_level=0x0700010b [ 1.287192] microcode: CPU3: patch_level=0x0700010b [ 1.287250] microcode: Microcode Update Driver: v2.01 <tigran@aivazian.fsnet.co.uk>, Peter Oruba [ 8.273684] microcode: CPU0: new patch_level=0x0700010f [ 8.274709] microcode: CPU1: new patch_level=0x0700010f [ 8.275741] microcode: CPU2: new patch_level=0x0700010f [ 8.276757] microcode: CPU3: new patch_level=0x0700010f Expected results: $ dmesg | grep microcode [ 1.103284] microcode: microcode: updated early to new patch_level=0x0700010f [ 1.302144] microcode: CPU0: patch_level=0x0700010f [ 1.302158] microcode: CPU1: patch_level=0x0700010f [ 1.302170] microcode: CPU2: patch_level=0x0700010f [ 1.302178] microcode: CPU3: patch_level=0x0700010f [ 1.302245] microcode: Microcode Update Driver: v2.01 <tigran@aivazian.fsnet.co.uk>, Peter Oruba Additional info: Bug occurs on this CPU: $ lscpu processor : 0 vendor_id : AuthenticAMD cpu family : 22 model : 0 model name : AMD Athlon(tm) 5350 APU with Radeon(tm) R3 stepping : 1 microcode : 0x700010f dracut has incorrectly copied family 15h microcode into initramfs: ======================================================================== Early CPIO image ======================================================================== drwxr-xr-x 3 root root 0 Jun 20 19:48 . -rw-r--r-- 1 root root 2 Jun 20 19:48 early_cpio drwxr-xr-x 3 root root 0 Jun 20 19:48 kernel drwxr-xr-x 3 root root 0 Jun 20 19:48 kernel/x86 drwxr-xr-x 2 root root 0 Jun 20 19:48 kernel/x86/microcode -rw-r--r-- 1 root root 7876 Jun 20 19:48 kernel/x86/microcode/AuthenticAMD.bin ======================================================================== Version: dracut-033-463.el7_3.1 $ ls -l /lib/firmware/amd-ucode/ total 40 -rw-r--r--. 1 root root 12684 Nov 6 2016 microcode_amd.bin -rw-r--r--. 1 root root 490 Nov 6 2016 microcode_amd.bin.asc -rw-r--r--. 1 root root 7876 Nov 6 2016 microcode_amd_fam15h.bin -rw-r--r--. 1 root root 473 Nov 6 2016 microcode_amd_fam15h.bin.asc -rw-r--r--. 1 root root 3510 Nov 6 2016 microcode_amd_fam16h.bin -rw-r--r--. 1 root root 473 Nov 6 2016 microcode_amd_fam16h.bin.asc With the attached patch, it copies the correct family 16h microcode: ======================================================================== Early CPIO image ======================================================================== drwxr-xr-x 3 root root 0 Jun 28 23:54 . -rw-r--r-- 1 root root 2 Jun 28 23:54 early_cpio drwxr-xr-x 3 root root 0 Jun 28 23:54 kernel drwxr-xr-x 3 root root 0 Jun 28 23:54 kernel/x86 drwxr-xr-x 2 root root 0 Jun 28 23:54 kernel/x86/microcode -rw-r--r-- 1 root root 3510 Jun 28 23:54 kernel/x86/microcode/AuthenticAMD.bin ======================================================================== Version: dracut-033-463.el7_3.1 Patch will need revising when AMD family 17h (23, Zen microarchitecture) microcode is available.
Can I ask you to submit the patch to upstream gtihut, if it is not already there? https://github.com/dracutdevs/dracut/pulls
I've created a pull request https://github.com/dracutdevs/dracut/pull/261.
Just noticed this is fixed in dracut-046-2.git20170811 on Fedora 26, on my other box. I guess this just needs cherry-picking for the RHEL branch.
(In reply to Jonathan Teh from comment #0) > Patch will need revising when AMD family 17h (23, Zen microarchitecture) > microcode is available. Once we're updating dracut, we might as well handle both 16h and 17h at the same time. Extending the patch for another family is pretty straightforward: diff --git a/dracut-functions.sh b/dracut-functions.sh index 4051596b1d18..0b456f5cd2ab 100755 --- a/dracut-functions.sh +++ b/dracut-functions.sh @@ -1738,8 +1738,14 @@ get_ucode_file () local stepping=`grep -E "stepping" /proc/cpuinfo | head -1 | sed s/.*:\ //` if [[ "$(get_cpu_vendor)" == "AMD" ]]; then + # If family greater or equal than 0x17 + if [[ $family -ge 23 ]]; then + printf "microcode_amd_fam17h.bin" # If family greater or equal than 0x15 - if [[ $family -ge 21 ]]; then + elif [[ $family -ge 22 ]]; then + printf "microcode_amd_fam16h.bin" + # If family greater or equal than 0x15 + elif [[ $family -ge 21 ]]; then printf "microcode_amd_fam15h.bin" else printf "microcode_amd.bin"
Shouldn't that be: --- dracut-functions.sh.orig 2017-08-05 16:02:47.000000000 +0100 +++ dracut-functions.sh 2017-12-11 22:35:48.601627126 +0000 @@ -1737,8 +1737,12 @@ local stepping=`grep -E "stepping" /proc/cpuinfo | head -1 | sed s/.*:\ //` if [[ "$(get_cpu_vendor)" == "AMD" ]]; then - # If family greater or equal than 0x15 - if [[ $family -ge 21 ]]; then + # If family greater than or equal to 0x17 + if [[ $family -ge 23 ]]; then + printf "microcode_amd_fam17h.bin" + elif [[ $family -eq 22 ]]; then + printf "microcode_amd_fam16h.bin" + elif [[ $family -eq 21 ]]; then printf "microcode_amd_fam15h.bin" else printf "microcode_amd.bin"
Oh, you're right! I updated the code, but I forgot to update the comments. Thanks!
I will also backport: https://github.com/dracutdevs/dracut/commit/19453dc8744e6a59725c43b61b2e3db01cb4c57c
Reproduced on RHEL-7.4 GA. Verified with dracut-033-526.el7 on systems with AMD CPU, families 21 and 22. In both cases the correct microcode was included in the early CPIO image: Family 21: # cat /proc/cpuinfo | grep "cpu family" | head -n1 cpu family : 22 # ls -l /usr/lib/firmware/amd-ucode/ total 40 -rw-r--r--. 1 root root 12684 Nov 27 07:35 microcode_amd.bin -rw-r--r--. 1 root root 490 Nov 27 07:35 microcode_amd.bin.asc -rw-r--r--. 1 root root 7876 Nov 27 07:35 microcode_amd_fam15h.bin -rw-r--r--. 1 root root 473 Nov 27 07:35 microcode_amd_fam15h.bin.asc -rw-r--r--. 1 root root 3510 Nov 27 07:35 microcode_amd_fam16h.bin -rw-r--r--. 1 root root 473 Nov 27 07:35 microcode_amd_fam16h.bin.asc # lsinitrd | grep AMD -rw-r--r-- 1 root root 3510 Jan 3 10:58 kernel/x86/microcode/AuthenticAMD.bin # Family 22: # cat /proc/cpuinfo | grep "cpu family" | head -n1 cpu family : 21 # ls -l /usr/lib/firmware/amd-ucode/ total 40 -rw-r--r--. 1 root root 12684 Nov 27 07:35 microcode_amd.bin -rw-r--r--. 1 root root 490 Nov 27 07:35 microcode_amd.bin.asc -rw-r--r--. 1 root root 7876 Nov 27 07:35 microcode_amd_fam15h.bin -rw-r--r--. 1 root root 473 Nov 27 07:35 microcode_amd_fam15h.bin.asc -rw-r--r--. 1 root root 3510 Nov 27 07:35 microcode_amd_fam16h.bin -rw-r--r--. 1 root root 473 Nov 27 07:35 microcode_amd_fam16h.bin.asc # lsinitrd | grep AMD -rw-r--r-- 1 root root 7876 Jan 3 10:54 kernel/x86/microcode/AuthenticAMD.bin # Moving to VERIFIED.
*** Bug 1529311 has been marked as a duplicate of this bug. ***
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2018:0964