lkml.org 
[lkml]   [2017]   [Oct]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v2 1/2] KVM: VMX: Don't advertise EPT switching if EPT itself is not exposed
Following the same line of reasoning, what if
vmx->nested.nested_vmx_secondary_ctls_high is 0 after clearing
SECONDARY_EXEC_ENABLE_VMFUNC? Does it make sense to report
CPU_BASED_ACTIVATE_SECONDARY_CONTROLS if we don't actually support any
of the secondary controls?

Reviewed-by: Jim Mattson <jmattson@google.com>

On Mon, Oct 16, 2017 at 9:03 PM, Wanpeng Li <kernellwp@gmail.com> wrote:
> From: Wanpeng Li <wanpeng.li@hotmail.com>
>
> I can use vmxcap tool to observe "EPTP Switching yes" even if EPT is not
> exposed to L1.
>
> EPT switching is advertised unconditionally since it is emulated, however,
> it can be treated as an extended feature for EPT and it should not be
> advertised if EPT itself is not exposed. This patch fixes it.
>
> 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:
> * don't advertise "EPT VM Functions" in secondary processor-based VM-execution
> controls if we don't actually support any VM Functions.
>
> arch/x86/kvm/vmx.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index c460b0b..a6861ca 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -2842,8 +2842,12 @@ static void nested_vmx_setup_ctls_msrs(struct vcpu_vmx *vmx)
> * Advertise EPTP switching unconditionally
> * since we emulate it
> */
> - vmx->nested.nested_vmx_vmfunc_controls =
> - VMX_VMFUNC_EPTP_SWITCHING;
> + if (enable_ept) {
> + vmx->nested.nested_vmx_vmfunc_controls =
> + VMX_VMFUNC_EPTP_SWITCHING;
> + } else
> + vmx->nested.nested_vmx_secondary_ctls_high &=
> + ~SECONDARY_EXEC_ENABLE_VMFUNC;
> }
>
> /*
> --
> 2.7.4
>

\
 
 \ /
  Last update: 2017-10-17 19:30    [W:0.045 / U:25.420 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site