| 1 |
From 09e182d17e8891dd73baba961a0f5a82e9274c97 Mon Sep 17 00:00:00 2001 |
| 2 |
From: Borislav Petkov <[email protected]> |
| 3 |
Date: Sat, 21 Apr 2018 10:19:30 +0200 |
| 4 |
Subject: x86/microcode: Do not exit early from __reload_late() |
| 5 |
|
| 6 |
Vitezslav reported a case where the |
| 7 |
|
| 8 |
"Timeout during microcode update!" |
| 9 |
|
| 10 |
panic would hit. After a deeper look, it turned out that his .config had |
| 11 |
CONFIG_HOTPLUG_CPU disabled which practically made save_mc_for_early() a |
| 12 |
no-op. |
| 13 |
|
| 14 |
When that happened, the discovered microcode patch wasn't saved into the |
| 15 |
cache and the late loading path wouldn't find any. |
| 16 |
|
| 17 |
This, then, lead to early exit from __reload_late() and thus CPUs waiting |
| 18 |
until the timeout is reached, leading to the panic. |
| 19 |
|
| 20 |
In hindsight, that function should have been written so it does not return |
| 21 |
before the post-synchronization. Oh well, I know better now... |
| 22 |
|
| 23 |
Fixes: bb8c13d61a62 ("x86/microcode: Fix CPU synchronization routine") |
| 24 |
Reported-by: Vitezslav Samel <[email protected]> |
| 25 |
Signed-off-by: Borislav Petkov <[email protected]> |
| 26 |
Signed-off-by: Thomas Gleixner <[email protected]> |
| 27 |
Tested-by: Vitezslav Samel <[email protected]> |
| 28 |
Tested-by: Ashok Raj <[email protected]> |
| 29 |
Cc: [email protected] |
| 30 |
Link: http://lkml.kernel.org/r/[email protected] |
| 31 |
Link: https://lkml.kernel.org/r/[email protected] |
| 32 |
--- |
| 33 |
arch/x86/kernel/cpu/microcode/core.c | 6 ++---- |
| 34 |
1 file changed, 2 insertions(+), 4 deletions(-) |
| 35 |
|
| 36 |
diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c |
| 37 |
index 10c4fc2..77e2013 100644 |
| 38 |
--- a/arch/x86/kernel/cpu/microcode/core.c |
| 39 |
+++ b/arch/x86/kernel/cpu/microcode/core.c |
| 40 |
@@ -564,14 +564,12 @@ static int __reload_late(void *info) |
| 41 |
apply_microcode_local(&err); |
| 42 |
spin_unlock(&update_lock); |
| 43 |
|
| 44 |
+ /* siblings return UCODE_OK because their engine got updated already */ |
| 45 |
if (err > UCODE_NFOUND) { |
| 46 |
pr_warn("Error reloading microcode on CPU %d\n", cpu); |
| 47 |
- return -1; |
| 48 |
- /* siblings return UCODE_OK because their engine got updated already */ |
| 49 |
+ ret = -1; |
| 50 |
} else if (err == UCODE_UPDATED || err == UCODE_OK) { |
| 51 |
ret = 1; |
| 52 |
- } else { |
| 53 |
- return ret; |
| 54 |
} |
| 55 |
|
| 56 |
/* |
| 57 |
-- |
| 58 |
cgit v1.1 |
| 59 |
|