[patch 2/2] test: vmexit: run parallel tests on each cpu

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



So one can measure SMP overhead.

Signed-off-by: Marcelo Tosatti <mtosatti@xxxxxxxxxx>

Index: qemu-kvm-test/kvm/user/test/x86/vmexit.c
===================================================================
--- qemu-kvm-test.orig/kvm/user/test/x86/vmexit.c
+++ qemu-kvm-test/kvm/user/test/x86/vmexit.c
@@ -85,6 +85,9 @@ static struct test {
 	{ vmcall, "vmcall", },
 	{ mov_from_cr8, "mov_from_cr8" },
 	{ mov_to_cr8, "mov_to_cr8" },
+};
+
+static struct test smp_tests[] = {
 	{ ipi, "ipi", is_smp },
 	{ ipi_halt, "ipi+halt", is_smp },
 };
@@ -113,14 +116,25 @@ static void do_test(struct test *test)
 
 #define ARRAY_SIZE(_x) (sizeof(_x) / sizeof((_x)[0]))
 
-int main(void)
+static void do_tests(void *junk)
 {
 	int i;
 
-	smp_init();
-
 	for (i = 0; i < ARRAY_SIZE(tests); ++i)
 		do_test(&tests[i]);
+}
+
+int main(void)
+{
+	int i, n;
+
+	smp_init();
+
+	for (n = cpu_count(); n > 0; n--)
+		on_cpu(n-1, do_tests, 0, 0);
+
+	for (i = 0; i < ARRAY_SIZE(smp_tests); ++i)
+		do_test(&smp_tests[i]);
 
 	return 0;
 }


--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux