lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 24 Nov 2010 18:44:03 +0100
From:	Borislav Petkov <bp@...64.org>
To:	<hpa@...or.com>, <mingo@...e.hu>, <tglx@...utronix.de>,
	Avi Kivity <avi@...hat.com>,
	Marcelo Tosatti <mtosatti@...hat.com>
Cc:	<x86@...nel.org>, kvm@...r.kernel.org,
	<linux-kernel@...r.kernel.org>,
	Borislav Petkov <borislav.petkov@....com>
Subject: [PATCH 1/2] x86, lib: Add a wbinvd helper for an arbitrary cpu set

From: Borislav Petkov <borislav.petkov@....com>

Add a wbinvd helper for an arbitrary set of CPUs.

Signed-off-by: Borislav Petkov <borislav.petkov@....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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ