mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: linux-kernel@vger.kernel.org,
	Xiangfei Ma <xiangfeix.ma@intel.com>,
	 Yan Zhao <yan.y.zhao@intel.com>,
	Sean Christopherson <seanjc@google.com>
Subject: [PATCH 2/2] nVMX: Verify KVM actually loads the value in HOST_PAT into the PAT MSR
Date: Wed,  5 Jun 2024 15:45:27 -0700	[thread overview]
Message-ID: <20240605224527.2907272-3-seanjc@google.com> (raw)
In-Reply-To: <20240605224527.2907272-1-seanjc@google.com>

Check that the PAT MSR is actually loaded with vmcs.HOST_PAT on VM-Exit
in the testcase that shoves all legal PAT values into HOST_PAT.

Signed-off-by: Sean Christopherson <seanjc@google.com>
---
 x86/vmx_tests.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c
index 8a17dd90..ef7e0ea9 100644
--- a/x86/vmx_tests.c
+++ b/x86/vmx_tests.c
@@ -7275,6 +7275,11 @@ static void test_pat(u32 field, const char * field_name, u32 ctrl_field,
 					error = 0;
 
 				test_vmx_vmlaunch(error);
+
+				if (!error)
+					report(rdmsr(MSR_IA32_CR_PAT) == val,
+					       "Expected PAT = 0x%lx, got 0x%lx",
+						val, rdmsr(MSR_IA32_CR_PAT));
 				wrmsr(MSR_IA32_CR_PAT, pat_msr_saved);
 
 				report_prefix_pop();
-- 
2.45.1.467.gbab1589fc0-goog


  parent reply	other threads:[~2024-06-05 22:45 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-05 22:45 [PATCH 0/2] nVMX: Ensure host's PAT stays sane Sean Christopherson
2024-06-05 22:45 ` [PATCH 1/2] nVMX: Ensure host's PAT is loaded at the end of all VMX tests Sean Christopherson
2024-06-11  1:40   ` Yan Zhao
2024-06-11  1:47     ` Sean Christopherson
2024-06-11  2:03       ` Yan Zhao
2024-06-05 22:45 ` Sean Christopherson [this message]
2024-06-05 23:03 ` [PATCH 0/2] nVMX: Ensure host's PAT stays sane Sean Christopherson
2024-06-12  1:18 ` Sean Christopherson
2024-06-12  1:47   ` Yan Zhao
2024-06-12  1:50     ` 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=20240605224527.2907272-3-seanjc@google.com \
    --to=seanjc@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=xiangfeix.ma@intel.com \
    --cc=yan.y.zhao@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

all inboxes | Powered by JetHome®