* [PATCH, x86]: Add selfsnoop support
@ 2008-12-26 10:49 Uros Bizjak
2008-12-26 10:55 ` [PATCH, x86]: Corr: " Uros Bizjak
0 siblings, 1 reply; 2+ messages in thread
From: Uros Bizjak @ 2008-12-26 10:49 UTC (permalink / raw)
To: Linux Kernel Mailing List; +Cc: x86, Andi Kleen
[-- Attachment #1: Type: text/plain, Size: 492 bytes --]
Hello!
This patch ports the patch that implemented selfsnoop support [1] to
2.6.28-git. Unfortunately, the thread about the implementation died at
[2] without any resolution.
The patch works OK on my x86_64, but I don't think this qualifies as a
thorough test...
This is actually Andi Kleen's patch, his signed-off-by: signature is at [1].
[1] http://lkml.indiana.edu/hypermail/linux/kernel/0802.1/1331.html
[2] http://lkml.indiana.edu/hypermail/linux/kernel/0802.1/1891.html
Uros.
[-- Attachment #2: p --]
[-- Type: text/plain, Size: 1241 bytes --]
diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h
index cfdf8c2..bb6740b 100644
--- a/arch/x86/include/asm/cpufeature.h
+++ b/arch/x86/include/asm/cpufeature.h
@@ -229,6 +229,7 @@ extern const char * const x86_power_flags[32];
#define cpu_has_ds boot_cpu_has(X86_FEATURE_DS)
#define cpu_has_pebs boot_cpu_has(X86_FEATURE_PEBS)
#define cpu_has_clflush boot_cpu_has(X86_FEATURE_CLFLSH)
+#define cpu_has_selfsnoop boot_cpu_has(X86_FEATURE_SELFSNOOP)
#define cpu_has_bts boot_cpu_has(X86_FEATURE_BTS)
#define cpu_has_gbpages boot_cpu_has(X86_FEATURE_GBPAGES)
#define cpu_has_arch_perfmon boot_cpu_has(X86_FEATURE_ARCH_PERFMON)
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
index e89d248..07d0518 100644
--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -150,7 +150,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_model >= 4 && cpu_has_selfsnoop)
wbinvd();
}
@@ -181,7 +181,7 @@ static void cpa_flush_range(unsigned long start, int numpages, int cache)
on_each_cpu(__cpa_flush_range, NULL, 1);
- if (!cache)
+ if (!cache || cpu_has_selfsnoop)
return;
/*
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH, x86]: Corr: Add selfsnoop support
2008-12-26 10:49 [PATCH, x86]: Add selfsnoop support Uros Bizjak
@ 2008-12-26 10:55 ` Uros Bizjak
0 siblings, 0 replies; 2+ messages in thread
From: Uros Bizjak @ 2008-12-26 10:55 UTC (permalink / raw)
To: Uros Bizjak; +Cc: Linux Kernel Mailing List, x86, Andi Kleen
[-- Attachment #1: Type: text/plain, Size: 289 bytes --]
Uros Bizjak wrote:
> This patch ports the patch that implemented selfsnoop support [1] to
> 2.6.28-git. Unfortunately, the thread about the implementation died at
> [2] without any resolution.
Sorry, there was a logic typo in previous version, correct patch is
attached here.
Uros.
[-- Attachment #2: p --]
[-- Type: text/plain, Size: 1242 bytes --]
diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h
index cfdf8c2..bb6740b 100644
--- a/arch/x86/include/asm/cpufeature.h
+++ b/arch/x86/include/asm/cpufeature.h
@@ -229,6 +229,7 @@ extern const char * const x86_power_flags[32];
#define cpu_has_ds boot_cpu_has(X86_FEATURE_DS)
#define cpu_has_pebs boot_cpu_has(X86_FEATURE_PEBS)
#define cpu_has_clflush boot_cpu_has(X86_FEATURE_CLFLSH)
+#define cpu_has_selfsnoop boot_cpu_has(X86_FEATURE_SELFSNOOP)
#define cpu_has_bts boot_cpu_has(X86_FEATURE_BTS)
#define cpu_has_gbpages boot_cpu_has(X86_FEATURE_GBPAGES)
#define cpu_has_arch_perfmon boot_cpu_has(X86_FEATURE_ARCH_PERFMON)
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
index e89d248..07d0518 100644
--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -150,7 +150,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_model >= 4 && !cpu_has_selfsnoop)
wbinvd();
}
@@ -181,7 +181,7 @@ static void cpa_flush_range(unsigned long start, int numpages, int cache)
on_each_cpu(__cpa_flush_range, NULL, 1);
- if (!cache)
+ if (!cache || cpu_has_selfsnoop)
return;
/*
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-12-26 10:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-26 10:49 [PATCH, x86]: Add selfsnoop support Uros Bizjak
2008-12-26 10:55 ` [PATCH, x86]: Corr: " Uros Bizjak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox