[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200303165203.GM1439@linux.intel.com>
Date: Tue, 3 Mar 2020 08:52:04 -0800
From: Sean Christopherson <sean.j.christopherson@...el.com>
To: Vitaly Kuznetsov <vkuznets@...hat.com>
Cc: Paolo Bonzini <pbonzini@...hat.com>,
Wanpeng Li <wanpengli@...cent.com>,
Jim Mattson <jmattson@...gle.com>,
Joerg Roedel <joro@...tes.org>, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 08/13] KVM: x86: Dynamically allocate per-vCPU
emulation context
On Wed, Feb 26, 2020 at 06:29:56PM +0100, Vitaly Kuznetsov wrote:
> Sean Christopherson <sean.j.christopherson@...el.com> writes:
> > @@ -9409,6 +9451,9 @@ void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu)
> >
> > kvm_x86_ops->vcpu_free(vcpu);
> >
> > + if (vcpu->arch.emulate_ctxt)
> > + kmem_cache_free(x86_emulator_cache, vcpu->arch.emulate_ctxt);
>
> Checking for NULL here seems superfluous as we create the context in
> kvm_arch_vcpu_create() unconditionally. I'd suggest we move the check to
> "[PATCH v2 12/13] KVM: x86: Add variable to control existence of
> emulator" where 'enable_emulator' global is added.
Ya, checking here is premature.
> > +
> > free_cpumask_var(vcpu->arch.wbinvd_dirty_mask);
> > kmem_cache_free(x86_fpu_cache, vcpu->arch.user_fpu);
> > kmem_cache_free(x86_fpu_cache, vcpu->arch.guest_fpu);
>
> --
> Vitaly
>
Powered by blists - more mailing lists