Skip to contentSkip to conversation

x86/MCE: Fix CPU microcode version output

PATCH In review Prarit Bhargava 4 participants 8 messages Jul 3, 2018 – Jul 31, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/MCE: Fix CPU microcode version output

On systems where a runtime microcode update has occurred the microcode version is wrong because boot_cpu_data.microcode is not updated during runtime.

Use the per-CPU microcode version in the MCE message.

Cc Tony Luck <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc "H. Peter Anvin" <[email protected]>
---
 arch/x86/kernel/cpu/mcheck/mce.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/cpu/mcheck/mce.c +1 -1
index c102ad51025e..64fee27433e9 100644
@@ -134,7 +134,7 @@ void mce_setup(struct mce *m)
 	if (this_cpu_has(X86_FEATURE_INTEL_PPIN))
 		rdmsrl(MSR_PPIN, m->ppin);
 
-	m->microcode = boot_cpu_data.microcode;
+	m->microcode = cpu_data(m->extcpu).microcode;
 }
 
 DEFINE_PER_CPU(struct mce, injectm);
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Prarit Bhargava

On systems where a runtime microcode update has occurred the microcode version is wrong because boot_cpu_data.microcode is not updated during runtime.

Use the per-CPU microcode version in the MCE message.

Other option would be to fix the microcode update code to make sure that boot_cpu_data.microcode is right.

But if we go this route we should add:

Fixes fa94d0c6e0f3 ("x86/MCE: Save microcode revision in machine check records")

Can also get a:

-Tony Luck
---
To unsubscribe from this list: send the line "unsubscribe linux-edac" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
Quoted 9 lines · Tony
Quoted 5 lines · Prarit Bhargava

On systems where a runtime microcode update has occurred the microcode version is wrong because boot_cpu_data.microcode is not updated during runtime.

Use the per-CPU microcode version in the MCE message.

Other option would be to fix the microcode update code to make sure that boot_cpu_data.microcode is right.

I thought about that too [1] but TBH I've always been a bit confused by boot_cpu_data vs. cpu_data(). At one point I thought that boot_cpu_data is valid only up to a specific point in boot and from that point on the cpu_data() should be used but I'm no longer sure if that's correct.

If that is not correct when should boot_cpu_data be used vs cpu_data()? Is boot_cpu_data truly supposed to represent the general state of the boot cpu at boot time?

Look at the same function mce_setup() that I modified in my patch. There is
another reference to boot_cpu_data.x86_vendor (which obviously will never change during runtime) that likely should be cpu_data() if my understanding above is correct.

P.

[1] Since the kernel now uses a cpu rendezvous model to update the microcode it would be trivial to set boot_cpu_data.microcode to the new value.

Quoted 12 lines

But if we go this route we should add:

Fixes fa94d0c6e0f3 ("x86/MCE: Save microcode revision in machine check records")

Can also get a:

-Tony Luck

---
To unsubscribe from this list: send the line "unsubscribe linux-edac" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

maintainer
#3 lore raw
In reply to Luck, Tony
Quoted 9 lines · Tony
Quoted 5 lines · Prarit Bhargava

On systems where a runtime microcode update has occurred the microcode version is wrong because boot_cpu_data.microcode is not updated during runtime.

Use the per-CPU microcode version in the MCE message.

Other option would be to fix the microcode update code to make sure that boot_cpu_data.microcode is right.

Yes, I already requested that:

https://lkml.kernel.org/r/[email protected]

Looks like Filippo has a patch already. CCed.

#4 lore raw
Quoted 8 lines · Borislav Petkov
Quoted 7 lines · Tony
Quoted 5 lines · Prarit Bhargava

On systems where a runtime microcode update has occurred the microcode version is wrong because boot_cpu_data.microcode is not updated during runtime.

Use the per-CPU microcode version in the MCE message.

Quoted 8 lines
Quoted 2 lines

Other option would be to fix the microcode update code to make sure that boot_cpu_data.microcode is right.

Yes, I already requested that:

https://lkml.kernel.org/r/[email protected]

Looks like Filippo has a patch already. CCed.

Filippo & Borislav, did the patch get committed to a -next tree?

P.

Quoted 1 line

---
To unsubscribe from this list: send the line "unsubscribe linux-edac" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

maintainer
#5 lore raw
Quoted 1 line · Prarit Bhargava

Filippo & Borislav, did the patch get committed to a -next tree?

No, I'm still waiting for it - looks like Filippo is busy.

Care to send one instead as suggested here?

https://lore.kernel.org/lkml/[email protected]/

Signature · 5 lines
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.
--
#6 lore raw
Quoted 17 lines · Borislav Petkov
Quoted 1 line · Prarit Bhargava

Filippo & Borislav, did the patch get committed to a -next tree?

No, I'm still waiting for it - looks like Filippo is busy.

Care to send one instead as suggested here?

https://lore.kernel.org/lkml/[email protected]/

Signature · 5 lines
Regards/Gruss,
   Boris.

ECO tip #101: Trim your mails when you reply.
--

Sorry, I was out of office for a while.
I'll look into this today.

Filippo

Amazon Development Center Germany GmbH
Berlin - Dresden - Aachen
main office: Krausenstr. 38, 10117 Berlin
Geschaeftsfuehrer: Dr. Ralf Herbrich, Christian Schlaeger
Ust-ID: DE289237879
Eingetragen am Amtsgericht Charlottenburg HRB 149173 B
---
To unsubscribe from this list: send the line "unsubscribe linux-edac" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

maintainer
#7 lore raw
Quoted 2 lines · Filippo

Sorry, I was out of office for a while.
I'll look into this today.

Prarit is doing a patch too - you might wanna save effort. I leave it up to you guys to figure out who should do it.