* [patch 1/2] x86: bugfix wbinvd() model check instead of family check
2009-05-22 20:23 [patch 0/2] x86: Misc bug fixes in pageattr.c venkatesh.pallipadi
@ 2009-05-22 20:23 ` venkatesh.pallipadi
2009-05-22 20:23 ` [patch 2/2] x86: cpa_flush_array wbinvd should be done on all CPUs venkatesh.pallipadi
2009-05-22 20:34 ` [patch 0/2] x86: Misc bug fixes in pageattr.c H. Peter Anvin
2 siblings, 0 replies; 4+ messages in thread
From: venkatesh.pallipadi @ 2009-05-22 20:23 UTC (permalink / raw)
To: mingo, tglx, hpa
Cc: linux-kernel, suresh.b.siddha, shaohua.li, Venkatesh Pallipadi
[-- Attachment #1: 0001--bugfix-wbinvd-model-check-instead-of-family-chec.patch --]
[-- Type: text/plain, Size: 1049 bytes --]
wbinvd is supported on all CPUs 486 or later. But,
pageattr.c is checking x86_model >= 4 before wbinvd(), which looks like
an oversight bug. It was first introduced at one place by changeset
d7c8f21a8cad0228c7c5ce2bb6dbd95d1ee49d13 and got copied over to second
place in the same file later.
Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
---
arch/x86/mm/pageattr.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
index 797f9f1..2cc019a 100644
--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -153,7 +153,7 @@ static void __cpa_flush_all(void *arg)
*/
__flush_tlb_all();
- if (cache && boot_cpu_data.x86_model >= 4)
+ if (cache && boot_cpu_data.x86 >= 4)
wbinvd();
}
@@ -218,7 +218,7 @@ static void cpa_flush_array(unsigned long *start, int numpages, int cache,
/* 4M threshold */
if (numpages >= 1024) {
- if (boot_cpu_data.x86_model >= 4)
+ if (boot_cpu_data.x86 >= 4)
wbinvd();
return;
}
--
1.6.0.6
--
^ permalink raw reply related [flat|nested] 4+ messages in thread* [patch 2/2] x86: cpa_flush_array wbinvd should be done on all CPUs
2009-05-22 20:23 [patch 0/2] x86: Misc bug fixes in pageattr.c venkatesh.pallipadi
2009-05-22 20:23 ` [patch 1/2] x86: bugfix wbinvd() model check instead of family check venkatesh.pallipadi
@ 2009-05-22 20:23 ` venkatesh.pallipadi
2009-05-22 20:34 ` [patch 0/2] x86: Misc bug fixes in pageattr.c H. Peter Anvin
2 siblings, 0 replies; 4+ messages in thread
From: venkatesh.pallipadi @ 2009-05-22 20:23 UTC (permalink / raw)
To: mingo, tglx, hpa
Cc: linux-kernel, suresh.b.siddha, shaohua.li, Venkatesh Pallipadi
[-- Attachment #1: 0002--cpa_flush_array-wbinvd-should-be-done-on-all-CPUs.patch --]
[-- Type: text/plain, Size: 1111 bytes --]
cpa_flush_array seems to prefer wbinvd() over clflush at 4M threshold.
clflush needs to be done on only one CPU as per instruction definition.
wbinvd() however, should be done on all CPUs.
Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
---
arch/x86/mm/pageattr.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
index 2cc019a..0f9052b 100644
--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -204,6 +204,11 @@ static void cpa_flush_range(unsigned long start, int numpages, int cache)
}
}
+static void wbinvd_local(void *unused)
+{
+ wbinvd();
+}
+
static void cpa_flush_array(unsigned long *start, int numpages, int cache,
int in_flags, struct page **pages)
{
@@ -219,7 +224,8 @@ static void cpa_flush_array(unsigned long *start, int numpages, int cache,
/* 4M threshold */
if (numpages >= 1024) {
if (boot_cpu_data.x86 >= 4)
- wbinvd();
+ on_each_cpu(wbinvd_local, NULL, 1);
+
return;
}
/*
--
1.6.0.6
--
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [patch 0/2] x86: Misc bug fixes in pageattr.c
2009-05-22 20:23 [patch 0/2] x86: Misc bug fixes in pageattr.c venkatesh.pallipadi
2009-05-22 20:23 ` [patch 1/2] x86: bugfix wbinvd() model check instead of family check venkatesh.pallipadi
2009-05-22 20:23 ` [patch 2/2] x86: cpa_flush_array wbinvd should be done on all CPUs venkatesh.pallipadi
@ 2009-05-22 20:34 ` H. Peter Anvin
2 siblings, 0 replies; 4+ messages in thread
From: H. Peter Anvin @ 2009-05-22 20:34 UTC (permalink / raw)
To: venkatesh.pallipadi
Cc: mingo, tglx, linux-kernel, suresh.b.siddha, shaohua.li
venkatesh.pallipadi@intel.com wrote:
> Couple of misc bugfixes in pageattr.c found by looking at the code while
> working on an unrelated patch.
I'm taking care of these.
-hpa
^ permalink raw reply [flat|nested] 4+ messages in thread