public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: "Roedel, Joerg" <Joerg.Roedel@amd.com>
To: Avi Kivity <avi@redhat.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>
Subject: Re: [PATCH 0/6] svm intercept tests
Date: Thu, 29 Jul 2010 10:16:42 +0200	[thread overview]
Message-ID: <20100729081642.GL26098@amd.com> (raw)
In-Reply-To: <1280334351-6395-1-git-send-email-avi@redhat.com>

On Wed, Jul 28, 2010 at 12:25:45PM -0400, Avi Kivity wrote:
> This patchset adds three more svm tests: cr3 read intercept, cr3 read
> intercept (disabled), and cr3 read intercept through the instruction
> emulator.  As usual, 66.7% of the tests pass.

For the next_rip test I added another feature to the test-framework. Can
you apply the attached patch please to it? It will save me from some
rebasing when you write more tests before I finish my two tests :-)

	Joerg


>From 282dafc0d476b016967c91742008ecf21aaf36e1 Mon Sep 17 00:00:00 2001
From: Joerg Roedel <joerg.roedel@amd.com>
Date: Wed, 28 Jul 2010 15:56:32 +0200
Subject: [PATCH] test: Run tests only if supported on the current hardware

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
---
 kvm/test/x86/svm.c |   38 +++++++++++++++++++++++++-------------
 1 files changed, 25 insertions(+), 13 deletions(-)

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


-- 
Joerg Roedel - AMD Operating System Research Center

Advanced Micro Devices GmbH Einsteinring 24 85609 Dornach
General Managers: Alberto Bozzo, Andrew Bowd
Registration: Dornach, Landkr. Muenchen; Registerger. Muenchen, HRB Nr. 43632


  parent reply	other threads:[~2010-07-29  8:14 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-28 16:25 [PATCH 0/6] svm intercept tests Avi Kivity
2010-07-28 16:25 ` [PATCH 1/6] test: add scratch word for use by svm tests Avi Kivity
2010-07-28 16:25 ` [PATCH 2/6] test: add intercepted and unintercepted cr3 read tests for svm Avi Kivity
2010-07-28 16:25 ` [PATCH 3/6] test: add pause() instruction accessor Avi Kivity
2010-07-28 16:25 ` [PATCH 4/6] test: add cli() and sti() instruction accessors Avi Kivity
2010-07-28 16:25 ` [PATCH 5/6] test: ensure svm tests are executed with interrupts disabled by default Avi Kivity
2010-07-28 16:25 ` [PATCH 6/6] test: verify that the emulator honours svm intercepts Avi Kivity
2010-07-28 18:04   ` Avi Kivity
2010-07-29  7:43     ` Roedel, Joerg
2010-07-29  7:48       ` Avi Kivity
2010-07-29  7:59         ` Roedel, Joerg
2010-07-29  8:45           ` Avi Kivity
2010-07-29  8:16 ` Roedel, Joerg [this message]
2010-07-29 21:40   ` [PATCH 0/6] svm intercept tests Marcelo Tosatti

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100729081642.GL26098@amd.com \
    --to=joerg.roedel@amd.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox