From: Sean Christopherson <seanjc@google.com>
To: Yan Zhao <yan.y.zhao@intel.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
linux-kernel@vger.kernel.org,
Xiangfei Ma <xiangfeix.ma@intel.com>
Subject: Re: [PATCH 1/2] nVMX: Ensure host's PAT is loaded at the end of all VMX tests
Date: Mon, 10 Jun 2024 18:47:55 -0700 [thread overview]
Message-ID: <ZmesywdpFG3qDIkZ@google.com> (raw)
In-Reply-To: <ZmerKzEHlIwne5ka@yzhao56-desk.sh.intel.com>
On Tue, Jun 11, 2024, Yan Zhao wrote:
> On Wed, Jun 05, 2024 at 03:45:26PM -0700, Sean Christopherson wrote:
> > @@ -7274,6 +7275,8 @@ static void test_pat(u32 field, const char * field_name, u32 ctrl_field,
> > error = 0;
> >
> > test_vmx_vmlaunch(error);
> > + wrmsr(MSR_IA32_CR_PAT, pat_msr_saved);
> > +
> > report_prefix_pop();
> >
> > } else { // GUEST_PAT
>
> Is it possible that ENT_LOAD_PAT of GUEST_PAT is tested when there's no support of
> EXI_LOAD_PAT of HOST_PAT?
> Then
> wrmsr(MSR_IA32_CR_PAT, pat_msr_saved);
> is also required in this case?
Heh, in theory, yeah, a nested setup could create such a monstrosity. It's easy
enough to handle, so I guess why not? Though I'm tempted to assert instead,
because practically speaking this code will never be hit, and thus never validated.
diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c
index 2063ee90..ffe7064c 100644
--- a/x86/vmx_tests.c
+++ b/x86/vmx_tests.c
@@ -7288,6 +7288,9 @@ static void test_pat(u32 field, const char * field_name, u32 ctrl_field,
error = (i == 0x2 || i == 0x3 || i >= 0x8);
test_guest_state("ENT_LOAD_PAT enabled", !!error,
val, "GUEST_PAT");
+
+ if (!(ctrl_exit_rev.clr & EXI_LOAD_PAT))
+ wrmsr(MSR_IA32_CR_PAT, pat_msr_saved);
}
}
next prev parent reply other threads:[~2024-06-11 1:47 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 [this message]
2024-06-11 2:03 ` Yan Zhao
2024-06-05 22:45 ` [PATCH 2/2] nVMX: Verify KVM actually loads the value in HOST_PAT into the PAT MSR Sean Christopherson
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=ZmesywdpFG3qDIkZ@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