public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Vitaly Kuznetsov <vkuznets@redhat.com>
To: Sean Christopherson <sean.j.christopherson@intel.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Wanpeng Li <wanpengli@tencent.com>,
	Jim Mattson <jmattson@google.com>, Joerg Roedel <joro@8bytes.org>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/3] KVM: VMX: Fold loaded_vmcs_init() into alloc_loaded_vmcs()
Date: Sun, 22 Mar 2020 14:08:13 +0100	[thread overview]
Message-ID: <87fte0bkqq.fsf@vitty.brq.redhat.com> (raw)
In-Reply-To: <20200321193751.24985-3-sean.j.christopherson@intel.com>

Sean Christopherson <sean.j.christopherson@intel.com> writes:

> Subsume loaded_vmcs_init() into alloc_loaded_vmcs(), its only remaining
> caller, and drop the VMCLEAR on the shadow VMCS, which is guaranteed to
> be NULL.  loaded_vmcs_init() was previously used by loaded_vmcs_clear(),
> but loaded_vmcs_clear() also subsumed loaded_vmcs_init() to properly
> handle smp_wmb() with respect to VMCLEAR.
>
> Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
> ---
>  arch/x86/kvm/vmx/vmx.c | 14 ++++----------
>  arch/x86/kvm/vmx/vmx.h |  1 -
>  2 files changed, 4 insertions(+), 11 deletions(-)
>
> diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
> index efaca09455bf..07634caa560d 100644
> --- a/arch/x86/kvm/vmx/vmx.c
> +++ b/arch/x86/kvm/vmx/vmx.c
> @@ -653,15 +653,6 @@ static int vmx_set_guest_msr(struct vcpu_vmx *vmx, struct shared_msr_entry *msr,
>  	return ret;
>  }
>  
> -void loaded_vmcs_init(struct loaded_vmcs *loaded_vmcs)
> -{
> -	vmcs_clear(loaded_vmcs->vmcs);
> -	if (loaded_vmcs->shadow_vmcs && loaded_vmcs->launched)
> -		vmcs_clear(loaded_vmcs->shadow_vmcs);
> -	loaded_vmcs->cpu = -1;
> -	loaded_vmcs->launched = 0;
> -}
> -
>  #ifdef CONFIG_KEXEC_CORE
>  static void crash_vmclear_local_loaded_vmcss(void)
>  {
> @@ -2555,9 +2546,12 @@ int alloc_loaded_vmcs(struct loaded_vmcs *loaded_vmcs)
>  	if (!loaded_vmcs->vmcs)
>  		return -ENOMEM;
>  
> +	vmcs_clear(loaded_vmcs->vmcs);
> +
>  	loaded_vmcs->shadow_vmcs = NULL;
>  	loaded_vmcs->hv_timer_soft_disabled = false;
> -	loaded_vmcs_init(loaded_vmcs);
> +	loaded_vmcs->cpu = -1;
> +	loaded_vmcs->launched = 0;
>  
>  	if (cpu_has_vmx_msr_bitmap()) {
>  		loaded_vmcs->msr_bitmap = (unsigned long *)
> diff --git a/arch/x86/kvm/vmx/vmx.h b/arch/x86/kvm/vmx/vmx.h
> index be93d597306c..79d38f41ef7a 100644
> --- a/arch/x86/kvm/vmx/vmx.h
> +++ b/arch/x86/kvm/vmx/vmx.h
> @@ -492,7 +492,6 @@ struct vmcs *alloc_vmcs_cpu(bool shadow, int cpu, gfp_t flags);
>  void free_vmcs(struct vmcs *vmcs);
>  int alloc_loaded_vmcs(struct loaded_vmcs *loaded_vmcs);
>  void free_loaded_vmcs(struct loaded_vmcs *loaded_vmcs);
> -void loaded_vmcs_init(struct loaded_vmcs *loaded_vmcs);
>  void loaded_vmcs_clear(struct loaded_vmcs *loaded_vmcs);
>  
>  static inline struct vmcs *alloc_vmcs(bool shadow)

Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>

-- 
Vitaly


  reply	other threads:[~2020-03-22 13:08 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-21 19:37 [PATCH v2 0/3] KVM: VMX: Fix for kexec VMCLEAR and VMXON cleanup Sean Christopherson
2020-03-21 19:37 ` [PATCH v2 1/3] KVM: VMX: Always VMCLEAR in-use VMCSes during crash with kexec support Sean Christopherson
2020-03-21 19:37 ` [PATCH v2 2/3] KVM: VMX: Fold loaded_vmcs_init() into alloc_loaded_vmcs() Sean Christopherson
2020-03-22 13:08   ` Vitaly Kuznetsov [this message]
2020-03-21 19:37 ` [PATCH v2 3/3] KVM: VMX: Gracefully handle faults on VMXON Sean Christopherson
2020-03-22 13:37   ` Vitaly Kuznetsov
2020-04-07 11:01 ` [PATCH v2 0/3] KVM: VMX: Fix for kexec VMCLEAR and VMXON cleanup Baoquan He
2020-04-07 12:04   ` Vitaly Kuznetsov
2020-04-08 15:18     ` Baoquan He
2020-04-08 19:44       ` Vitaly Kuznetsov
2020-04-09  1:20         ` Baoquan He
2020-04-09 11:14           ` Vitaly Kuznetsov
2020-04-09 12:57             ` Baoquan He

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=87fte0bkqq.fsf@vitty.brq.redhat.com \
    --to=vkuznets@redhat.com \
    --cc=jmattson@google.com \
    --cc=joro@8bytes.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=sean.j.christopherson@intel.com \
    --cc=wanpengli@tencent.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