lkml.org 
[lkml]   [2010]   [Nov]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/2] x86, lib: Add a wbinvd helper for an arbitrary cpu set
Date
From: Borislav Petkov <borislav.petkov@amd.com>

Add a wbinvd helper for an arbitrary set of CPUs.

Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
---
arch/x86/include/asm/smp.h | 4 +++-
arch/x86/lib/cache-smp.c | 12 ++++++++++++
2 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h
index 4c2f63c..f7805f1 100644
--- a/arch/x86/include/asm/smp.h
+++ b/arch/x86/include/asm/smp.h
@@ -141,6 +141,7 @@ void native_cpu_die(unsigned int cpu);
void native_play_dead(void);
void play_dead_common(void);
void wbinvd_on_cpu(int cpu);
+void wbinvd_on_cpus(const struct cpumask *);
int wbinvd_on_all_cpus(void);

void native_send_call_func_ipi(const struct cpumask *mask);
@@ -155,7 +156,8 @@ static inline int num_booting_cpus(void)
return cpumask_weight(cpu_callout_mask);
}
#else /* !CONFIG_SMP */
-#define wbinvd_on_cpu(cpu) wbinvd()
+#define wbinvd_on_cpu(cpu) wbinvd()
+#define wbinvd_on_cpus(mask) wbinvd()
static inline int wbinvd_on_all_cpus(void)
{
wbinvd();
diff --git a/arch/x86/lib/cache-smp.c b/arch/x86/lib/cache-smp.c
index a3c6688..7778d56 100644
--- a/arch/x86/lib/cache-smp.c
+++ b/arch/x86/lib/cache-smp.c
@@ -12,6 +12,18 @@ void wbinvd_on_cpu(int cpu)
}
EXPORT_SYMBOL(wbinvd_on_cpu);

+void wbinvd_on_cpus(const struct cpumask *mask)
+{
+ int this_cpu = get_cpu();
+
+ if (cpumask_test_cpu(this_cpu, mask))
+ wbinvd();
+
+ smp_call_function_many(mask, __wbinvd, NULL, 1);
+ put_cpu();
+}
+EXPORT_SYMBOL(wbinvd_on_cpus);
+
int wbinvd_on_all_cpus(void)
{
return on_each_cpu(__wbinvd, NULL, 1);
--
1.7.3.1.50.g1e633


\
 
 \ /
  Last update: 2010-11-24 18:47    [W:0.058 / U:0.208 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site