Intel microcode linux что это

Microcode

Processor manufacturers release stability and security updates to the processor microcode. These updates provide bug fixes that can be critical to the stability of your system. Without them, you may experience spurious crashes or unexpected system halts that can be difficult to track down.

All users with an AMD or Intel CPU should install the microcode updates to ensure system stability.

Microcode updates are usually shipped with the motherboard’s firmware and applied during firmware initialization. Since OEMs might not release firmware updates in a timely fashion and old systems do not get new firmware updates at all, the ability to apply CPU microcode updates during boot was added to the Linux kernel. The Linux microcode loader supports three loading methods:

  1. Early loading updates the microcode very early during boot, before the initramfs stage, so it is the preferred method. This is mandatory for CPUs with severe hardware bugs, like the Intel Haswell and Broadwell processor families.
  2. Late loading updates the microcode after booting which could be too late since the CPU might have already tried to use a bugged instruction set. Even if already using early loading, late loading can still be used to apply a newer microcode update without needing to reboot.
  3. Built-in microcode can be compiled into the kernel that is then applied by the early loader.

Contents

Early loading

Installation

Depending on the processor, install the following package:

Microcode must be loaded by the boot loader. Because of the wide variability in users’ early-boot configuration, microcode updates may not be triggered automatically by Arch’s default configuration. Many AUR kernels have followed the path of the official Arch kernels in this regard.

These updates must be enabled by adding /boot/amd-ucode.img or /boot/intel-ucode.img as the first initrd in the bootloader config file. This is before the normal initrd file. See below for instructions for common bootloaders.

In the following sections replace cpu_manufacturer with your CPU manufacturer, i.e. amd or intel .

Configuration

This article or section needs expansion.

Enabling early microcode loading in custom kernels

In order for early loading to work in custom kernels, «CPU microcode loading support» needs to be compiled into the kernel, not compiled as a module. This will enable the «Early load microcode» prompt which should be set to Y .

grub-mkconfig will automatically detect the microcode update and configure GRUB appropriately. After installing the microcode package, regenerate the GRUB config to activate loading the microcode update by running:

Alternatively, users that manage their GRUB config file manually can add /boot/cpu_manufacturer-ucode.img (or /cpu_manufacturer-ucode.img if /boot is a separate partition) as follows:

Читайте также:  Как открыть журнал загрузки windows 10

Repeat it for each menu entry.

systemd-boot

Use the initrd option to load the microcode, before the initial ramdisk, as follows:

The latest microcode cpu_manufacturer-ucode.img must be available at boot time in your EFI system partition (ESP). The ESP must be mounted as /boot in order to have the microcode updated every time amd-ucode or intel-ucode is updated. Otherwise, copy /boot/cpu_manufacturer-ucode.img to your ESP at every update of the microcode package.

Unified kernel images

For unified kernel images, first generate the initrd to integrate by creating a new one as follows:

EFISTUB

Append two initrd= options:

rEFInd

Edit boot options in /boot/refind_linux.conf and add initrd=boot\cpu_manufacturer-ucode.img (or initrd=cpu_manufacturer-ucode.img if /boot is a separate partition) as the first initramfs. For example:

Users employing manual stanzas in esp/EFI/refind/refind.conf to define the kernels should simply add initrd=boot\cpu_manufacturer-ucode.img (or initrd=cpu_manufacturer-ucode.img if /boot is a separate partition) as required to the options line, and not in the main part of the stanza. E.g.:

Syslinux

Multiple initrd’s can be separated by commas in /boot/syslinux/syslinux.cfg :

LILO and potentially other old bootloaders do not support multiple initrd images. In that case, cpu_manufacturer-ucode.img and initramfs-linux.img will have to be merged into one image.

To merge both images into one image named initramfs-merged.img , the following command can be used:

Now, edit /etc/lilo.conf to load the new image.

And run lilo as root:

Late loading

Late loading of microcode updates happens after the system has booted. It uses files in /usr/lib/firmware/amd-ucode/ and /usr/lib/firmware/intel-ucode/ .

For AMD processors the microcode update files are provided by linux-firmware .

For Intel processors no package provides the microcode update files (FS#59841). To use late loading you need to manually extract intel-ucode/ from Intel’s provided archive.

Enabling late microcode updates

Unlike early loading, late loading of microcode updates on Arch Linux are enabled by default using /usr/lib/tmpfiles.d/linux-firmware.conf . After boot the file gets parsed by systemd-tmpfiles-setup.service(8) and CPU microcode gets updated.

To manually reload the microcode, e.g. after updating the microcode files in /usr/lib/firmware/amd-ucode/ or /usr/lib/firmware/intel-ucode/ , run:

This allows to apply newer microcode updates without rebooting the system. For linux-firmware you can automate it with a pacman hook, e.g.:

Disabling late microcode updates

For AMD systems the CPU microcode will get updated even if amd-ucode is not installed since the files in /usr/lib/firmware/amd-ucode/ are provided by the linux-firmware package (FS#59840).

For virtual machines and containers (FS#46591) it is not possible to update the CPU microcode, so you may want to disable microcode updates. To do so, you must override the tmpfile /usr/lib/tmpfiles.d/linux-firmware.conf that is provided by linux-firmware . It can be done by creating a file with the same filename in /etc/tmpfiles.d/ :

Verifying that microcode got updated on boot

Check the kernel messages with journalctl to see if the microcode has been updated:

On Intel systems one should see something similar to the following on every boot, indicating that microcode is updated very early on:

It is entirely possible, particularly with newer hardware, that there is no microcode update for the CPU. In that case, the output may look like this:

Читайте также:  Windows firewall правило для rdp

On AMD systems using early loading the output would look something like this:

On AMD systems using late loading the output will show the version of the old microcode before reloading the microcode and the new one once it is reloaded. It would look something like this:

Which CPUs accept microcode updates

Users may consult either Intel or AMD at the following links to see if a particular model is supported:

Detecting available microcode update

It is possible to find out if the intel-ucode.img contains a microcode image for the running CPU with iucode-tool .

  1. Installintel-ucode (changing initrd is not required for detection)
  2. Installiucode-tool
  3. Load the cpuid kernel module:
  4. Extract microcode image and search it for your cpuid:
  5. If an update is available, it should show up below selected microcodes
  6. The microcode might already be in your vendor bios and not show up loading in dmesg. Compare to the current microcode running grep microcode /proc/cpuinfo

Источник

Microcode (Русский)

Производители процессоров выпускают обновления стабильности и безопасности для микрокода процессора. Несмотря на то, что микрокод можно обновить с помощью BIOS, ядро Linux также может применять эти обновления во время загрузки. Эти обновления предоставляют исправления ошибок, которые могут быть критичны для стабильности вашей системы. Без этих обновлений вы можете наблюдать ложные падения или неожиданные зависания системы, которые может быть сложно отследить.

Особенно пользователи процессоров семейства Intel Haswell и Broadwell должны установить эти обновления, чтобы обеспечить стабильность системы. Но, понятное дело, все пользователи должны устанавливать эти обновления.

Contents

Установка

Для процессоров AMD установите пакет amd-ucode .

Для процессоров Intel установите пакет intel-ucode .

Если Arch находится на съемном носителе, вы должны установить микрокод для обоих производителей процессоров.

Включение раннего обновления микрокода

Микрокод должен быть загружен загрузчиком. Из-за большого разнообразия конфигураций ранней загрузки у пользователей обновления микрокода могут быть не применены автоматически конфигурацией Arch по умолчанию. Многие ядра в AUR пошли по пути официальных ядер Arch в этом вопросе.

Чтобы применить эти обновления, добавьте /boot/amd-ucode.img или /boot/intel-ucode.img в качестве первого initrd в конфигурационном файле загрузчика. Это в дополнение к обычному initrd файлу. Смотрите ниже инструкции для популярных загрузчиков.

Автоматический способ

Утилита grub-mkconfig автоматически определит обновления микрокода и настроит соответственным образом GRUB. После установки пакета микрокода, перегенерируйте настройки GRUB, чтобы включить обновление микрокода при запуске:

Ручной способ

Альтернативно пользователи, управляющие настройками GRUB вручную, могут добавить /boot/производитель_цп-ucode.img (или /производитель_цп-ucode.img , если есть отдельный раздел /boot ) следующим образом:

Повторите это для каждой записи в меню.

systemd-boot

Используйте параметры initrd для загрузки микрокода перед исходным ramdisk следующим образом:

Самый последний микрокод производитель_цп-ucode.img должен быть доступен во время загрузки вашего системного раздела EFI (ESP). ESP должен быть смонтирован как /boot , чтобы обновлять микрокод каждый раз, когда обновляется amd-ucode или intel-ucode . В противном случае копируйте /boot/производитель_цп-ucode.img в ваш ESP при каждом обновлении пакета микрокода.

EFI boot stub / EFI handover

Добавьте два параметра initrd= :

The factual accuracy of this article or section is disputed.

Для ядер, которые были сгенерированы как один файл, содержащий все initrd, cmdline и ядро, сначала сгенерируйте initrd для интеграции, создав новый, следующим образом:

Читайте также:  Available windows operating systems

rEFInd

Отредактируйте опции загрузки в /boot/refind_linux.conf также как в примере EFI boot stub выше, например:

Пользователи, использующие ручные строфы в esp/EFI/refind/refind.conf для определения ядер, должны просто добавить initrd=/boot/производитель_цп-ucode.img (или /производитель_цп-ucode.img , если есть отдельный раздел /boot ), как требуется для строки опций, а не в основной части строфы. Например:

Syslinux

Несколько файлов initrd могут быть разделены запятыми в /boot/syslinux/syslinux.cfg :

LILO и потенциально другие старые загрузчики не поддерживают несколько образов initrd. В этом случае необходимо объединить производитель_цп-ucode.img и initramfs-linux.img в один образ.

Чтобы объединить образы в один initramfs-merged.img , можно использовать следующую команду:

Теперь отредактируйте /etc/lilo.conf для загрузки нового образа.

И запустите lilo от суперпользователя:

Позднее обновление микрокода

Поздняя загрузка обновления микрокода происходит после запуска системы. Для этого используются файлы в /usr/lib/firmware/amd-ucode/ и /usr/lib/firmware/intel-ucode/ .

Для процессоров AMD файлы обновления микрокода предоставляются пакетом linux-firmware .

Для процессоров Intel ни один пакет не предоставляет файлы обновления микрокода (FS#59841). Чтобы использовать позднюю загрузку, вам необходимо вручную извлечь intel-ucode/ из предоставленного Intel архива.

Включение позднего обновления микрокода

В отличие от ранней загрузки, поздняя загрузка обновлений микрокода в Arch Linux включена по умолчанию, используя /usr/lib/tmpfiles.d/linux-firmware.conf . После загрузки файл анализируется с помощью systemd-tmpfiles-setup.service(8) , а микрокод ЦП обновляется.

Для ручного обновления микрокода на запущенной системе запустите:

Это позволяет применять обновления микрокода после обновления linux-firmware без перезагрузки системы. Вы можете даже автоматизировать это с помощью хука pacman, например:

Отключение позднего обновления микрокода

Для систем AMD микрокод процессора будет обновляться, даже если пакет amd-ucode не установлен, так как файлы предоставлены linux-firmware (FS#59840). Чтобы отключить позднюю загрузку, вы должны переопределить временные файлы /usr/lib/tmpfiles.d/linux-firmware.conf . Это можно сделать, создав файл с тем же именем в /etc/tmpfiles.d/ :

Проверим, обновился ли microcode при загрузке

Чтобы убедиться, что микрокод обновился, воспользуемся dmesg:

На системах Intel вы должны увидеть что-то похожее на это при каждой загрузке, что говорит о том, что микрокод обновился рано:

Вполне возможно, особенно с новым аппаратным обеспечением, что для вашего CPU нет обновления микрокода. В этом случае вы можете увидеть примерно следующее:

На системах AMD, использующих раннюю загрузку, вывод будет выглядеть примерно так:

На системах AMD, использующих позднюю загрузку, в выводе будет отображаться версия старого микрокода перед перезагрузкой микрокода, а новая — после перезагрузки. Это будет выглядеть примерно так:

Каким ЦП нужны обновления микрокода

Пользователи могут проконсультироваться как у Intel, так и у AMD насчёт поддержки конкретной модели процессора, перейдя по следующим ссылкам:

Обнаружение доступного обновления микрокода

Вы можете узнать, содержит ли intel-ucode.img образ микрокода для вашего процессора с помощью iucode-tool .

  1. Установите intel-ucode (для обнаружения обновления не требуется менять initrd)
  2. Установите iucode-tool
  3. Извлекает образ микрокода и ищет в нём ваш cpuid:
  4. Если обновление доступно, оно должно отобразиться под selected microcodes
  5. Микрокод может уже быть в вашем биосе и его загрузка может не отображаться в dmesg. Сравните с текущим запуском микрокода >

Применение ранней загрузки микрокода в кастомных ядрах

Для того, чтобы ранняя загрузка работала в кастомных ядрах, «CPU microcode loading support» должен быть вкомпилирован в ядро, а не скомпилирован как модуль. Это включает приглашение «Early load microcode», которое должно быть установлено в Y .

Источник

Оцените статью