Re: [PATCH] x86: introduce a new Linux defined feature flag for PATsupport

From: Rene Herman
Date: Thu May 08 2008 - 10:43:47 EST


On 08-05-08 14:49, Thomas Gleixner wrote:

Subject: x86: cleanup PAT cpu validation
From: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Date: Thu, 08 May 2008 09:18:43 +0200

Thanks much. Definite ACK, very much including on the much better disable
message:

+ pat_disable(cpu_has_pat ?
+ "PAT disabled. Not yet verified on this CPU type." :
+ "PAT not supported by CPU.");
+}

However, I'm not sure, but:

+ /* Paranoia check. */
+ if (!cpu_has_pat) {
+ printk(KERN_ERR "PAT enabled, but CPU feature cleared\n");
+ /*
+ * Panic if this happens on the secondary CPU, and we
+ * switched to PAT on the boot CPU. We have no way to
+ * undo PAT.
+ */
+ BUG_ON(boot_pat_state);
+ }

The 'if this happens on the secondary CPU' sounds a bit like this is
directly checking the secondary CPU flag but cpu_has_pat translates into
boot_cpu_has(X86_FEATURE_PAT), refers always to the boot cpu. Yes, we
continued on on the boot CPU after the error message so this triggers,
but thought I'd make sure it was also intended this way. If so, never
mind...

I'm privately again placing this on top. If anyone has any explicit
testing suggestion, I'm all ears.

Rene. diff --git a/arch/x86/kernel/cpu/addon_cpuid_features.c b/arch/x86/kernel/cpu/addon_cpuid_features.c
index c2e1ce3..cfa1b6b 100644
--- a/arch/x86/kernel/cpu/addon_cpuid_features.c
+++ b/arch/x86/kernel/cpu/addon_cpuid_features.c
@@ -57,6 +57,8 @@ void __cpuinit validate_pat_support(struct cpuinfo_x86 *c)
case X86_VENDOR_AMD:
if (c->x86 >= 0xf && c->x86 <= 0x11)
return;
+ if (c->x86 == 6 && c->x86_model == 7)
+ return;
break;
case X86_VENDOR_INTEL:
if (c->x86 == 0xF || (c->x86 == 6 && c->x86_model >= 15))