Re: [PATCH v3 09/37] KVM: s390: protvirt: Add initial vm and cpu lifecycle handling

David Hildenbrand
2020-02-21T11:47:53Z

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