Attention is currently required from: Tim Wawrzynczak, Angel Pons, Arthur Heymans, Patrick Rudolph. Hello Tim Wawrzynczak, Angel Pons, Arthur Heymans, Patrick Rudolph,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/51371
to look at the new patch set (#2).
Change subject: cpu/intel/microcode: Fix caching logic in intel_microcode_find ......................................................................
cpu/intel/microcode: Fix caching logic in intel_microcode_find
CB:49896 added support in `intel_microcode_find()` to cache the found microcode for faster subsequent accesses. This works okay when the function succeeds in finding the microcode on BSP. However, if for any reason, `cpu_microcode_blob.bin` does not contain a valid microcode for the given processor, then the logic ends up attempting to find microcode again and again every time it is called (because `ucode_updates` is set to NULL on failed find, thus retriggering the whole find sequence every time). This leads to a weird race condition when multiple APs are running in parallel and executing this function.
A snippet of the issues observed in the scenario described above: ``` ... microcode: Update skipped, already up-to-date ... Microcode header corrupted! ...
```
1. AP reports that microcode update is being skipped since the current version matches the version in CBFS (even though there is no matching microcode update in CBFS). 2. AP reports microcode header is corrupted because it thinks that the data size reported in the microcode is larger than the file read from CBFS.
Above issues occur because each time an AP calls `intel_microcode_find()`, it might end up seeing some intermittent state of `ucode_updates` and taking incorrect action.
This change fixes this race condition by separating the logic for finding microcode into an internal function `__intel_microcode_find()` and maintaining the caching logic in `intel_microcode_find()` using a boolean flag `microcode_checked`.
BUG=b:182232187 TEST=Verified that `intel_microcode_find()` no longer makes repeated attempts to find microcode from CBFS if it failed the first time.
Change-Id: I8600c830ba029e5cb9c0d7e0f1af18d87c61ad3a Signed-off-by: Furquan Shaikh furquan@google.com --- M src/cpu/intel/microcode/microcode.c 1 file changed, 16 insertions(+), 7 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/71/51371/2