Skip to content

x86/microcode: Incremental Loading and Early Minimum Revision Check

Chang S. Bae lkml stable 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest7 patches 0 repliesNew

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7x86/microcode: Avoid spurious base_rev= matcharch/x86/kernel/cpu/microcode/core.c+2 -10 replies
2/7x86/microcode: Accept a boolean for force_minrev parameterDocumentation/admin-guide/kernel-parameters.txt arch/x86/kernel/cpu/microcode/core.c+16 -60 replies
3/7x86/microcode: Mark early_data __initdataarch/x86/kernel/cpu/microcode/core.c+1 -10 replies
4/7x86/microcode: Introduce incremental late loadingDocumentation/admin-guide/kernel-parameters.txt arch/x86/Kconfig arch/x86/kernel/cpu/microcode/core.c +1 more+76 -60 replies
5/7x86/microcode/intel: Select the lowest revision for incremental loadingarch/x86/kernel/cpu/microcode/core.c arch/x86/kernel/cpu/microcode/intel.c arch/x86/kernel/cpu/microcode/internal.h+24 -40 replies
6/7x86/microcode: Decouple minimum revision check from late loadingarch/x86/kernel/cpu/microcode/core.c arch/x86/kernel/cpu/microcode/intel.c arch/x86/kernel/cpu/microcode/internal.h+14 -70 replies
7/7x86/microcode/intel: Apply minimum revision check to early loadingarch/x86/kernel/cpu/microcode/intel.c+25 -260 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/7] x86/microcode: Incremental Loading and Early Minimum Revision Check

Hi all,

This series came up with the microcode loading issues [1] previously. The immediate fix, which prevents problematic blobs from being loaded, has been merged to the mainline and backported to stable trees. This revision follows up with two longer-term solutions addressing the underlying issues.

First, let me summarize the changes since the previous posting [2] in parts:

Part 1, patch 1-3: Preparatory fixes
* Only minor updates to changelogs and patch subjects.

Part 2, patch 4-5: Late-loading - incremental Loading
* Rename the approach to "incremental loading" to better describe the intention of advancing revisions through multiple updates.
* Move this part ahead of the early minimum revision check, since the check now recommends incremental loading when fails.

Part 3, patch 6-7: Early-loading - early minimum revision check
* Keep this part in RFC status for now, as the resulting tainting behavior wants more reviews
* Do not extend force_minrev to early loading, since doing so would reject all early loadings on AMD systems.

Below is more detail about the longer-term solutions, largely carried from the previous posting [2].

1. Incremental Late Loading

Looking at Intel microcode releases [3], the repository traditionally provides the latest blob. When updating from an older revision, admins may need to retrieve prerequisite older revisions from the git history. This can be inefficient and error-prone.

Intel will now concatenate prerequisite older blobs with the latest blob together into a multi-blob image. The kernel, however, currently selects the highest loadable revision, or at best one prerequisite when the minimum revision check is enforced. Admins may need to trigger multiple loads manually.

Instead the kernel loader can facilitate iterative loading to apply the available blobs incrementally. There are some possible ways to implement this:

(1) One is to rely on the minimum revision check and select the highest revision whose prerequisite has been loaded already.
(2) Another is to load the blobs sequentially according to the order in the image.

Both approaches have drawbacks: (1) depends on the minimum revision information being correct, while (2) is sensitive to blob ordering.

The approach here selects the lowest loadable revision on each iteration, so that the blobs to be applied incrementally (patch 4-5).

2. Early Minimum Revision Check

The minimum revision information can serve as a more general revision dependency check, rather than being limited to runtime changes. This part extends the minimum revision check to early loading (patch 6-7).

Although the implementation itself isn't complex, there are some user-visible consequences:

* For Intel, early loading of older patches without minimum revision information would result in kernel tainting.

* For AMD, the absence of the field could result in tainting _every_ successful update unless explicitly treating AMD patches as safe. To me, it is unclear whether the absence of this field reflects a lack of such dependencies or simply a difference in the vendor's microcode format.

* Another consideration is force_minrev. Extending it to early loading would reject all early loading on AMD systems, equivalent to disabling the loader entirely. Since the existing build-time and command-line option descriptions are specific to late loading, I have kept its semantics unchanged.

For now, I'm keeping this part as RFC material. Depending on the feedback, the series could move forward with a smaller series, leaving this part to follow after landing part1/2.

The patch set is available in this repository:
git://github.com/intel-staging/microcode.git incr-loading-and-early-minrev-v2

Thanks,
Chang

[1] GNR98. MCE When Early OS Microcode Update to MCU 0x1000405 Release or Later
[2] https://lore.kernel.org/lkml/[email protected]
[3] https://github.com/intel/Intel-Linux-Processor-Microcode-Data-Files.git

Chang S. Bae (7):
x86/microcode: Avoid spurious base_rev= match x86/microcode: Accept a boolean for force_minrev parameter x86/microcode: Mark early_data __initdata x86/microcode: Introduce incremental late loading x86/microcode/intel: Select the lowest revision for incremental
loading
x86/microcode: Decouple minimum revision check from late loading x86/microcode/intel: Apply minimum revision check to early loading

 .../admin-guide/kernel-parameters.txt         | 11 ++-
 arch/x86/Kconfig                              | 13 +++
 arch/x86/kernel/cpu/microcode/core.c          | 91 ++++++++++++++++---
 arch/x86/kernel/cpu/microcode/intel.c         | 63 ++++++++-----
 arch/x86/kernel/cpu/microcode/internal.h      |  9 +-
 5 files changed, 147 insertions(+), 40 deletions(-)

base-commit: aebb7274476403040d582c61478df8f4a7bf9cd3

Signature · 1 line
2.53.0