diff mbox

[QEMU-KVM,5/7] test: add ipi latency test

Message ID 1253523338-22784-6-git-send-email-avi@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Avi Kivity Sept. 21, 2009, 8:55 a.m. UTC
Signed-off-by: Avi Kivity <avi@redhat.com>
---
 kvm/user/test/x86/vmexit.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
diff mbox

Patch

diff --git a/kvm/user/test/x86/vmexit.c b/kvm/user/test/x86/vmexit.c
index 76f676d..29bb32a 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]);