From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: [patch 2/2] test: vmexit: run parallel tests on each cpu Date: Mon, 28 Sep 2009 08:22:10 -0300 Message-ID: <20090928112247.443732285@redhat.com> References: <20090928112208.841396420@redhat.com> Cc: avi@redhat.com, Marcelo Tosatti To: kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:25036 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751983AbZI1SYI (ORCPT ); Mon, 28 Sep 2009 14:24:08 -0400 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n8SIOD0E015095 for ; Mon, 28 Sep 2009 14:24:13 -0400 Content-Disposition: inline; filename=vmexit-parallel Sender: kvm-owner@vger.kernel.org List-ID: So one can measure SMP overhead. Signed-off-by: Marcelo Tosatti 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; }