All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Gonda <pgonda@google.com>
To: Joerg Roedel <joro@8bytes.org>
Cc: kvm list <kvm@vger.kernel.org>,
	Sean Christopherson <seanjc@google.com>,
	Marc Orr <marcorr@google.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	David Rientjes <rientjes@google.com>,
	"Dr . David Alan Gilbert" <dgilbert@redhat.com>,
	Brijesh Singh <brijesh.singh@amd.com>,
	Vitaly Kuznetsov <vkuznets@redhat.com>,
	Wanpeng Li <wanpengli@tencent.com>,
	Jim Mattson <jmattson@google.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/4 V8] KVM: SEV: Add support for SEV intra host migration
Date: Tue, 28 Sep 2021 09:30:08 -0600	[thread overview]
Message-ID: <CAMkAt6q5YbZpnDeFXeQsZcK6WtxdAuMoWqqUwURZ9KLz692MEQ@mail.gmail.com> (raw)
In-Reply-To: <YVMNq4wwjYZ8F7N8@8bytes.org>

On Tue, Sep 28, 2021 at 6:42 AM Joerg Roedel <joro@8bytes.org> wrote:
>
> 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?
>

Ah good catch, thanks for the review Joerg! Yes you are right this
results in calling mutex_unlock on a mutex we didn't successfully
lock. I'll fix it in the next version.

  reply	other threads:[~2021-09-28 15:30 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-14 16:47 [PATCH 0/4 V8] Add AMD SEV and SEV-ES intra host migration support Peter Gonda
2021-09-14 16:47 ` [PATCH 1/4 V8] KVM: SEV: Add support for SEV intra host migration Peter Gonda
2021-09-28 12:42   ` Joerg Roedel
2021-09-28 15:30     ` Peter Gonda [this message]
2021-09-14 16:47 ` [PATCH 2/4 V8] KVM: SEV: Add support for SEV-ES " Peter Gonda
2021-09-14 16:47 ` [PATCH 3/4 V8] selftest: KVM: Add open sev dev helper Peter Gonda
2021-09-15 17:09   ` Marc Orr
2021-09-14 16:47 ` [PATCH 4/4 V8] selftest: KVM: Add intra host migration tests Peter Gonda
2021-09-15 17:27   ` Marc Orr
2021-09-21 14:20     ` Peter Gonda
2021-09-22 16:34       ` Marc Orr
2021-09-22 16:52         ` Peter Gonda
2021-09-22 16:59           ` Marc Orr
2021-09-22 17:02             ` Peter Gonda
2021-09-22 17:05               ` Marc Orr
2021-09-22 17:04   ` Marc Orr

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAMkAt6q5YbZpnDeFXeQsZcK6WtxdAuMoWqqUwURZ9KLz692MEQ@mail.gmail.com \
    --to=pgonda@google.com \
    --cc=bp@alien8.de \
    --cc=brijesh.singh@amd.com \
    --cc=dgilbert@redhat.com \
    --cc=hpa@zytor.com \
    --cc=jmattson@google.com \
    --cc=joro@8bytes.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcorr@google.com \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=rientjes@google.com \
    --cc=seanjc@google.com \
    --cc=tglx@linutronix.de \
    --cc=vkuznets@redhat.com \
    --cc=wanpengli@tencent.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.