wbinvd_on_many_cpus will call smp_call_function_many(), which should
be more efficient that iterating cpus since it would run wbinvd()
concurrently locally and remotely
it can be used by the below patch
https://patchwork.kernel.org/project/kvm/patch/[email protected]/
Cc: Zheyun Shen <[email protected]>
Cc: Tom Lendacky <[email protected]>
Signed-off-by: Li RongQing <[email protected]>
---
arch/x86/include/asm/smp.h | 7 +++++++
arch/x86/lib/cache-smp.c | 7 +++++++
2 files changed, 14 insertions(+)
diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h
index a35936b..70973de 100644
--- a/arch/x86/include/asm/smp.h
+++ b/arch/x86/include/asm/smp.h
@@ -111,6 +111,7 @@ void native_play_dead(void);
void play_dead_common(void);
void wbinvd_on_cpu(int cpu);
int wbinvd_on_all_cpus(void);
+int wbinvd_on_many_cpus(const struct cpumask *mask);
void smp_kick_mwait_play_dead(void);
@@ -159,6 +160,12 @@ static inline int wbinvd_on_all_cpus(void)
return 0;
}
+static inline int wbinvd_on_many_cpus(const struct cpumask *mask)
+{
+ wbinvd();
+ return 0;
+}
+
static inline struct cpumask *cpu_llc_shared_mask(int cpu)
{
return (struct cpumask *)cpumask_of(0);
diff --git a/arch/x86/lib/cache-smp.c b/arch/x86/lib/cache-smp.c
index 7af743b..5950d1b 100644
--- a/arch/x86/lib/cache-smp.c
+++ b/arch/x86/lib/cache-smp.c
@@ -20,3 +20,10 @@ int wbinvd_on_all_cpus(void)
return 0;
}
EXPORT_SYMBOL(wbinvd_on_all_cpus);
+
+int wbinvd_on_many_cpus(const struct cpumask *mask)
+{
+ smp_call_function_many(mask, __wbinvd, NULL, 1);
+ return 0;
+}
+EXPORT_SYMBOL(wbinvd_on_many_cpus);
--
2.9.4
* Li RongQing <[email protected]> wrote:
> wbinvd_on_many_cpus will call smp_call_function_many(), which should
> be more efficient that iterating cpus since it would run wbinvd()
> concurrently locally and remotely
>
> it can be used by the below patch
> https://patchwork.kernel.org/project/kvm/patch/[email protected]/
>
> Cc: Zheyun Shen <[email protected]>
> Cc: Tom Lendacky <[email protected]>
> Signed-off-by: Li RongQing <[email protected]>
> ---
> arch/x86/include/asm/smp.h | 7 +++++++
> arch/x86/lib/cache-smp.c | 7 +++++++
> 2 files changed, 14 insertions(+)
The two patches should be submitted together within the same series.
Thanks,
Ingo