On Fri, Sep 10, 2021, Sean Christopherson wrote: > Ooh, this brings up a potential shortcoming of requiring @dst to be SEV-enabled. > If every SEV{-ES} ASID is allocated, then there won't be an available ASID to > (temporarily) allocate for the intra-host migration. But that temporary ASID > isn't actually necessary, i.e. there's no reason intra-host migration should fail > if all ASIDs are in-use. ... > So I think the only option is to take vcpu->mutex for all vCPUs in both @src and > @dst. Adding that after acquiring kvm->lock in svm_sev_lock_for_migration() > should Just Work. Unless userspace is misbehaving, the lock won't be contended > since all vCPUs need to be quiesced, though it's probably worth using the > mutex_lock_killable() variant just to be safe. Circling back to this after looking at the SEV-ES support, I think the vCPUs in the source VM need to be reset via kvm_vcpu_reset(vcpu, false). I doubt there's a use case for actually doing anything with the vCPU, but leaving it runnable without purging state makes me nervous. Alternative #1 would be to mark vCPUs as dead in some way so as to prevent doing anything useful with the vCPU. Alternative #2 would be to "kill" the source VM by setting kvm->vm_bugged to prevent all ioctls(). The downside to preventing future ioctls() is that this would need to be the very last step of migration. Not sure if that's problematic?