From: Borislav Petkov <bp@amd64.org>
To: <hpa@zytor.com>, <mingo@elte.hu>, <tglx@linutronix.de>,
Avi Kivity <avi@redhat.com>,
Marcelo Tosatti <mtosatti@redhat.com>
Cc: <x86@kernel.org>,
kvm@vger.kernel.org, <linux-kernel@vger.kernel.org>,
Borislav Petkov <borislav.petkov@amd.com>
Subject: [PATCH 1/2] x86, lib: Add a wbinvd helper for an arbitrary cpu set
Date: Wed, 24 Nov 2010 18:44:03 +0100 [thread overview]
Message-ID: <1290620644-27423-1-git-send-email-bp@amd64.org> (raw)
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
next reply other threads:[~2010-11-24 17:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-24 17:44 Borislav Petkov [this message]
2010-11-24 17:44 ` [PATCH 2/2] kvm: Use wbinvd library functions Borislav Petkov
2010-11-24 17:49 ` [PATCH 1/2] x86, lib: Add a wbinvd helper for an arbitrary cpu set H. Peter Anvin
2010-11-24 18:22 ` Borislav Petkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1290620644-27423-1-git-send-email-bp@amd64.org \
--to=bp@amd64.org \
--cc=avi@redhat.com \
--cc=borislav.petkov@amd.com \
--cc=hpa@zytor.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=mtosatti@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox