From patchwork Mon Sep 28 11:22:10 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 50432 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n8SIOFrs022784 for ; Mon, 28 Sep 2009 18:24:15 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752398AbZI1SYK (ORCPT ); Mon, 28 Sep 2009 14:24:10 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752377AbZI1SYJ (ORCPT ); Mon, 28 Sep 2009 14:24:09 -0400 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 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n8SIOCMB021357; Mon, 28 Sep 2009 14:24:12 -0400 Received: from amt.cnet (vpn-10-27.str.redhat.com [10.32.10.27]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n8SIO9Di007922; Mon, 28 Sep 2009 14:24:10 -0400 Received: from amt.cnet (amt.cnet [127.0.0.1]) by amt.cnet (Postfix) with ESMTP id EBA9355800F; Mon, 28 Sep 2009 15:23:40 -0300 (BRT) Received: (from marcelo@localhost) by amt.cnet (8.14.3/8.14.3/Submit) id n8SINcx1009862; Mon, 28 Sep 2009 15:23:38 -0300 Message-Id: <20090928112247.443732285@redhat.com> User-Agent: quilt/0.47-1 Date: Mon, 28 Sep 2009 08:22:10 -0300 From: Marcelo Tosatti To: kvm@vger.kernel.org Cc: avi@redhat.com, Marcelo Tosatti Subject: [patch 2/2] test: vmexit: run parallel tests on each cpu References: <20090928112208.841396420@redhat.com> Content-Disposition: inline; filename=vmexit-parallel X-Scanned-By: MIMEDefang 2.67 on 10.5.11.21 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org So one can measure SMP overhead. Signed-off-by: Marcelo Tosatti --- 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 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; }