From patchwork Mon Sep 21 08:55:36 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avi Kivity X-Patchwork-Id: 49012 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 n8L8trnG027919 for ; Mon, 21 Sep 2009 08:55:53 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755463AbZIUIzq (ORCPT ); Mon, 21 Sep 2009 04:55:46 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755454AbZIUIzo (ORCPT ); Mon, 21 Sep 2009 04:55:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33094 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755468AbZIUIzk (ORCPT ); Mon, 21 Sep 2009 04:55:40 -0400 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n8L8thJO012770 for ; Mon, 21 Sep 2009 04:55:43 -0400 Received: from cleopatra.tlv.redhat.com (cleopatra.tlv.redhat.com [10.35.255.11]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n8L8tfxT002142; Mon, 21 Sep 2009 04:55:42 -0400 Received: from localhost.localdomain (cleopatra.tlv.redhat.com [10.35.255.11]) by cleopatra.tlv.redhat.com (Postfix) with ESMTP id F0304250052; Mon, 21 Sep 2009 11:55:38 +0300 (IDT) From: Avi Kivity To: kvm@vger.kernel.org Cc: Marcelo Tosatti Subject: [PATCH QEMU-KVM 5/7] test: add ipi latency test Date: Mon, 21 Sep 2009 11:55:36 +0300 Message-Id: <1253523338-22784-6-git-send-email-avi@redhat.com> In-Reply-To: <1253523338-22784-1-git-send-email-avi@redhat.com> References: <1253523338-22784-1-git-send-email-avi@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.16 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Signed-off-by: Avi Kivity --- kvm/user/test/x86/vmexit.c | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+), 0 deletions(-) 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]);