From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:46766 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728179AbgBULrx (ORCPT ); Fri, 21 Feb 2020 06:47:53 -0500 Subject: Re: [PATCH v3 09/37] KVM: s390: protvirt: Add initial vm and cpu lifecycle handling References: <20200220104020.5343-1-borntraeger@de.ibm.com> <20200220104020.5343-10-borntraeger@de.ibm.com> <1f0c2c5a-5964-dc34-73af-7b1776391276@redhat.com> <947e04fa-d5d3-f352-3b58-766dd463bfd9@de.ibm.com> From: David Hildenbrand Message-ID: <712d6bb8-81d8-31d1-662b-7de270d204b5@redhat.com> Date: Fri, 21 Feb 2020 12:47:42 +0100 MIME-Version: 1.0 In-Reply-To: <947e04fa-d5d3-f352-3b58-766dd463bfd9@de.ibm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-s390-owner@vger.kernel.org List-ID: To: Christian Borntraeger , Janosch Frank Cc: KVM , Cornelia Huck , Thomas Huth , Ulrich Weigand , Claudio Imbrenda , linux-s390 , Michael Mueller , Vasily Gorbik , Janosch Frank See my other mail, maybe we can merge alloc+create and handle most of that conditional freeing in there. > diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c > index 738f7fefcaec..cad04e26dccf 100644 > --- a/arch/s390/kvm/kvm-s390.c > +++ b/arch/s390/kvm/kvm-s390.c > @@ -2173,6 +2173,11 @@ static void kvm_s390_cpus_from_pv(struct kvm *kvm, u16 *rc, u16 *rrc) > struct kvm_vcpu *vcpu; > int i; > > + /* > + * we ignore failures and try to destroy as many CPUs as possible. > + * At the same time we must not free the assigned ressources when > + * this fails, as the ultravisor has still access to that memory. > + */ Makes sense. > kvm_for_each_vcpu(i, vcpu, kvm) { > mutex_lock(&vcpu->mutex); > kvm_s390_pv_destroy_cpu(vcpu, rc, rrc); > @@ -2221,6 +2226,7 @@ static int kvm_s390_handle_pv(struct kvm *kvm, struct kvm_pv_cmd *cmd) > kvm_s390_pv_dealloc_vm(kvm); > break; > } > + /* we never switch back to bsca from esca */ > r = kvm_s390_pv_create_vm(kvm, &cmd->rc, &cmd->rrc); Helpful. -- Thanks, David / dhildenb