summaryrefslogtreecommitdiff
path: root/kvm
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2009-09-16 14:48:12 +0300
committerAvi Kivity <avi@redhat.com>2009-09-22 11:57:13 +0300
commit08f0434fd732441c91f0d1f535757866b3aaf8f8 (patch)
tree5d3a523388abd2173e106605def2a4e11bb533ae /kvm
parenttest: add conditional execution for vmexit tests (diff)
downloadqemu-kvm-08f0434fd732441c91f0d1f535757866b3aaf8f8.tar.gz
qemu-kvm-08f0434fd732441c91f0d1f535757866b3aaf8f8.tar.bz2
qemu-kvm-08f0434fd732441c91f0d1f535757866b3aaf8f8.zip
test: add ipi latency test
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'kvm')
-rw-r--r--kvm/user/test/x86/vmexit.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/kvm/user/test/x86/vmexit.c b/kvm/user/test/x86/vmexit.c
index 76f676d48..29bb32a11 100644
--- a/kvm/user/test/x86/vmexit.c
+++ b/kvm/user/test/x86/vmexit.c
@@ -1,5 +1,6 @@
#include "libcflat.h"
+#include "smp.h"
static inline unsigned long long rdtsc()
{
@@ -51,6 +52,20 @@ static void mov_to_cr8(void)
asm volatile ("mov %0, %%cr8" : : "r"(cr8));
}
+static int is_smp(void)
+{
+ return cpu_count() > 1;
+}
+
+static void nop(void *junk)
+{
+}
+
+static void ipi(void)
+{
+ on_cpu(1, nop, 0);
+}
+
static struct test {
void (*func)(void);
const char *name;
@@ -60,6 +75,7 @@ static struct test {
{ vmcall, "vmcall", },
{ mov_from_cr8, "mov_from_cr8" },
{ mov_to_cr8, "mov_to_cr8" },
+ { ipi, "ipi", is_smp },
};
static void do_test(struct test *test)
@@ -86,6 +102,8 @@ int main(void)
{
int i;
+ smp_init();
+
for (i = 0; i < ARRAY_SIZE(tests); ++i)
do_test(&tests[i]);