[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191219202835.06fc6f2f.cohuck@redhat.com>
Date: Thu, 19 Dec 2019 20:28:35 +0100
From: Cornelia Huck <cohuck@...hat.com>
To: Sean Christopherson <sean.j.christopherson@...el.com>
Cc: Marc Zyngier <maz@...nel.org>, James Hogan <jhogan@...nel.org>,
Paul Mackerras <paulus@...abs.org>,
Christian Borntraeger <borntraeger@...ibm.com>,
Janosch Frank <frankja@...ux.ibm.com>,
Paolo Bonzini <pbonzini@...hat.com>,
James Morse <james.morse@....com>,
Julien Thierry <julien.thierry.kdev@...il.com>,
Suzuki K Poulose <suzuki.poulose@....com>,
David Hildenbrand <david@...hat.com>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
Wanpeng Li <wanpengli@...cent.com>,
Jim Mattson <jmattson@...gle.com>,
Joerg Roedel <joro@...tes.org>,
linux-arm-kernel@...ts.infradead.org, kvmarm@...ts.cs.columbia.edu,
linux-mips@...r.kernel.org, kvm-ppc@...r.kernel.org,
kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
Greg Kurz <groug@...d.org>
Subject: Re: [PATCH v2 24/45] KVM: Add kvm_arch_vcpu_precreate() to handle
pre-allocation issues
On Wed, 18 Dec 2019 13:55:09 -0800
Sean Christopherson <sean.j.christopherson@...el.com> wrote:
> Add a pre-allocation arch hook to handle checks that are currently done
> by arch specific code prior to allocating the vCPU object. This paves
> the way for moving the allocation to common KVM code.
>
> Acked-by: Christoffer Dall <christoffer.dall@....com>
> Signed-off-by: Sean Christopherson <sean.j.christopherson@...el.com>
> ---
> arch/mips/kvm/mips.c | 5 +++++
> arch/powerpc/kvm/powerpc.c | 5 +++++
> arch/s390/kvm/kvm-s390.c | 12 ++++++++----
> arch/x86/kvm/x86.c | 14 +++++++++-----
> include/linux/kvm_host.h | 1 +
> virt/kvm/arm/arm.c | 21 +++++++++++----------
> virt/kvm/kvm_main.c | 4 ++++
> 7 files changed, 43 insertions(+), 19 deletions(-)
>
(...)
> diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
> index d9e6bf3d54f0..57c6838dff37 100644
> --- a/arch/s390/kvm/kvm-s390.c
> +++ b/arch/s390/kvm/kvm-s390.c
> @@ -3035,15 +3035,19 @@ int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu)
> return rc;
> }
>
> +int kvm_arch_vcpu_precreate(struct kvm *kvm, unsigned int id)
> +{
> + if (!kvm_is_ucontrol(kvm) && !sca_can_add_vcpu(kvm, id))
> + return -EINVAL;
> + return 0;
> +}
> +
> struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm,
> unsigned int id)
> {
> struct kvm_vcpu *vcpu;
> struct sie_page *sie_page;
> - int rc = -EINVAL;
> -
> - if (!kvm_is_ucontrol(kvm) && !sca_can_add_vcpu(kvm, id))
> - goto out;
> + int rc;
You might want to make this
int rc = -ENOMEM;
instead.
>
> rc = -ENOMEM;
>
(...)
Regardless,
Reviewed-by: Cornelia Huck <cohuck@...hat.com>
Powered by blists - more mailing lists