From patchwork Thu Jul 29 08:16:42 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Roedel X-Patchwork-Id: 114998 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o6T8EExj020126 for ; Thu, 29 Jul 2010 08:14:14 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754084Ab0G2IOL (ORCPT ); Thu, 29 Jul 2010 04:14:11 -0400 Received: from va3ehsobe006.messaging.microsoft.com ([216.32.180.16]:57287 "EHLO VA3EHSOBE009.bigfish.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754081Ab0G2IOJ (ORCPT ); Thu, 29 Jul 2010 04:14:09 -0400 Received: from mail90-va3-R.bigfish.com (10.7.14.251) by VA3EHSOBE009.bigfish.com (10.7.40.29) with Microsoft SMTP Server id 8.1.340.0; Thu, 29 Jul 2010 08:14:08 +0000 Received: from mail90-va3 (localhost.localdomain [127.0.0.1]) by mail90-va3-R.bigfish.com (Postfix) with ESMTP id 564987903C9; Thu, 29 Jul 2010 08:14:08 +0000 (UTC) X-SpamScore: -15 X-BigFish: VPS-15(zz98dNzz1202hzz15d4Rz32i2a8h87h61h) X-Spam-TCS-SCL: 0:0 X-FB-DOMAIN-IP-MATCH: fail Received: from mail90-va3 (localhost.localdomain [127.0.0.1]) by mail90-va3 (MessageSwitch) id 1280391247722350_24833; Thu, 29 Jul 2010 08:14:07 +0000 (UTC) Received: from VA3EHSMHS031.bigfish.com (unknown [10.7.14.235]) by mail90-va3.bigfish.com (Postfix) with ESMTP id ACA867E804D; Thu, 29 Jul 2010 08:14:07 +0000 (UTC) Received: from ausb3extmailp02.amd.com (163.181.251.22) by VA3EHSMHS031.bigfish.com (10.7.99.41) with Microsoft SMTP Server (TLS) id 14.0.482.44; Thu, 29 Jul 2010 08:14:07 +0000 Received: from ausb3twp02.amd.com ([163.181.250.38]) by ausb3extmailp02.amd.com (Switch-3.2.7/Switch-3.2.7) with SMTP id o6T8EjrI000703; Thu, 29 Jul 2010 03:14:48 -0500 X-WSS-ID: 0L6B87B-02-1LX-02 X-M-MSG: Received: from sausexhtp01.amd.com (sausexhtp01.amd.com [163.181.3.165]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by ausb3twp02.amd.com (Tumbleweed MailGate 3.7.2) with ESMTP id 27D9AC8AC5; Thu, 29 Jul 2010 03:13:58 -0500 (CDT) Received: from storexhtp02.amd.com (172.24.4.4) by sausexhtp01.amd.com (163.181.3.165) with Microsoft SMTP Server (TLS) id 8.2.254.0; Thu, 29 Jul 2010 03:14:02 -0500 Received: from gwo.osrc.amd.com (165.204.16.204) by storexhtp02.amd.com (172.24.4.4) with Microsoft SMTP Server id 8.2.254.0; Thu, 29 Jul 2010 04:14:01 -0400 Received: from lemmy.osrc.amd.com (lemmy.osrc.amd.com [165.204.15.93]) by gwo.osrc.amd.com (Postfix) with ESMTP id CFA6049C0F5; Thu, 29 Jul 2010 09:14:00 +0100 (BST) Received: by lemmy.osrc.amd.com (Postfix, from userid 1000) id 88BCCA040F; Thu, 29 Jul 2010 10:16:42 +0200 (CEST) Date: Thu, 29 Jul 2010 10:16:42 +0200 From: "Roedel, Joerg" To: Avi Kivity CC: Marcelo Tosatti , "kvm@vger.kernel.org" Subject: Re: [PATCH 0/6] svm intercept tests Message-ID: <20100729081642.GL26098@amd.com> References: <1280334351-6395-1-git-send-email-avi@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1280334351-6395-1-git-send-email-avi@redhat.com> Organization: Advanced Micro Devices =?iso-8859-1?Q?GmbH?= =?iso-8859-1?Q?=2C_Karl-Hammerschmidt-Str=2E_34=2C_85609_Dornach_bei_M=FC?= =?iso-8859-1?Q?nchen=2C_Gesch=E4ftsf=FChrer=3A_Thomas_M=2E_McCoy=2C_Giuli?= =?iso-8859-1?Q?ano_Meroni=2C_Andrew_Bowd=2C_Sitz=3A_Dornach=2C_Gemeinde_A?= =?iso-8859-1?Q?schheim=2C_Landkreis_M=FCnchen=2C_Registergericht_M=FCnche?= =?iso-8859-1?Q?n=2C?= HRB Nr. 43632 User-Agent: Mutt/1.5.20 (2009-06-14) X-Reverse-DNS: ausb3extmailp02.amd.com Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Thu, 29 Jul 2010 08:14:14 +0000 (UTC) diff --git a/kvm/test/x86/svm.c b/kvm/test/x86/svm.c index cb26af6..054bd2e 100644 --- a/kvm/test/x86/svm.c +++ b/kvm/test/x86/svm.c @@ -58,6 +58,7 @@ static void vmcb_ident(struct vmcb *vmcb) struct test { const char *name; + bool (*supported)(void); void (*prepare)(struct test *test); void (*guest_func)(struct test *test); bool (*finished)(struct test *test); @@ -108,6 +109,11 @@ static bool test_run(struct test *test, struct vmcb *vmcb) return success; } +static bool default_supported(void) +{ + return true; +} + static void default_prepare(struct test *test) { vmcb_ident(test->vmcb); @@ -203,21 +209,24 @@ static void test_cr3_intercept_bypass(struct test *test) } static struct test tests[] = { - { "null", default_prepare, null_test, default_finished, null_check }, - { "vmrun", default_prepare, test_vmrun, default_finished, check_vmrun }, - { "vmrun intercept check", prepare_no_vmrun_int, null_test, - default_finished, check_no_vmrun_int }, - { "cr3 read intercept", prepare_cr3_intercept, test_cr3_intercept, + { "null", default_supported, default_prepare, null_test, + default_finished, null_check }, + { "vmrun", default_supported, default_prepare, test_vmrun, + default_finished, check_vmrun }, + { "vmrun intercept check", default_supported, prepare_no_vmrun_int, + null_test, default_finished, check_no_vmrun_int }, + { "cr3 read intercept", default_supported, prepare_cr3_intercept, + test_cr3_intercept, default_finished, check_cr3_intercept }, + { "cr3 read nointercept", default_supported, default_prepare, + test_cr3_intercept, default_finished, check_cr3_nointercept }, + { "cr3 read intercept emulate", default_supported, + prepare_cr3_intercept_bypass, test_cr3_intercept_bypass, default_finished, check_cr3_intercept }, - { "cr3 read nointercept", default_prepare, test_cr3_intercept, - default_finished, check_cr3_nointercept }, - { "cr3 read intercept emulate", prepare_cr3_intercept_bypass, - test_cr3_intercept_bypass, default_finished, check_cr3_intercept } }; int main(int ac, char **av) { - int i, nr, passed; + int i, nr, passed, done; struct vmcb *vmcb; setup_vm(); @@ -233,11 +242,14 @@ int main(int ac, char **av) vmcb = alloc_page(); nr = ARRAY_SIZE(tests); - passed = 0; + passed = done = 0; for (i = 0; i < nr; ++i) { + if (!tests[i].supported()) + continue; + done += 1; passed += test_run(&tests[i], vmcb); } - printf("\nSUMMARY: %d TESTS, %d FAILURES\n", nr, (nr - passed)); - return passed == nr ? 0 : 1; + printf("\nSUMMARY: %d TESTS, %d FAILURES\n", done, (done - passed)); + return passed == done ? 0 : 1; }