public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Nadav Amit <nadav.amit@gmail.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org, Nadav Amit <nadav.amit@gmail.com>,
	Sean Christopherson <sean.j.christopherson@intel.com>
Subject: [kvm-unit-tests PATCH] x86: Fix max VMCS field encoding index check
Date: Sat, 18 May 2019 09:37:43 -0700	[thread overview]
Message-ID: <20190518163743.5396-1-nadav.amit@gmail.com> (raw)

The test that checks the maximum VMCS field encoding does not probe all
possible VMCS fields. As a result it might fail since the actual
IA32_VMX_VMCS_ENUM.MAX_INDEX would be higher than the expected value.

Change the test to check that the maximum of the supported probed
VMCS fields is lower/equal than the actual reported
IA32_VMX_VMCS_ENUM.MAX_INDEX.

This test might still fail on bare-metal due to errata (e.g., BDX30).

Cc: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Nadav Amit <nadav.amit@gmail.com>
---
 x86/vmx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/x86/vmx.c b/x86/vmx.c
index 962ec0f..f540e15 100644
--- a/x86/vmx.c
+++ b/x86/vmx.c
@@ -361,8 +361,8 @@ static void test_vmwrite_vmread(void)
 	report("VMWRITE/VMREAD", __check_all_vmcs_fields(0x42, &max_index));
 
 	vmcs_enum_max = rdmsr(MSR_IA32_VMX_VMCS_ENUM) & VMCS_FIELD_INDEX_MASK;
-	report("VMX_VMCS_ENUM.MAX_INDEX expected: %x, actual: %x",
-		vmcs_enum_max == max_index, max_index, vmcs_enum_max);
+	report("VMX_VMCS_ENUM.MAX_INDEX expected at least: %x, actual: %x",
+		vmcs_enum_max >= max_index, max_index, vmcs_enum_max);
 
 	assert(!vmcs_clear(vmcs));
 	free_page(vmcs);
-- 
2.17.1


             reply	other threads:[~2019-05-18 23:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-18 16:37 Nadav Amit [this message]
2019-05-20 14:51 ` [kvm-unit-tests PATCH] x86: Fix max VMCS field encoding index check Paolo Bonzini
2019-12-12 22:59 ` Jim Mattson
2019-12-13  9:13   ` Nadav Amit
2019-12-13 17:30     ` Jim Mattson
2019-12-18  0:24       ` Sean Christopherson
2019-12-19  8:52         ` Nadav Amit

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=20190518163743.5396-1-nadav.amit@gmail.com \
    --to=nadav.amit@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=sean.j.christopherson@intel.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