RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1476039 - Microcode on AMD family 16h processors not updated early in the boot process
Summary: Microcode on AMD family 16h processors not updated early in the boot process
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: dracut
Version: 7.3
Hardware: x86_64
OS: Linux
high
urgent
Target Milestone: rc
: 7.5
Assignee: Lukáš Nykrýn
QA Contact: Jeff Bastian
URL:
Whiteboard:
: 1529311 (view as bug list)
Depends On:
Blocks: CVE-2017-5715 1526943 1527310 1527311
TreeView+ depends on / blocked
 
Reported: 2017-07-27 22:22 UTC by Jonathan Teh
Modified: 2018-04-10 18:10 UTC (History)
17 users (show)

Fixed In Version: dracut-033-525.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1526943 1527310 1527311 (view as bug list)
Environment:
Last Closed: 2018-04-10 18:07:53 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Bugfix for dracut-functions.sh (646 bytes, patch)
2017-07-27 22:22 UTC, Jonathan Teh
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2018:0964 0 None None None 2018-04-10 18:10:22 UTC

Description Jonathan Teh 2017-07-27 22:22:36 UTC
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.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.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.

Comment 2 Lukáš Nykrýn 2017-07-28 12:35:35 UTC
Can I ask you to submit the patch to upstream gtihut, if it is not already there?
https://github.com/dracutdevs/dracut/pulls

Comment 3 Jonathan Teh 2017-07-29 00:36:23 UTC
I've created a pull request https://github.com/dracutdevs/dracut/pull/261.

Comment 5 Jonathan Teh 2017-08-15 22:14:41 UTC
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.

Comment 8 Jeff Bastian 2017-12-11 20:10:52 UTC
(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"

Comment 9 Jonathan Teh 2017-12-11 22:38:14 UTC
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"

Comment 10 Jeff Bastian 2017-12-12 13:13:52 UTC
Oh, you're right!  I updated the code, but I forgot to update the comments.  Thanks!

Comment 13 Lukáš Nykrýn 2017-12-18 08:50:46 UTC
I will also backport:
https://github.com/dracutdevs/dracut/commit/19453dc8744e6a59725c43b61b2e3db01cb4c57c

Comment 18 Jan Stodola 2018-01-03 16:11:47 UTC
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.

Comment 19 Lukáš Nykrýn 2018-01-04 10:29:34 UTC
*** Bug 1529311 has been marked as a duplicate of this bug. ***

Comment 22 errata-xmlrpc 2018-04-10 18:07:53 UTC
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


Note You need to log in before you can comment on or make changes to this bug.