mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Wanpeng Li <kernellwp@gmail.com>,
	linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Cc: "Radim Krčmář" <rkrcmar@redhat.com>,
	"Wanpeng Li" <wanpeng.li@hotmail.com>,
	"Jim Mattson" <jmattson@google.com>
Subject: Re: [PATCH v2 2/2] KVM: VMX: Don't expose unrestricted_guest is enabled if ept is disabled
Date: Tue, 10 Oct 2017 10:36:48 +0200	[thread overview]
Message-ID: <fd90358b-3919-ad1b-6872-48b719100fd2@redhat.com> (raw)
In-Reply-To: <1507546852-6153-2-git-send-email-wanpeng.li@hotmail.com>

On 09/10/2017 13:00, Wanpeng Li wrote:
> From: Wanpeng Li <wanpeng.li@hotmail.com>
> 
> SDM mentioned: 
> 
>  "If either the “unrestricted guest” VM-execution control or the “mode-based 
>   execute control for EPT” VM- execution control is 1, the “enable EPT” 
>   VM-execution control must also be 1."
> 
> However, we can still observe unrestricted_guest is Y after inserting the kvm-intel.ko 
> w/ ept=N. It depends on later starts a guest in order that the function 
> vmx_compute_secondary_exec_control() can be executed, then both the module parameter 
> and exec control fields will be amended.
> 
> This patch fixes it by amending module parameter immediately during vmcs data setup.
> 
> Reviewed-by: Jim Mattson <jmattson@google.com>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: Radim Krčmář <rkrcmar@redhat.com>
> Cc: Jim Mattson <jmattson@google.com>
> Signed-off-by: Wanpeng Li <wanpeng.li@hotmail.com>
> ---
> v1 -> v2: 
>  * reduce to just "enable_ept = 0"
> 
>  arch/x86/kvm/vmx.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index ab0f16e..dedff59 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -6730,16 +6730,13 @@ static __init int hardware_setup(void)
>  	if (!cpu_has_vmx_ept() ||
>  	    !cpu_has_vmx_ept_4levels() ||
>  	    !cpu_has_vmx_ept_mt_wb() ||
> -	    !cpu_has_vmx_invept_global()) {
> +	    !cpu_has_vmx_invept_global())
>  		enable_ept = 0;
> -		enable_unrestricted_guest = 0;
> -		enable_ept_ad_bits = 0;
> -	}
>  
>  	if (!cpu_has_vmx_ept_ad_bits() || !enable_ept)
>  		enable_ept_ad_bits = 0;
>  
> -	if (!cpu_has_vmx_unrestricted_guest())
> +	if (!cpu_has_vmx_unrestricted_guest() || !enable_ept)
>  		enable_unrestricted_guest = 0;
>  
>  	if (!cpu_has_vmx_flexpriority())
> 

Queued both, thanks.

Paolo

      parent reply	other threads:[~2017-10-10  8:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-09 11:00 [PATCH v2 1/2] KVM: X86: Processor States following Reset or INIT Wanpeng Li
2017-10-09 11:00 ` [PATCH v2 2/2] KVM: VMX: Don't expose unrestricted_guest is enabled if ept is disabled Wanpeng Li
2017-10-09 17:00   ` Jim Mattson
2017-10-10  8:36   ` Paolo Bonzini [this message]

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=fd90358b-3919-ad1b-6872-48b719100fd2@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=jmattson@google.com \
    --cc=kernellwp@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rkrcmar@redhat.com \
    --cc=wanpeng.li@hotmail.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®