public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: "David Hildenbrand" <david@redhat.com>,
	kvm@vger.kernel.org, "Radim Krčmář" <rkrcmar@redhat.com>,
	"Bandan Das" <bsd@redhat.com>
Subject: Re: [PATCH v1 2/2] KVM: VMX: always require WB memory type for EPT
Date: Thu, 10 Aug 2017 14:30:56 -0400	[thread overview]
Message-ID: <20170810183056.GY2547@char.us.oracle.com> (raw)
In-Reply-To: <4e7e54e0-87fe-26ea-c90b-1472aa973398@redhat.com>

On Thu, Aug 10, 2017 at 04:42:02PM +0200, Paolo Bonzini wrote:
> On 10/08/2017 15:35, David Hildenbrand wrote:
> > We already always set that type but don't check if it is supported. Also
> > for nVMX, we only support WB for now. Let's just require it.
> > 
> > Signed-off-by: David Hildenbrand <david@redhat.com>
> 
> It may only happen on a broken nested hypervisor, so the patch is okay.

Is there one in the wild?
> 
> Paolo
> 
> > ---
> >  arch/x86/kvm/vmx.c | 9 +++++++--
> >  1 file changed, 7 insertions(+), 2 deletions(-)
> > 
> > diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> > index f6638ed..023c6dc 100644
> > --- a/arch/x86/kvm/vmx.c
> > +++ b/arch/x86/kvm/vmx.c
> > @@ -1200,6 +1200,11 @@ static inline bool cpu_has_vmx_ept_4levels(void)
> >  	return vmx_capability.ept & VMX_EPT_PAGE_WALK_4_BIT;
> >  }
> >  
> > +static inline bool cpu_has_vmx_ept_mt_wb(void)
> > +{
> > +	return vmx_capability.ept & VMX_EPTP_WB_BIT;
> > +}
> > +
> >  static inline bool cpu_has_vmx_ept_ad_bits(void)
> >  {
> >  	return vmx_capability.ept & VMX_EPT_AD_BIT;
> > @@ -4302,7 +4307,6 @@ static u64 construct_eptp(struct kvm_vcpu *vcpu, unsigned long root_hpa)
> >  {
> >  	u64 eptp = VMX_EPTP_MT_WB | VMX_EPTP_PWL_4;
> >  
> > -	/* TODO write the value reading from MSR */
> >  	if (enable_ept_ad_bits &&
> >  	    (!is_guest_mode(vcpu) || nested_ept_ad_enabled(vcpu)))
> >  		eptp |= VMX_EPTP_AD_ENABLE_BIT;
> > @@ -6638,7 +6642,8 @@ static __init int hardware_setup(void)
> >  		init_vmcs_shadow_fields();
> >  
> >  	if (!cpu_has_vmx_ept() ||
> > -	    !cpu_has_vmx_ept_4levels()) {
> > +	    !cpu_has_vmx_ept_4levels() ||
> > +	    !cpu_has_vmx_ept_mt_wb()) {
> >  		enable_ept = 0;
> >  		enable_unrestricted_guest = 0;
> >  		enable_ept_ad_bits = 0;
> > 
> 

  reply	other threads:[~2017-08-10 18:31 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-10 13:35 [PATCH v1 0/2] KVM: VMX: require EPTP WB (write-back) support David Hildenbrand
2017-08-10 13:35 ` [PATCH v1 1/2] KVM: VMX: cleanup EPTP definitions David Hildenbrand
2017-08-10 19:38   ` Bandan Das
2017-08-10 19:53     ` David Hildenbrand
2017-08-10 20:58   ` David Hildenbrand
2017-08-10 13:35 ` [PATCH v1 2/2] KVM: VMX: always require WB memory type for EPT David Hildenbrand
2017-08-10 14:42   ` Paolo Bonzini
2017-08-10 18:30     ` Konrad Rzeszutek Wilk [this message]
2017-08-10 20:09       ` David Hildenbrand
2017-08-10 19:40   ` Bandan Das
2017-08-10 19:54     ` David Hildenbrand
2017-08-10 14:23 ` [PATCH v1 0/2] KVM: VMX: require EPTP WB (write-back) support Radim Krčmář
2017-08-10 14:25   ` David Hildenbrand
2017-08-10 16:34     ` Radim Krčmář

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=20170810183056.GY2547@char.us.oracle.com \
    --to=konrad.wilk@oracle.com \
    --cc=bsd@redhat.com \
    --cc=david@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=rkrcmar@redhat.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