public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Cathy Avery <cavery@redhat.com>
To: kvm@vger.kernel.org
Cc: seanjc@google.com
Subject: [kvm-unit-tests v3 PATCH 2/3] vmx: Explicitly setup a dummy EPTP in EPT accessed and dirty flag test
Date: Wed, 16 Feb 2022 12:01:48 -0500	[thread overview]
Message-ID: <20220216170149.25792-3-cavery@redhat.com> (raw)
In-Reply-To: <20220216170149.25792-1-cavery@redhat.com>

test_ept_eptp is not explicitly calling setup_dummy_ept() to initialize
EPTP to a good starting value resulting in test failures when it is called
in isolation or when EPTP has been changed by some previous test.

Signed-off-by: Cathy Avery <cavery@redhat.com>
---
 x86/vmx_tests.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c
index 0dab98e..617f9dd 100644
--- a/x86/vmx_tests.c
+++ b/x86/vmx_tests.c
@@ -4714,12 +4714,11 @@ static void test_ept_eptp(void)
 {
 	u32 primary_saved = vmcs_read(CPU_EXEC_CTRL0);
 	u32 secondary_saved = vmcs_read(CPU_EXEC_CTRL1);
-	u64 eptp_saved = vmcs_read(EPTP);
 	u32 primary = primary_saved;
 	u32 secondary = secondary_saved;
-	u64 eptp = eptp_saved;
 	u32 i, maxphysaddr;
 	u64 j, resv_bits_mask = 0;
+	u64 eptp_saved, eptp;
 
 	if (!((ctrl_cpu_rev[0].clr & CPU_SECONDARY) &&
 	    (ctrl_cpu_rev[1].clr & CPU_EPT))) {
@@ -4727,6 +4726,9 @@ static void test_ept_eptp(void)
 		return;
 	}
 
+	setup_dummy_ept();
+	eptp = eptp_saved = vmcs_read(EPTP);
+
 	/* Support for 4-level EPT is mandatory. */
 	report(is_4_level_ept_supported(), "4-level EPT support check");
 
-- 
2.31.1


  parent reply	other threads:[~2022-02-16 17:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-16 17:01 [kvm-unit-tests v3 PATCH 0/3] vmx: Fix EPT accessed and dirty flag test Cathy Avery
2022-02-16 17:01 ` [kvm-unit-tests v3 PATCH 1/3] vmx: Cleanup test_vmx_vmlaunch to generate clearer and more consolidated test reports Cathy Avery
2022-02-17  0:56   ` Sean Christopherson
2022-02-16 17:01 ` Cathy Avery [this message]
2022-02-17  0:56   ` [kvm-unit-tests v3 PATCH 2/3] vmx: Explicitly setup a dummy EPTP in EPT accessed and dirty flag test Sean Christopherson
2022-02-16 17:01 ` [kvm-unit-tests v3 PATCH 3/3] vmx: Correctly refresh EPTP value " Cathy Avery
2022-02-17  0:57   ` Sean Christopherson

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=20220216170149.25792-3-cavery@redhat.com \
    --to=cavery@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=seanjc@google.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