[1/2] x86/microcode/AMD: Load late on both threads too

Message ID 20230605141332.25948-1-bp@alien8.de
State New
Headers
Series [1/2] x86/microcode/AMD: Load late on both threads too |

Commit Message

Borislav Petkov June 5, 2023, 2:13 p.m. UTC
  From: "Borislav Petkov (AMD)" <bp@alien8.de>

Do the same as early loading - load on both threads.

Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Cc: <stable@kernel.org>
---
 arch/x86/kernel/cpu/microcode/amd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Dave Hansen June 7, 2023, 7:36 p.m. UTC | #1
On 6/5/23 07:13, Borislav Petkov wrote:
> Do the same as early loading - load on both threads.

Hey Boris,

What's the benefit of doing the loading on both threads?  I would have
naively thought it was just wasted work.

I think I even have a back-burnered Intel patch around somewhere that
ensures that we *never* load on both threads.
  
Borislav Petkov June 7, 2023, 8:03 p.m. UTC | #2
On Wed, Jun 07, 2023 at 12:36:53PM -0700, Dave Hansen wrote:
> What's the benefit of doing the loading on both threads?  I would have
> naively thought it was just wasted work.

I have the perfect example for this, see:

e7ad18d1169c ("x86/microcode/AMD: Apply the patch early on every logical thread")

so it is for reasons like that.

> I think I even have a back-burnered Intel patch around somewhere that
> ensures that we *never* load on both threads.

Interesting - I guess there are considerable differences in microcode
architecture between the two. :-)
  
Dave Hansen June 7, 2023, 8:15 p.m. UTC | #3
On 6/7/23 13:03, Borislav Petkov wrote:
> On Wed, Jun 07, 2023 at 12:36:53PM -0700, Dave Hansen wrote:
>> What's the benefit of doing the loading on both threads?  I would have
>> naively thought it was just wasted work.
> I have the perfect example for this, see:
> 
> e7ad18d1169c ("x86/microcode/AMD: Apply the patch early on every logical thread")
> 
> so it is for reasons like that.

Yikes, so the second CMT thread reports a bumped version but not all the
_effects_ of that version?  That's, uh ... fun???

>> I think I even have a back-burnered Intel patch around somewhere that
>> ensures that we *never* load on both threads.
> Interesting - I guess there are considerable differences in microcode
> architecture between the two. 😄

Yeah, sure seems that way.
  

Patch

diff --git a/arch/x86/kernel/cpu/microcode/amd.c b/arch/x86/kernel/cpu/microcode/amd.c
index f14f4ea0b537..87208e46f7ed 100644
--- a/arch/x86/kernel/cpu/microcode/amd.c
+++ b/arch/x86/kernel/cpu/microcode/amd.c
@@ -700,7 +700,7 @@  static enum ucode_state apply_microcode_amd(int cpu)
 	rdmsr(MSR_AMD64_PATCH_LEVEL, rev, dummy);
 
 	/* need to apply patch? */
-	if (rev >= mc_amd->hdr.patch_id) {
+	if (rev > mc_amd->hdr.patch_id) {
 		ret = UCODE_OK;
 		goto out;
 	}