OSDN Git Service

KVM: SEV: Mark nested locking of vcpu->lock
authorPeter Gonda <pgonda@google.com>
Mon, 2 May 2022 16:58:07 +0000 (09:58 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 6 May 2022 17:08:04 +0000 (13:08 -0400)
commit0c2c7c069285374fc8feacddc0498f8ab7627117
treec6ec000f4bca25b5db8ce92b2d9d97cc2fba0c96
parent04144108a1ab9792e7a60b3a9e30c614cd3e0e9f
KVM: SEV: Mark nested locking of vcpu->lock

svm_vm_migrate_from() uses sev_lock_vcpus_for_migration() to lock all
source and target vcpu->locks. Unfortunately there is an 8 subclass
limit, so a new subclass cannot be used for each vCPU. Instead maintain
ownership of the first vcpu's mutex.dep_map using a role specific
subclass: source vs target. Release the other vcpu's mutex.dep_maps.

Fixes: b56639318bb2b ("KVM: SEV: Add support for SEV intra host migration")
Reported-by: John Sperbeck<jsperbeck@google.com>
Suggested-by: David Rientjes <rientjes@google.com>
Suggested-by: Sean Christopherson <seanjc@google.com>
Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Cc: Hillf Danton <hdanton@sina.com>
Cc: kvm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Peter Gonda <pgonda@google.com>
Message-Id: <20220502165807.529624-1-pgonda@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/svm/sev.c