Re: [PATCH 1/2] KVM: SVM: Reject SEV{-ES} intra host migration if vCPU creation is in-flight
From: Sean Christopherson
Date: Tue Jun 03 2025 - 15:00:31 EST
On Tue, Jun 03, 2025, James Houghton wrote:
> On Mon, Jun 2, 2025 at 3:45 PM Sean Christopherson <seanjc@xxxxxxxxxx> wrote:
> > ---
> > arch/x86/kvm/svm/sev.c | 4 ++++
> > 1 file changed, 4 insertions(+)
> >
> > diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c
> > index a7a7dc507336..93d899454535 100644
> > --- a/arch/x86/kvm/svm/sev.c
> > +++ b/arch/x86/kvm/svm/sev.c
> > @@ -2032,6 +2032,10 @@ static int sev_check_source_vcpus(struct kvm *dst, struct kvm *src)
> > struct kvm_vcpu *src_vcpu;
> > unsigned long i;
> >
> > + if (src->created_vcpus != atomic_read(&src->online_vcpus) ||
> > + dst->created_vcpus != atomic_read(&dst->online_vcpus))
> > + return -EINVAL;
>
> I think -EBUSY (or perhaps -EAGAIN) might be a more proper return code.
Yeah, I was 50/50 on EBUSY vs EINVAL. I think I went with EINVAL mostly out of
spite :-)
I'll change it to EBUSY.