All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <sean.j.christopherson@intel.com>
To: Krish Sadhukhan <krish.sadhukhan@oracle.com>
Cc: kvm@vger.kernel.org, pbonzini@redhat.com, rkrcmar@redhat.com
Subject: Re: [PATCH] nVMX: Get rid of prepare_vmcs02_early_full and inline its content in the caller
Date: Fri, 7 Jun 2019 11:52:24 -0700	[thread overview]
Message-ID: <20190607185224.GI9083@linux.intel.com> (raw)
In-Reply-To: <20190607180544.17241-1-krish.sadhukhan@oracle.com>

On Fri, Jun 07, 2019 at 02:05:44PM -0400, Krish Sadhukhan wrote:
>  ..as there is no need for a separate function
> 
> Signed-off-by: Krish Sadhukhan <krish.sadhukhan@oracle.com>
> Reviewed-by: Karl Heubaum <karl.heubaum@oracle.com>
> ---
>  arch/x86/kvm/vmx/nested.c | 30 +++++++++++++-----------------
>  1 file changed, 13 insertions(+), 17 deletions(-)
> 
> diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
> index f1a69117ac0f..4643eb3a97f7 100644
> --- a/arch/x86/kvm/vmx/nested.c
> +++ b/arch/x86/kvm/vmx/nested.c
> @@ -1963,28 +1963,24 @@ static void prepare_vmcs02_constant_state(struct vcpu_vmx *vmx)
>  	vmx_set_constant_host_state(vmx);
>  }
>  
> -static void prepare_vmcs02_early_full(struct vcpu_vmx *vmx,
> -				      struct vmcs12 *vmcs12)
> -{
> -	prepare_vmcs02_constant_state(vmx);
> -
> -	vmcs_write64(VMCS_LINK_POINTER, -1ull);
> -
> -	if (enable_vpid) {
> -		if (nested_cpu_has_vpid(vmcs12) && vmx->nested.vpid02)
> -			vmcs_write16(VIRTUAL_PROCESSOR_ID, vmx->nested.vpid02);
> -		else
> -			vmcs_write16(VIRTUAL_PROCESSOR_ID, vmx->vpid);
> -	}
> -}
> -
>  static void prepare_vmcs02_early(struct vcpu_vmx *vmx, struct vmcs12 *vmcs12)
>  {
>  	u32 exec_control, vmcs12_exec_ctrl;
>  	u64 guest_efer = nested_vmx_calc_efer(vmx, vmcs12);
>  
> -	if (vmx->nested.dirty_vmcs12 || vmx->nested.hv_evmcs)
> -		prepare_vmcs02_early_full(vmx, vmcs12);
> +	if (vmx->nested.dirty_vmcs12 || vmx->nested.hv_evmcs) {
> +		prepare_vmcs02_constant_state(vmx);
> +
> +		vmcs_write64(VMCS_LINK_POINTER, -1ull);
> +
> +		if (enable_vpid) {
> +			if (nested_cpu_has_vpid(vmcs12) && vmx->nested.vpid02)
> +				vmcs_write16(VIRTUAL_PROCESSOR_ID,
> +					     vmx->nested.vpid02);
> +			else
> +				vmcs_write16(VIRTUAL_PROCESSOR_ID, vmx->vpid);
> +		}
> +	}

My vote is to keep the separate helper.  I agree that it's a bit
superfluous, but I really like having symmetry across the "early" and
"late" prepartion flows, i.e. there's value in having both
prepare_vmcs02_full() and prepare_vmcs02_early_full().

>  
>  	/*
>  	 * PIN CONTROLS
> -- 
> 2.20.1
> 

  reply	other threads:[~2019-06-07 18:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-07 18:05 [PATCH] nVMX: Get rid of prepare_vmcs02_early_full and inline its content in the caller Krish Sadhukhan
2019-06-07 18:52 ` Sean Christopherson [this message]
2019-06-09  9:38   ` Paolo Bonzini

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=20190607185224.GI9083@linux.intel.com \
    --to=sean.j.christopherson@intel.com \
    --cc=krish.sadhukhan@oracle.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.