Skip to contentSkip to conversation

x86/mtrr: Check if fixed MTRRs exist before saving them

PATCH Superseded Andi Kleen 2 participants 4 messages Jan 5, 2024 – Jan 10, 2024 x86

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Andi Kleen

author
#0 lore raw

PATCH 1/1 x86/mtrr: Check if fixed MTRRs exist before saving them

This one place forgot to check the fixed capability.

---
 arch/x86/kernel/cpu/mtrr/mtrr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/cpu/mtrr/mtrr.c +1 -1
index 767bf1c71aad..2a2fc14955cd 100644
@@ -609,7 +609,7 @@ void mtrr_save_state(void)
 {
 	int first_cpu;
 
-	if (!mtrr_enabled())
+	if (!mtrr_enabled() || !mtrr_state.have_fixed)
 		return;
 
 	first_cpu = cpumask_first(cpu_online_mask);
Signature · 1 line
2.43.0
#1 lore raw
Quoted 1 line · Andi Kleen

This one place forgot to check the fixed capability.

What's the consequence of that missing check and shouldn't this have a Fixes tag?

Thanks,

tglx

author
#2 lore raw
Quoted 4 lines · Thomas Gleixner
Quoted 1 line · Andi Kleen

This one place forgot to check the fixed capability.

What's the consequence of that missing chec

You get a WARN_ON for a WRMSR failing if you don't have the MSR.

Quoted 1 line

and shouldn't this have a Fixes tag?

It's more an ancient bug back dating back to my tenure in 2007, but here it is:

Fixes 2b1f6278d77c ("[PATCH] x86: Save the MTRRs of the BSP before")

-Andi

#3 lore raw
Quoted 6 lines · Andi Kleen
Quoted 4 lines · Thomas Gleixner
Quoted 1 line · Andi Kleen

This one place forgot to check the fixed capability.

What's the consequence of that missing chec

Quoted 7 lines

You get a WARN_ON for a WRMSR failing if you don't have the MSR.

Quoted 1 line

and shouldn't this have a Fixes tag?

It's more an ancient bug back dating back to my tenure in 2007, but here it is:

Fixes 2b1f6278d77c ("[PATCH] x86: Save the MTRRs of the BSP before")

Care to send a V2 with a less meager changelog?