Re: [PATCH 1/3 V7] KVM, SEV: Add support for SEV intra host migration
From: Marc Orr
Date: Thu Sep 09 2021 - 21:22:20 EST
> > + dst->asid = src->asid;
> > + dst->misc_cg = src->misc_cg;
> > + dst->handle = src->handle;
> > + dst->pages_locked = src->pages_locked;
> > +
> > + src->asid = 0;
> > + src->active = false;
> > + src->handle = 0;
> > + src->pages_locked = 0;
> > + src->misc_cg = NULL;
> > +
> > + INIT_LIST_HEAD(&dst->regions_list);
> > + list_replace_init(&src->regions_list, &dst->regions_list);
> > +}
> > +
> > +int svm_vm_migrate_from(struct kvm *kvm, unsigned int source_fd)
> > +{
> > + struct kvm_sev_info *dst_sev = &to_kvm_svm(kvm)->sev_info;
> > + struct file *source_kvm_file;
> > + struct kvm *source_kvm;
> > + int ret;
> > +
> > + ret = svm_sev_lock_for_migration(kvm);
> > + if (ret)
> > + return ret;
> > +
> > + if (!sev_guest(kvm) || sev_es_guest(kvm)) {
> > + ret = -EINVAL;
> > + pr_warn_ratelimited("VM must be SEV enabled to migrate to.\n");
>
> Linux generally doesn't log user errors to dmesg. They can be helpful during
> development, but aren't actionable and thus are of limited use in production.
Ha. I had suggested adding the logs when I reviewed these patches
(maybe before Peter posted them publicly). My rationale is that if I'm
looking at a crash in production, and all I have is a stack trace and
the error code, then I can narrow the failure down to this function,
but once the function starts returning the same error code in multiple
places now it's non-trivial for me to deduce exactly which condition
caused the crash. Having these logs makes it trivial. However, if this
is not the preferred Linux style then so be it.