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 2024746 - RFE: split microcode data from dracut initramfs image
Summary: RFE: split microcode data from dracut initramfs image
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: microcode_ctl
Version: 9.0
Hardware: x86_64
OS: Linux
medium
low
Target Milestone: rc
: ---
Assignee: Eugene Syromiatnikov
QA Contact: Jeff Bastian
URL:
Whiteboard:
Depends On: 1829601
Blocks: 1680409
TreeView+ depends on / blocked
 
Reported: 2021-11-18 20:20 UTC by Eugene Syromiatnikov
Modified: 2023-05-18 07:28 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Enhancement
Doc Text:
Clone Of: 1829601
Environment:
Last Closed: 2023-05-18 07:28:40 UTC
Type: Enhancement
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-103208 0 None None None 2021-11-18 20:25:44 UTC

Description Eugene Syromiatnikov 2021-11-18 20:20:44 UTC
+++ This bug was initially created as a clone of Bug #1829601 +++

Description of problem:
grub can load multiple initramfs images for the kernel, so we can greatly simplify the microcode_ctl rpm by creating a separate initramfs image for the microcode data instead of calling dracut to rebuild images.  This will solve a number of problems including:
  * stale microcode in dracut initramfs images
  * possible corruption of initramfs images from the rebuild
  * slow installation of microcode_ctl if many initramfs images have to rebuild

The basic idea:
1. Disable early_microcode in dracut.conf
2. Generate a microcode.img cpio archive with just the microcode data
3. Update grub config to load both the microcode.img and initramfs.img

Proof-of-concept:

#!/bin/bash
set -x
dracut --force --no-early-microcode
mkdir /tmp/ucode
pushd /tmp/ucode
echo 1 > early_cpio
mkdir -p kernel/x86/microcode
CPU=$(lscpu | grep -e CPU.family: -e Model: -e Stepping: |
              awk '{printf("%02x\n", $NF)}' | sed ':a;N;s/\n/-/;ta')
cp $(rpm -ql microcode_ctl | grep $CPU) \
   kernel/x86/microcode/GenuineIntel.bin
find . -depth -print0 | cpio -o0ca > /boot/microcode.img
if ! grep -q microcode.img /boot/loader/entries/*$(uname -r).conf ; then
   sed -i 's@^initrd@initrd /microcode.img@' \
       /boot/loader/entries/*$(uname -r).conf
fi
popd
rm -fr /tmp/ucode



This proof-of-concept will need to be modified to take into account blacklisted microcodes such as 06-4f-01, but the general idea works:

[root@localhost ~]# uname -r
4.18.0-193.el8.x86_64

[root@localhost ~]# ./ucode.sh 
+ dracut --force --no-early-microcode
+ mkdir /tmp/ucode
+ pushd /tmp/ucode
/tmp/ucode ~
+ echo 1
+ mkdir -p kernel/x86/microcode
++ grep -e CPU.family: -e Model: -e Stepping:
++ awk '{printf("%02x\n", $NF)}'
++ sed ':a;N;s/\n/-/;ta'
++ lscpu
+ CPU=06-3a-09
++ rpm -ql microcode_ctl
++ grep 06-3a-09
+ cp /usr/share/microcode_ctl/ucode_with_caveats/intel/intel-ucode/06-3a-09 kernel/x86/microcode/GenuineIntel.bin
+ find . -depth -print0
+ cpio -o0ca
30 blocks
++ uname -r
+ grep -q microcode.img /boot/loader/entries/27f9c9713df84e30b1d04ff61926bfc7-4.18.0-193.el8.x86_64.conf
++ uname -r
+ sed -i 's@^initrd@initrd /microcode.img@' /boot/loader/entries/27f9c9713df84e30b1d04ff61926bfc7-4.18.0-193.el8.x86_64.conf
+ popd
~
+ rm -fr /tmp/ucode

[root@localhost ~]# grep initrd /boot/loader/entries/27f9c9713df84e30b1d04ff61926bfc7-4.18.0-193.el8.x86_64.conf
initrd /microcode.img /initramfs-4.18.0-193.el8.x86_64.img $tuned_initrd

[root@localhost ~]# lsinitrd /boot/initramfs-4.18.0-193.el8.x86_64.img | grep -e microcode -e GenuineIntel.bin
Arguments: --force --no-early-microcode
microcode_ctl-fw_dir_override

[root@localhost ~]# reboot
...

[root@localhost ~]# uptime
 16:51:30 up 1 min,  1 user,  load average: 0.64, 0.34, 0.13

[root@localhost ~]# journalctl --dmesg --no-hostname --output short-monotonic --grep microcode
-- Logs begin at Wed 2020-04-29 12:50:09 EDT, end at Wed 2020-04-29 16:50:45 EDT. --
[    0.000000] kernel: microcode: microcode updated early to revision 0x21, date = 2019-02-13
[    2.143464] kernel: microcode: sig=0x306a9, pf=0x10, revision=0x21
[    2.148961] kernel: microcode: Microcode Update Driver: v2.2.

Comment 6 RHEL Program Management 2023-05-18 07:28:40 UTC
After evaluating this issue, there are no plans to address it further or fix it in an upcoming release.  Therefore, it is being closed.  If plans change such that this issue will be fixed in an upcoming release, then the bug can be reopened.


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