From: Ashok Raj <ashok.raj@intel.com>
To: Borislav Petkov <bp@alien8.de>
Cc: "Ashok Raj" <ashok_raj@linux.intel.com>,
"X86 ML" <x86@kernel.org>, "Andrew Cooper" <amc96@srcf.net>,
LKML <linux-kernel@vger.kernel.org>,
"Ștefan Talpalaru" <stefantalpalaru@yahoo.com>,
"Ashok Raj" <ashok.raj@intel.com>
Subject: Re: [PATCH] x86/microcode/AMD: Attempt applying on every logical thread
Date: Thu, 18 Aug 2022 09:58:52 +0000 [thread overview]
Message-ID: <Yv4NXOlLHcx1Ghf3@araj-dh-work> (raw)
In-Reply-To: <Yv1j8v7o3lOniUoH@zn.tnic>
Hi Boris
On Wed, Aug 17, 2022 at 11:56:02PM +0200, Borislav Petkov wrote:
> On Wed, Aug 17, 2022 at 08:58:07PM +0000, Ashok Raj wrote:
> > For this specific patch in question, its not for testing though.. Its
> > required for functional purposes?
>
> From its commit message:
>
> "However, there are microcode patches which do per-thread modification,
> see Link tag below.
>
I did read the commit log. I was just stating the fact that reload isn't
just for testing, for e.g. in this case its required for functional
reasons.
if cpu_rev > ucode_rev, there is no need to reload microcode correct?
There are a bunch of changes in the original post that seemed like it had
nothing to do with force load on a sibling.
Completely untested, no commit log to spare you from fixing them :-)
Seemed like we were simply passing over each other with emails, thought
I'll convey what I meant here via a patch. Hope this helps.
lemme know what you think.
Cheers,
Ashok
---
arch/x86/kernel/cpu/microcode/amd.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kernel/cpu/microcode/amd.c b/arch/x86/kernel/cpu/microcode/amd.c
index 8b2fcdfa6d31..124e15b8559b 100644
--- a/arch/x86/kernel/cpu/microcode/amd.c
+++ b/arch/x86/kernel/cpu/microcode/amd.c
@@ -440,7 +440,7 @@ apply_microcode_early_amd(u32 cpuid_1_eax, void *ucode, size_t size, bool save_p
return ret;
native_rdmsr(MSR_AMD64_PATCH_LEVEL, rev, dummy);
- if (rev >= mc->hdr.patch_id)
+ if (rev > mc->hdr.patch_id)
return ret;
if (!__apply_microcode_amd(mc)) {
@@ -679,6 +679,7 @@ static enum ucode_state apply_microcode_amd(int cpu)
struct ucode_patch *p;
enum ucode_state ret;
u32 rev, dummy __always_unused;
+ int first_cpu;
BUG_ON(raw_smp_processor_id() != cpu);
@@ -691,10 +692,17 @@ static enum ucode_state apply_microcode_amd(int cpu)
mc_amd = p->data;
uci->mc = p->data;
+ first_cpu = cpumask_first(topology_sibling_cpumask(cpu));
rdmsr(MSR_AMD64_PATCH_LEVEL, rev, dummy);
/* need to apply patch? */
- if (rev >= mc_amd->hdr.patch_id) {
+ if (((cpu == first_cpu) && rev >= mc_amd->hdr.patch_id)) {
+ ret = UCODE_OK;
+ goto out;
+ }
+
+ /* Siblings need to reload microcode even if rev is same */
+ if (rev > mc_amd->hdr.patch_id) {
ret = UCODE_OK;
goto out;
}
next prev parent reply other threads:[~2022-08-18 9:59 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-14 12:00 [PATCH] x86/microcode/AMD: Attempt applying on every logical thread Borislav Petkov
2022-08-16 9:00 ` Ashok Raj
2022-08-16 12:41 ` Borislav Petkov
2022-08-16 16:51 ` Ashok Raj
2022-08-17 12:12 ` Ashok Raj
2022-08-17 14:23 ` Borislav Petkov
2022-08-17 15:29 ` Ashok Raj
2022-08-17 18:13 ` Borislav Petkov
2022-08-17 20:58 ` Ashok Raj
2022-08-17 21:56 ` Borislav Petkov
2022-08-18 9:58 ` Ashok Raj [this message]
2022-11-05 3:45 ` Ashok Raj
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=Yv4NXOlLHcx1Ghf3@araj-dh-work \
--to=ashok.raj@intel.com \
--cc=amc96@srcf.net \
--cc=ashok_raj@linux.intel.com \
--cc=bp@alien8.de \
--cc=linux-kernel@vger.kernel.org \
--cc=stefantalpalaru@yahoo.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.