Re: [PATCH] x86: pat cpu feature bit setting for known cpus

Previous thread: [GIT PATCH] PCI fixes for 2.6.25-rc6 git tree by Greg KH on Tuesday, March 25, 2008 - 2:06 am. (1 message)

Next thread: linux-next: Tree for March 25 by Stephen Rothwell on Tuesday, March 25, 2008 - 2:52 am. (14 messages)
To: Ingo Molnar <mingo@...>, H. Peter Anvin <hpa@...>, Thomas Gleixner <tglx@...>, Andrew Morton <akpm@...>
Cc: kernel list <linux-kernel@...>
Date: Tuesday, March 25, 2008 - 2:24 am

[PATCH] x86: pat cpu feature bit setting for known cpus

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>

diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index eb94460..b186047 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -309,6 +309,19 @@ static void __cpuinit early_get_cap(struct cpuinfo_x86 *c)

}

+ clear_cpu_cap(c, X86_FEATURE_PAT);
+
+ switch (c->x86_vendor) {
+ case X86_VENDOR_AMD:
+ if (c->x86 >= 0xf && c->x86 <= 0x11)
+ set_cpu_cap(c, X86_FEATURE_PAT);
+ break;
+ case X86_VENDOR_INTEL:
+ if (c->x86 == 0xF || (c->x86 == 6 && c->x86_model >= 15))
+ set_cpu_cap(c, X86_FEATURE_PAT);
+ break;
+ }
+
}

/*
@@ -397,6 +410,18 @@ static void __cpuinit generic_identify(struct cpuinfo_x86 *c)
init_scattered_cpuid_features(c);
}

+ clear_cpu_cap(c, X86_FEATURE_PAT);
+
+ switch (c->x86_vendor) {
+ case X86_VENDOR_AMD:
+ if (c->x86 >= 0xf && c->x86 <= 0x11)
+ set_cpu_cap(c, X86_FEATURE_PAT);
+ break;
+ case X86_VENDOR_INTEL:
+ if (c->x86 == 0xF || (c->x86 == 6 && c->x86_model >= 15))
+ set_cpu_cap(c, X86_FEATURE_PAT);
+ break;
+ }
}

static void __cpuinit squash_the_stupid_serial_number(struct cpuinfo_x86 *c)
diff --git a/arch/x86/kernel/setup_64.c b/arch/x86/kernel/setup_64.c
index 3f1dc97..ddaaaaa 100644
--- a/arch/x86/kernel/setup_64.c
+++ b/arch/x86/kernel/setup_64.c
@@ -979,12 +979,19 @@ static void __cpuinit early_identify_cpu(struct cpuinfo_x86 *c)
if (c->extended_cpuid_level >= 0x80000007)
c->x86_power = cpuid_edx(0x80000007);

+
+ clear_cpu_cap(c, X86_FEATURE_PAT);
+
switch (c->x86_vendor) {
case X86_VENDOR_AMD:
early_init_amd(c);
+ if (c->x86 >= 0xf && c->x86 <= 0x11)
+ set_cpu_cap(c, X86_FEATURE_PAT);
break;
case X86_VENDOR_INTEL:
early_init_intel(c);
+ if (c->x86 == 0xF || (c->x86 == 6 && c...

To: <yhlu.kernel@...>
Cc: Ingo Molnar <mingo@...>, H. Peter Anvin <hpa@...>, Thomas Gleixner <tglx@...>, Andrew Morton <akpm@...>, kernel list <linux-kernel@...>
Date: Sunday, March 30, 2008 - 7:43 am

just a general comment on things like this... "x->x86 <= 0x11" ensures

note that you didn't limit intel the same way... at least for the numerous
core2 processor models.

-dean
--

To: <yhlu.kernel@...>
Cc: Ingo Molnar <mingo@...>, H. Peter Anvin <hpa@...>, Thomas Gleixner <tglx@...>, Andrew Morton <akpm@...>, kernel list <linux-kernel@...>
Date: Friday, March 28, 2008 - 9:41 am

To: Pavel Machek <pavel@...>
Cc: Ingo Molnar <mingo@...>, H. Peter Anvin <hpa@...>, Thomas Gleixner <tglx@...>, Andrew Morton <akpm@...>, kernel list <linux-kernel@...>
Date: Friday, March 28, 2008 - 10:51 am

yes. just want to leave one stub, so could add other cap setting if

for 64 bit.

YH
--

To: <yhlu.kernel@...>
Cc: Ingo Molnar <mingo@...>, Thomas Gleixner <tglx@...>, Andrew Morton <akpm@...>, kernel list <linux-kernel@...>
Date: Tuesday, March 25, 2008 - 9:38 am

OK, note previous question: what is the motivation for having this as a
whitelist (as opposed to a blacklist)?

-hpa
--

To: H. Peter Anvin <hpa@...>, Pallipadi, Venkatesh <venkatesh.pallipadi@...>
Cc: Ingo Molnar <mingo@...>, Thomas Gleixner <tglx@...>, Andrew Morton <akpm@...>, kernel list <linux-kernel@...>
Date: Tuesday, March 25, 2008 - 2:03 pm

Venkatesh could tell?

YH
--

To: Yinghai Lu <yhlu.kernel@...>
Cc: H. Peter Anvin <hpa@...>, Pallipadi, Venkatesh <venkatesh.pallipadi@...>, Ingo Molnar <mingo@...>, Thomas Gleixner <tglx@...>, Andrew Morton <akpm@...>, kernel list <linux-kernel@...>, <suresh.b.siddha@...>
Date: Tuesday, March 25, 2008 - 3:08 pm

Main reason for white-list at this point is not to be side-tracked by
real or potential erratas on older CPUs. Focussing on getting the support for
this feature on current and future CPUs. If older CPUs have survived all these
days without this feature, they should be doing OK.

Other reason being the amount of testing we get on those older systems. I mean,
any regression on some specific CPU is hard to find unless it is being tested
or someone audits all the errata documents to prepare the blacklist (Unless
we want to have big blacklist which is just !current_whitelist). We do not
have any self test that can detect and report any problematic CPUs that we
can add to the blacklist.

Having said that, if there is a need for this on older CPUs, I am OK with
having this as a blacklist.

Thanks,
Venki

--

To: Venki Pallipadi <venkatesh.pallipadi@...>
Cc: Yinghai Lu <yhlu.kernel@...>, H. Peter Anvin <hpa@...>, Thomas Gleixner <tglx@...>, Andrew Morton <akpm@...>, kernel list <linux-kernel@...>, <suresh.b.siddha@...>
Date: Tuesday, March 25, 2008 - 4:08 pm

well, the upside would be that since most testing of Linux kernels is
done on _old_ hardware (people tend to risk their old hw first ;-), we'd
get faster convergence of the codebase, even though we have the risk of
erratas (known and unknown ones alike). Code that artificially limits
its utility is almost always slow to stabilize.

Ingo
--

To: Ingo Molnar <mingo@...>
Cc: Venki Pallipadi <venkatesh.pallipadi@...>, Yinghai Lu <yhlu.kernel@...>, Thomas Gleixner <tglx@...>, Andrew Morton <akpm@...>, kernel list <linux-kernel@...>, <suresh.b.siddha@...>
Date: Tuesday, March 25, 2008 - 4:38 pm

Yes, using a whitelist of this type is wrong, IMO, and smells faintly of
vendor-lockin.

-hpa
--

To: Ingo Molnar <mingo@...>
Cc: Venki Pallipadi <venkatesh.pallipadi@...>, Yinghai Lu <yhlu.kernel@...>, Thomas Gleixner <tglx@...>, Andrew Morton <akpm@...>, kernel list <linux-kernel@...>, <suresh.b.siddha@...>
Date: Tuesday, March 25, 2008 - 7:01 pm

By the way, I want to clarify: I didn't mean it was *intended* as
vendor-lockin, just that it's an undesirable effect of this.

-hpa
--

To: H. Peter Anvin <hpa@...>
Cc: Ingo Molnar <mingo@...>, Venki Pallipadi <venkatesh.pallipadi@...>, Thomas Gleixner <tglx@...>, Andrew Morton <akpm@...>, kernel list <linux-kernel@...>, <suresh.b.siddha@...>
Date: Tuesday, March 25, 2008 - 7:05 pm

if the PAT works, we may need to trim the memory according to MTRR, right?

YH
--

To: Yinghai Lu <yhlu.kernel@...>
Cc: Ingo Molnar <mingo@...>, Venki Pallipadi <venkatesh.pallipadi@...>, Thomas Gleixner <tglx@...>, Andrew Morton <akpm@...>, kernel list <linux-kernel@...>, <suresh.b.siddha@...>
Date: Tuesday, March 25, 2008 - 7:06 pm

That doesn't seem like it's specific to PAT?

-hpa
--

To: H. Peter Anvin <hpa@...>
Cc: Ingo Molnar <mingo@...>, Venki Pallipadi <venkatesh.pallipadi@...>, Thomas Gleixner <tglx@...>, Andrew Morton <akpm@...>, kernel list <linux-kernel@...>, <suresh.b.siddha@...>
Date: Tuesday, March 25, 2008 - 7:08 pm

could page table to set WRBACK the range that is not covered by MTRR in e820..

YH
--

To: Yinghai Lu <yhlu.kernel@...>
Cc: Ingo Molnar <mingo@...>, Venki Pallipadi <venkatesh.pallipadi@...>, Thomas Gleixner <tglx@...>, Andrew Morton <akpm@...>, kernel list <linux-kernel@...>, <suresh.b.siddha@...>
Date: Tuesday, March 25, 2008 - 8:10 pm

We have to trim anyway... lest we end up using uncached memory and then
we're in a world of hurt.

-hpa
--

To: Yinghai Lu <yhlu.kernel@...>, H. Peter Anvin <hpa@...>
Cc: Ingo Molnar <mingo@...>, Thomas Gleixner <tglx@...>, Andrew Morton <akpm@...>, kernel list <linux-kernel@...>, Siddha, Suresh B <suresh.b.siddha@...>, Barnes, Jesse <jesse.barnes@...>
Date: Tuesday, March 25, 2008 - 7:38 pm

Trimming of e820 memory is already done by Jesse's patch here
commit 99fc8d424bc5d80
Are you referring to similar thing?

Thanks,
Venki

--

To: Pallipadi, Venkatesh <venkatesh.pallipadi@...>
Cc: H. Peter Anvin <hpa@...>, Ingo Molnar <mingo@...>, Thomas Gleixner <tglx@...>, Andrew Morton <akpm@...>, kernel list <linux-kernel@...>, Siddha, Suresh B <suresh.b.siddha@...>, Barnes, Jesse <jesse.barnes@...>
Date: Tuesday, March 25, 2008 - 8:01 pm

On Tue, Mar 25, 2008 at 4:38 PM, Pallipadi, Venkatesh
Yes.

YH
--

To: <yhlu.kernel@...>
Cc: H. Peter Anvin <hpa@...>, Thomas Gleixner <tglx@...>, Andrew Morton <akpm@...>, kernel list <linux-kernel@...>
Date: Tuesday, March 25, 2008 - 6:58 am

thanks, applied - we need this to widen the testing scope of the PAT
changes.

Ingo
--

Previous thread: [GIT PATCH] PCI fixes for 2.6.25-rc6 git tree by Greg KH on Tuesday, March 25, 2008 - 2:06 am. (1 message)

Next thread: linux-next: Tree for March 25 by Stephen Rothwell on Tuesday, March 25, 2008 - 2:52 am. (14 messages)