LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] x86: pat cpu feature bit setting for known cpus
@ 2008-03-25  6:24 Yinghai Lu
  2008-03-25 10:58 ` Ingo Molnar
                   ` (3 more replies)
  0 siblings, 4 replies; 17+ messages in thread
From: Yinghai Lu @ 2008-03-25  6:24 UTC (permalink / raw)
  To: Ingo Molnar, H. Peter Anvin, Thomas Gleixner, Andrew Morton; +Cc: kernel list

[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->x86_model >= 15))
+			set_cpu_cap(c, X86_FEATURE_PAT);
 		break;
 	}
 
--- a/arch/x86/mm/pat.c	2008-03-24 23:10:32.000000000 -0700
+++ b/arch/x86/mm/pat.c	2008-03-24 23:11:38.000000000 -0700
@@ -42,19 +42,8 @@
 	if (!pat_wc_enabled)
 		return 0;
 
-	if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL &&
-	    (boot_cpu_data.x86 == 0xF ||
-	     (boot_cpu_data.x86 == 6 && boot_cpu_data.x86_model >= 15))) {
-		if (cpu_has_pat) {
-			return 1;
-		}
-	}
-	if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD &&
-	     boot_cpu_data.x86 >= 0xf && boot_cpu_data.x86 <= 0x11) {
-		if (cpu_has_pat) {
-			return 1;
-		}
-	}
+	if (cpu_has_pat)
+		return 1;
 
 	pat_wc_enabled = 0;
 	printk(KERN_INFO "CPU and/or kernel does not support PAT.\n");

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH] x86: pat cpu feature bit setting for known cpus
  2008-03-25  6:24 [PATCH] x86: pat cpu feature bit setting for known cpus Yinghai Lu
@ 2008-03-25 10:58 ` Ingo Molnar
  2008-03-25 13:38 ` H. Peter Anvin
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 17+ messages in thread
From: Ingo Molnar @ 2008-03-25 10:58 UTC (permalink / raw)
  To: yhlu.kernel; +Cc: H. Peter Anvin, Thomas Gleixner, Andrew Morton, kernel list


* Yinghai Lu <yhlu.kernel.send@gmail.com> wrote:

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

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

	Ingo

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH] x86: pat cpu feature bit setting for known cpus
  2008-03-25  6:24 [PATCH] x86: pat cpu feature bit setting for known cpus Yinghai Lu
  2008-03-25 10:58 ` Ingo Molnar
@ 2008-03-25 13:38 ` H. Peter Anvin
  2008-03-25 18:03   ` Yinghai Lu
  2008-03-28 13:41 ` Pavel Machek
  2008-03-30 11:43 ` dean gaudet
  3 siblings, 1 reply; 17+ messages in thread
From: H. Peter Anvin @ 2008-03-25 13:38 UTC (permalink / raw)
  To: yhlu.kernel; +Cc: Ingo Molnar, Thomas Gleixner, Andrew Morton, kernel list

Yinghai Lu wrote:
> [PATCH] x86: pat cpu feature bit setting for known cpus
> 
> Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>

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

	-hpa

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH] x86: pat cpu feature bit setting for known cpus
  2008-03-25 13:38 ` H. Peter Anvin
@ 2008-03-25 18:03   ` Yinghai Lu
  2008-03-25 19:08     ` Venki Pallipadi
  0 siblings, 1 reply; 17+ messages in thread
From: Yinghai Lu @ 2008-03-25 18:03 UTC (permalink / raw)
  To: H. Peter Anvin, Pallipadi, Venkatesh
  Cc: Ingo Molnar, Thomas Gleixner, Andrew Morton, kernel list

On Tue, Mar 25, 2008 at 6:38 AM, H. Peter Anvin <hpa@zytor.com> wrote:
> Yinghai Lu wrote:
>  > [PATCH] x86: pat cpu feature bit setting for known cpus
>  >
>  > Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
>
>  OK, note previous question: what is the motivation for having this as a
>  whitelist (as opposed to a blacklist)?

Venkatesh could tell?

YH

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH] x86: pat cpu feature bit setting for known cpus
  2008-03-25 18:03   ` Yinghai Lu
@ 2008-03-25 19:08     ` Venki Pallipadi
  2008-03-25 20:08       ` Ingo Molnar
  0 siblings, 1 reply; 17+ messages in thread
From: Venki Pallipadi @ 2008-03-25 19:08 UTC (permalink / raw)
  To: Yinghai Lu
  Cc: H. Peter Anvin, Pallipadi, Venkatesh, Ingo Molnar,
	Thomas Gleixner, Andrew Morton, kernel list, suresh.b.siddha

On Tue, Mar 25, 2008 at 11:03:37AM -0700, Yinghai Lu wrote:
> On Tue, Mar 25, 2008 at 6:38 AM, H. Peter Anvin <hpa@zytor.com> wrote:
> > Yinghai Lu wrote:
> >  > [PATCH] x86: pat cpu feature bit setting for known cpus
> >  >
> >  > Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
> >
> >  OK, note previous question: what is the motivation for having this as a
> >  whitelist (as opposed to a blacklist)?
> 
> Venkatesh could tell?

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


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH] x86: pat cpu feature bit setting for known cpus
  2008-03-25 19:08     ` Venki Pallipadi
@ 2008-03-25 20:08       ` Ingo Molnar
  2008-03-25 20:38         ` H. Peter Anvin
  0 siblings, 1 reply; 17+ messages in thread
From: Ingo Molnar @ 2008-03-25 20:08 UTC (permalink / raw)
  To: Venki Pallipadi
  Cc: Yinghai Lu, H. Peter Anvin, Thomas Gleixner, Andrew Morton,
	kernel list, suresh.b.siddha


* Venki Pallipadi <venkatesh.pallipadi@intel.com> wrote:

> > >  OK, note previous question: what is the motivation for having 
> > >  this as a whitelist (as opposed to a blacklist)?
> > 
> > Venkatesh could tell?
> 
> 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.

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

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH] x86: pat cpu feature bit setting for known cpus
  2008-03-25 20:08       ` Ingo Molnar
@ 2008-03-25 20:38         ` H. Peter Anvin
  2008-03-25 23:01           ` H. Peter Anvin
  0 siblings, 1 reply; 17+ messages in thread
From: H. Peter Anvin @ 2008-03-25 20:38 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Venki Pallipadi, Yinghai Lu, Thomas Gleixner, Andrew Morton,
	kernel list, suresh.b.siddha

Ingo Molnar wrote:
> * Venki Pallipadi <venkatesh.pallipadi@intel.com> wrote:
> 
>>>>  OK, note previous question: what is the motivation for having 
>>>>  this as a whitelist (as opposed to a blacklist)?
>>> Venkatesh could tell?
>> 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.
> 
> 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.
> 

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

	-hpa

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH] x86: pat cpu feature bit setting for known cpus
  2008-03-25 20:38         ` H. Peter Anvin
@ 2008-03-25 23:01           ` H. Peter Anvin
  2008-03-25 23:05             ` Yinghai Lu
  0 siblings, 1 reply; 17+ messages in thread
From: H. Peter Anvin @ 2008-03-25 23:01 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Venki Pallipadi, Yinghai Lu, Thomas Gleixner, Andrew Morton,
	kernel list, suresh.b.siddha

H. Peter Anvin wrote:
> Ingo Molnar wrote:
>> * Venki Pallipadi <venkatesh.pallipadi@intel.com> wrote:
>>
>>>>>  OK, note previous question: what is the motivation for having 
>>>>>  this as a whitelist (as opposed to a blacklist)?
>>>> Venkatesh could tell?
>>> 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.
>>
>> 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.
>>
> 
> Yes, using a whitelist of this type is wrong, IMO, and smells faintly of 
> vendor-lockin.
> 

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

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH] x86: pat cpu feature bit setting for known cpus
  2008-03-25 23:01           ` H. Peter Anvin
@ 2008-03-25 23:05             ` Yinghai Lu
  2008-03-25 23:06               ` H. Peter Anvin
  0 siblings, 1 reply; 17+ messages in thread
From: Yinghai Lu @ 2008-03-25 23:05 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Ingo Molnar, Venki Pallipadi, Thomas Gleixner, Andrew Morton,
	kernel list, suresh.b.siddha

On Tue, Mar 25, 2008 at 4:01 PM, H. Peter Anvin <hpa@zytor.com> wrote:
>
> H. Peter Anvin wrote:
>  > Ingo Molnar wrote:
>  >> * Venki Pallipadi <venkatesh.pallipadi@intel.com> wrote:
>  >>
>  >>>>>  OK, note previous question: what is the motivation for having
>  >>>>>  this as a whitelist (as opposed to a blacklist)?
>  >>>> Venkatesh could tell?
>  >>> 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.
>  >>
>  >> 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.
>  >>
>  >
>  > Yes, using a whitelist of this type is wrong, IMO, and smells faintly of
>  > vendor-lockin.
>  >
>
>  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.

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

YH

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH] x86: pat cpu feature bit setting for known cpus
  2008-03-25 23:05             ` Yinghai Lu
@ 2008-03-25 23:06               ` H. Peter Anvin
  2008-03-25 23:08                 ` Yinghai Lu
  0 siblings, 1 reply; 17+ messages in thread
From: H. Peter Anvin @ 2008-03-25 23:06 UTC (permalink / raw)
  To: Yinghai Lu
  Cc: Ingo Molnar, Venki Pallipadi, Thomas Gleixner, Andrew Morton,
	kernel list, suresh.b.siddha

Yinghai Lu wrote:
>>
>>  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.
> 
> if the PAT works, we may need to trim the memory according to MTRR, right?
> 

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

	-hpa

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH] x86: pat cpu feature bit setting for known cpus
  2008-03-25 23:06               ` H. Peter Anvin
@ 2008-03-25 23:08                 ` Yinghai Lu
  2008-03-25 23:38                   ` Pallipadi, Venkatesh
  2008-03-26  0:10                   ` H. Peter Anvin
  0 siblings, 2 replies; 17+ messages in thread
From: Yinghai Lu @ 2008-03-25 23:08 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Ingo Molnar, Venki Pallipadi, Thomas Gleixner, Andrew Morton,
	kernel list, suresh.b.siddha

On Tue, Mar 25, 2008 at 4:06 PM, H. Peter Anvin <hpa@zytor.com> wrote:
> Yinghai Lu wrote:
>  >>
>  >>  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.
>  >
>  > if the PAT works, we may need to trim the memory according to MTRR, right?
>  >
>
>  That doesn't seem like it's specific to PAT?

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

YH

^ permalink raw reply	[flat|nested] 17+ messages in thread

* RE: [PATCH] x86: pat cpu feature bit setting for known cpus
  2008-03-25 23:08                 ` Yinghai Lu
@ 2008-03-25 23:38                   ` Pallipadi, Venkatesh
  2008-03-26  0:01                     ` Yinghai Lu
  2008-03-26  0:10                   ` H. Peter Anvin
  1 sibling, 1 reply; 17+ messages in thread
From: Pallipadi, Venkatesh @ 2008-03-25 23:38 UTC (permalink / raw)
  To: Yinghai Lu, H. Peter Anvin
  Cc: Ingo Molnar, Thomas Gleixner, Andrew Morton, kernel list, Siddha,
	Suresh B, Barnes, Jesse

 

>-----Original Message-----
>From: Yinghai Lu [mailto:yhlu.kernel@gmail.com] 
>Sent: Tuesday, March 25, 2008 4:09 PM
>To: H. Peter Anvin
>Cc: Ingo Molnar; Pallipadi, Venkatesh; Thomas Gleixner; Andrew 
>Morton; kernel list; Siddha, Suresh B
>Subject: Re: [PATCH] x86: pat cpu feature bit setting for known cpus
>
>On Tue, Mar 25, 2008 at 4:06 PM, H. Peter Anvin <hpa@zytor.com> wrote:
>> Yinghai Lu wrote:
>>  >>
>>  >>  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.
>>  >
>>  > if the PAT works, we may need to trim the memory 
>according to MTRR, right?
>>  >
>>
>>  That doesn't seem like it's specific to PAT?
>
>could page table to  set WRBACK the range that is not covered 
>by MTRR in e820..
>

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

Thanks,
Venki


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH] x86: pat cpu feature bit setting for known cpus
  2008-03-25 23:38                   ` Pallipadi, Venkatesh
@ 2008-03-26  0:01                     ` Yinghai Lu
  0 siblings, 0 replies; 17+ messages in thread
From: Yinghai Lu @ 2008-03-26  0:01 UTC (permalink / raw)
  To: Pallipadi, Venkatesh
  Cc: H. Peter Anvin, Ingo Molnar, Thomas Gleixner, Andrew Morton,
	kernel list, Siddha, Suresh B, Barnes, Jesse

On Tue, Mar 25, 2008 at 4:38 PM, Pallipadi, Venkatesh
<venkatesh.pallipadi@intel.com> wrote:
>
>
>
>  >-----Original Message-----
>  >From: Yinghai Lu [mailto:yhlu.kernel@gmail.com]
>  >Sent: Tuesday, March 25, 2008 4:09 PM
>  >To: H. Peter Anvin
>  >Cc: Ingo Molnar; Pallipadi, Venkatesh; Thomas Gleixner; Andrew
>  >Morton; kernel list; Siddha, Suresh B
>  >Subject: Re: [PATCH] x86: pat cpu feature bit setting for known cpus
>  >
>  >On Tue, Mar 25, 2008 at 4:06 PM, H. Peter Anvin <hpa@zytor.com> wrote:
>  >> Yinghai Lu wrote:
>  >>  >>
>  >>  >>  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.
>  >>  >
>  >>  > if the PAT works, we may need to trim the memory
>  >according to MTRR, right?
>  >>  >
>  >>
>  >>  That doesn't seem like it's specific to PAT?
>  >
>  >could page table to  set WRBACK the range that is not covered
>  >by MTRR in e820..
>  >
>
>  Trimming of e820 memory is already done by Jesse's patch here
>  commit 99fc8d424bc5d80
>  Are you referring to similar thing?
>
Yes.

YH

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH] x86: pat cpu feature bit setting for known cpus
  2008-03-25 23:08                 ` Yinghai Lu
  2008-03-25 23:38                   ` Pallipadi, Venkatesh
@ 2008-03-26  0:10                   ` H. Peter Anvin
  1 sibling, 0 replies; 17+ messages in thread
From: H. Peter Anvin @ 2008-03-26  0:10 UTC (permalink / raw)
  To: Yinghai Lu
  Cc: Ingo Molnar, Venki Pallipadi, Thomas Gleixner, Andrew Morton,
	kernel list, suresh.b.siddha

Yinghai Lu wrote:
> On Tue, Mar 25, 2008 at 4:06 PM, H. Peter Anvin <hpa@zytor.com> wrote:
>> Yinghai Lu wrote:
>>  >>
>>  >>  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.
>>  >
>>  > if the PAT works, we may need to trim the memory according to MTRR, right?
>>  >
>>
>>  That doesn't seem like it's specific to PAT?
> 
> could page table to  set WRBACK the range that is not covered by MTRR in e820..
> 

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

	-hpa

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH] x86: pat cpu feature bit setting for known cpus
  2008-03-25  6:24 [PATCH] x86: pat cpu feature bit setting for known cpus Yinghai Lu
  2008-03-25 10:58 ` Ingo Molnar
  2008-03-25 13:38 ` H. Peter Anvin
@ 2008-03-28 13:41 ` Pavel Machek
  2008-03-28 14:51   ` Yinghai Lu
  2008-03-30 11:43 ` dean gaudet
  3 siblings, 1 reply; 17+ messages in thread
From: Pavel Machek @ 2008-03-28 13:41 UTC (permalink / raw)
  To: yhlu.kernel
  Cc: Ingo Molnar, H. Peter Anvin, Thomas Gleixner, Andrew Morton, kernel list


On Mon 2008-03-24 23:24:34, Yinghai Lu wrote:
> [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;
> +	}
>  }
>  

Cut&paste programming? Can you make it a function?

> 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->x86_model >= 15))
> +			set_cpu_cap(c, X86_FEATURE_PAT);
>  		break;
>  	}

one more copy...
							Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH] x86: pat cpu feature bit setting for known cpus
  2008-03-28 13:41 ` Pavel Machek
@ 2008-03-28 14:51   ` Yinghai Lu
  0 siblings, 0 replies; 17+ messages in thread
From: Yinghai Lu @ 2008-03-28 14:51 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Ingo Molnar, H. Peter Anvin, Thomas Gleixner, Andrew Morton, kernel list

On Fri, Mar 28, 2008 at 6:41 AM, Pavel Machek <pavel@ucw.cz> wrote:
>
>
>  On Mon 2008-03-24 23:24:34, Yinghai Lu wrote:
>  > [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;
>  > +     }
>  >  }
>  >
>
>  Cut&paste programming? Can you make it a function?

yes. just want to leave one stub, so could add other cap setting if
needed later in early or late identify_cpu.

>
>
>  > 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->x86_model >= 15))
>  > +                     set_cpu_cap(c, X86_FEATURE_PAT);
>  >               break;
>  >       }
>
>  one more copy...

for 64 bit.

YH

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH] x86: pat cpu feature bit setting for known cpus
  2008-03-25  6:24 [PATCH] x86: pat cpu feature bit setting for known cpus Yinghai Lu
                   ` (2 preceding siblings ...)
  2008-03-28 13:41 ` Pavel Machek
@ 2008-03-30 11:43 ` dean gaudet
  3 siblings, 0 replies; 17+ messages in thread
From: dean gaudet @ 2008-03-30 11:43 UTC (permalink / raw)
  To: yhlu.kernel
  Cc: Ingo Molnar, H. Peter Anvin, Thomas Gleixner, Andrew Morton, kernel list

On Mon, 24 Mar 2008, Yinghai Lu wrote:

> [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);

just a general comment on things like this... "x->x86 <= 0x11" ensures 
this file will have to be updated every time a new AMD CPU is released.


> +		break;
> +	case X86_VENDOR_INTEL:
> +		if (c->x86 == 0xF || (c->x86 == 6 && c->x86_model >= 15))

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

-dean

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2008-03-30 11:43 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-25  6:24 [PATCH] x86: pat cpu feature bit setting for known cpus Yinghai Lu
2008-03-25 10:58 ` Ingo Molnar
2008-03-25 13:38 ` H. Peter Anvin
2008-03-25 18:03   ` Yinghai Lu
2008-03-25 19:08     ` Venki Pallipadi
2008-03-25 20:08       ` Ingo Molnar
2008-03-25 20:38         ` H. Peter Anvin
2008-03-25 23:01           ` H. Peter Anvin
2008-03-25 23:05             ` Yinghai Lu
2008-03-25 23:06               ` H. Peter Anvin
2008-03-25 23:08                 ` Yinghai Lu
2008-03-25 23:38                   ` Pallipadi, Venkatesh
2008-03-26  0:01                     ` Yinghai Lu
2008-03-26  0:10                   ` H. Peter Anvin
2008-03-28 13:41 ` Pavel Machek
2008-03-28 14:51   ` Yinghai Lu
2008-03-30 11:43 ` dean gaudet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).