lkml.org 
[lkml]   [2021]   [Sep]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/4 V8] KVM: SEV: Add support for SEV intra host migration
On Tue, Sep 14, 2021 at 09:47:24AM -0700, Peter Gonda wrote:
> +static int sev_lock_vcpus_for_migration(struct kvm *kvm)
> +{
> + struct kvm_vcpu *vcpu;
> + int i, j;
> +
> + kvm_for_each_vcpu(i, vcpu, kvm) {
> + if (mutex_lock_killable(&vcpu->mutex))
> + goto out_unlock;
> + }
> +
> + return 0;
> +
> +out_unlock:
> + kvm_for_each_vcpu(j, vcpu, kvm) {
> + mutex_unlock(&vcpu->mutex);
> + if (i == j)
> + break;

Hmm, doesn't the mutex_unlock() need to happen after the check?

\
 
 \ /
  Last update: 2021-09-28 14:43    [W:0.149 / U:0.200 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site