diff mbox

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

Message ID 20090928112247.443732285@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Marcelo Tosatti Sept. 28, 2009, 11:22 a.m. UTC
So one can measure SMP overhead.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>



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

Comments

Avi Kivity Sept. 29, 2009, 8:35 a.m. UTC | #1
On 09/28/2009 01:22 PM, Marcelo Tosatti wrote:
> So one can measure SMP overhead.
>
> +
> +	for (n = cpu_count(); n>  0; n--)
> +		on_cpu(n-1, do_tests, 0, 0);
>    

Should be done inside do_test(), so we can start the measurement on all 
cpus at the same time (right now, if some cpus calibrate earlier, they 
will finish sooner and the others will have an easier time).
diff mbox

Patch

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;
 }