kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oliver Upton <oupton@google.com>
To: Sean Christopherson <sean.j.christopherson@intel.com>
Cc: kvm@vger.kernel.org, "Paolo Bonzini" <pbonzini@redhat.com>,
	"Radim Krčmář" <rkrcmar@redhat.com>,
	"Jim Mattson" <jmattson@google.com>,
	"Peter Shier" <pshier@google.com>
Subject: Re: [PATCH 4/7] KVM: nVMX: check GUEST_IA32_PERF_GLOBAL_CTRL on VM-Entry
Date: Fri, 30 Aug 2019 13:12:39 -0700	[thread overview]
Message-ID: <20190830201239.GC257167@google.com> (raw)
In-Reply-To: <20190830183703.GG15405@linux.intel.com>

On Fri, Aug 30, 2019 at 11:37:03AM -0700, Sean Christopherson wrote:
> On Wed, Aug 28, 2019 at 04:41:31PM -0700, Oliver Upton wrote:
> > According to the SDM 26.3.1.1, "If the "load IA32_PERF_GLOBAL_CTRL" VM-entry
> > control is 1, bits reserved in the IA32_PERF_GLOBAL_CTRL MSR must be 0 in the
> > field for that register".
> > 
> > Adding condition to nested_vmx_check_guest_state() to check the validity of
> > GUEST_IA32_PERF_GLOBAL_CTRL if the "load IA32_PERF_GLOBAL_CTRL" bit is
> > set on the VM-entry control.
> 
> Same comment on mood.  And for this case, it's probably overkill to
> give a play-by-play of the code, just state that you're adding a check
> as described in the SDM, e.g.:
> 
> Add a nested VM-Enter consistency check when loading the guest's
> IA32_PERF_GLOBAL_CTRL MSR from vmcs12.  Per Intel's SDM:
> 
>   If the "load IA32_PERF_GLOBAL_CTRL" VM-entry control is 1, bits
>   reserved in the IA32_PERF_GLOBAL_CTRL MSR must be 0 in the field for
>   that register.

Ack. This is a style problem throughout, I will make sure to address in
the next set I send out. Thanks for the suggested text as well, reads a
lot better than what I had before!
> > 
> > Suggested-by: Jim Mattson <jmattson@google.com>
> > Signed-off-by: Oliver Upton <oupton@google.com>
> > ---
> >  arch/x86/kvm/vmx/nested.c | 6 ++++++
> >  1 file changed, 6 insertions(+)
> > 
> > diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
> > index 9ba90b38d74b..8d6f0144b1bd 100644
> > --- a/arch/x86/kvm/vmx/nested.c
> > +++ b/arch/x86/kvm/vmx/nested.c
> > @@ -10,6 +10,7 @@
> >  #include "hyperv.h"
> >  #include "mmu.h"
> >  #include "nested.h"
> > +#include "pmu.h"
> >  #include "trace.h"
> >  #include "x86.h"
> >  
> > @@ -2748,6 +2749,11 @@ static int nested_vmx_check_guest_state(struct kvm_vcpu *vcpu,
> >  		return -EINVAL;
> >  	}
> >  
> > +	if (vmcs12->vm_entry_controls & VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL &&
> > +	    !kvm_is_valid_perf_global_ctrl(vcpu,
> > +					   vmcs12->guest_ia32_perf_global_ctrl))
> > +		return -EINVAL;
> > +
> >  	/*
> >  	 * If the load IA32_EFER VM-entry control is 1, the following checks
> >  	 * are performed on the field for the IA32_EFER MSR:
> > -- 
> > 2.23.0.187.g17f5b7556c-goog
> > 

  reply	other threads:[~2019-08-30 20:12 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-28 23:41 [PATCH 0/7] KVM: VMX: Add full nested support for IA32_PERF_GLOBAL_CTRL Oliver Upton
2019-08-28 23:41 ` [PATCH 1/7] KVM: nVMX: Use kvm_set_msr to load IA32_PERF_GLOBAL_CTRL on vmexit Oliver Upton
2019-08-29  1:30   ` Krish Sadhukhan
2019-08-29  2:02     ` Oliver Upton
2019-08-29  7:19       ` Krish Sadhukhan
2019-08-29  8:07         ` Oliver Upton
2019-08-29 16:47           ` Krish Sadhukhan
2019-08-29 17:02   ` Jim Mattson
2019-08-28 23:41 ` [PATCH 2/7] KVM: nVMX: Load GUEST_IA32_PERF_GLOBAL_CTRL MSR on vmentry Oliver Upton
2019-08-30 17:58   ` Sean Christopherson
2019-08-28 23:41 ` [PATCH 3/7] KVM: VMX: Add helper to check reserved bits in MSR_CORE_PERF_GLOBAL_CTRL Oliver Upton
2019-08-30 18:26   ` Sean Christopherson
2019-08-30 19:20     ` Jim Mattson
2019-08-30 19:50       ` Oliver Upton
2019-08-28 23:41 ` [PATCH 4/7] KVM: nVMX: check GUEST_IA32_PERF_GLOBAL_CTRL on VM-Entry Oliver Upton
2019-08-30 18:37   ` Sean Christopherson
2019-08-30 20:12     ` Oliver Upton [this message]
2019-08-28 23:41 ` [PATCH 5/7] KVM: nVMX: Check HOST_IA32_PERF_GLOBAL_CTRL on VM-entry Oliver Upton
2019-08-28 23:41 ` [PATCH 6/7] KVM: nVMX: Enable load IA32_PERF_GLOBAL_CTRL vm control if supported Oliver Upton
2019-08-29 17:28   ` Jim Mattson
2019-08-28 23:41 ` [kvm-unit-tests PATCH 7/7] x86: VMX: Add tests for nested "load IA32_PERF_GLOBAL_CTRL" Oliver Upton
2019-08-29 17:33   ` Jim Mattson
2019-08-29 19:58     ` Oliver Upton

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=20190830201239.GC257167@google.com \
    --to=oupton@google.com \
    --cc=jmattson@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=pshier@google.com \
    --cc=rkrcmar@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;
as well as URLs for NNTP newsgroup(s).