From: Boris Ostrovsky <boris.ostrovsky@oracle.com>
To: linux-kernel@vger.kernel.org
Cc: bp@alien8.de, tglx@linutronix.de, mingo@redhat.com,
dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com,
Boris Ostrovsky <boris.ostrovsky@oracle.com>
Subject: [PATCH v2 2/2] x86/microcode/AMD: Clean the cache if update did not load microcode
Date: Thu, 27 Mar 2025 19:05:03 -0400 [thread overview]
Message-ID: <20250327230503.1850368-3-boris.ostrovsky@oracle.com> (raw)
In-Reply-To: <20250327230503.1850368-1-boris.ostrovsky@oracle.com>
If microcode did not get loaded there is no reason to keep it in the cache.
Moreover, if loading failed it will not be possible to load an earlier
version of microcode since failed version will always be selected from
the cache on next reload attempt.
Since failed version is not easily avaialble at this point just clean the
whole cache. It will be rebuilt later if needed.
Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
---
arch/x86/kernel/cpu/microcode/amd.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/arch/x86/kernel/cpu/microcode/amd.c b/arch/x86/kernel/cpu/microcode/amd.c
index b61028cf5c8a..57bd61f9c69b 100644
--- a/arch/x86/kernel/cpu/microcode/amd.c
+++ b/arch/x86/kernel/cpu/microcode/amd.c
@@ -1171,11 +1171,18 @@ static void microcode_fini_cpu_amd(int cpu)
uci->mc = NULL;
}
+static void finalize_late_load_amd(int result)
+{
+ if (result)
+ cleanup();
+}
+
static struct microcode_ops microcode_amd_ops = {
.request_microcode_fw = request_microcode_amd,
.collect_cpu_info = collect_cpu_info_amd,
.apply_microcode = apply_microcode_amd,
.microcode_fini_cpu = microcode_fini_cpu_amd,
+ .finalize_late_load = finalize_late_load_amd,
.nmi_safe = true,
};
--
2.43.5
next prev parent reply other threads:[~2025-03-27 23:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-27 23:05 [PATCH v2 0/2] Clear AMD's microcode cache on load failure Boris Ostrovsky
2025-03-27 23:05 ` [PATCH v2 1/2] x86/microcode/AMD: Fix __apply_microcode_amd()'s return value Boris Ostrovsky
2025-03-28 12:29 ` [tip: x86/urgent] " tip-bot2 for Boris Ostrovsky
2025-03-27 23:05 ` Boris Ostrovsky [this message]
2025-04-07 13:06 ` [tip: x86/microcode] x86/microcode/AMD: Clean the cache if update did not load microcode tip-bot2 for Boris Ostrovsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250327230503.1850368-3-boris.ostrovsky@oracle.com \
--to=boris.ostrovsky@oracle.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®