public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Tao Su <tao1.su@linux.intel.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/6] KVM: Assert slots_lock is held in __kvm_set_memory_region()
Date: Mon, 5 Aug 2024 15:01:54 -0700	[thread overview]
Message-ID: <ZrFL0g97IGDTDdWS@google.com> (raw)
In-Reply-To: <ZrCQSXmbBK5XZqd8@linux.bj.intel.com>

On Mon, Aug 05, 2024, Tao Su wrote:
> On Fri, Aug 02, 2024 at 01:49:59PM -0700, Sean Christopherson wrote:
> > Add a proper lockdep assertion in __kvm_set_memory_region() instead of
> > relying on a function comment.  Opportunistically delete the entire
> > function comment as the API doesn't allocate memory or select a gfn,
> > and the "mostly for framebuffers" comment hasn't been true for a very long
> > time.
> > 
> > Signed-off-by: Sean Christopherson <seanjc@google.com>
> > ---
> >  virt/kvm/kvm_main.c | 10 ++--------
> >  1 file changed, 2 insertions(+), 8 deletions(-)
> > 
> > diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> > index 0557d663b69b..f202bdbfca9e 100644
> > --- a/virt/kvm/kvm_main.c
> > +++ b/virt/kvm/kvm_main.c
> > @@ -1973,14 +1973,6 @@ static bool kvm_check_memslot_overlap(struct kvm_memslots *slots, int id,
> >  	return false;
> >  }
> >  
> > -/*
> > - * Allocate some memory and give it an address in the guest physical address
> > - * space.
> > - *
> > - * Discontiguous memory is allowed, mostly for framebuffers.
> > - *
> > - * Must be called holding kvm->slots_lock for write.
> > - */
> >  int __kvm_set_memory_region(struct kvm *kvm,
> >  			    const struct kvm_userspace_memory_region2 *mem)
> >  {
> > @@ -1992,6 +1984,8 @@ int __kvm_set_memory_region(struct kvm *kvm,
> >  	int as_id, id;
> >  	int r;
> >  
> > +	lockdep_assert_held(&kvm->slots_lock);
> 
> How about adding this lockdep assertion in __x86_set_memory_region() to replace
> this comment "/* Called with kvm->slots_lock held.  */" as well?

Ya, will do, I didn't see that comment.

Thanks!

  reply	other threads:[~2024-08-05 22:01 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-02 20:49 [PATCH 0/6] KVM: kvm_set_memory_region() cleanups Sean Christopherson
2024-08-02 20:49 ` [PATCH 1/6] KVM: Open code kvm_set_memory_region() into its sole caller (ioctl() API) Sean Christopherson
2024-08-05  8:39   ` Tao Su
2024-08-02 20:49 ` [PATCH 2/6] KVM: Assert slots_lock is held in __kvm_set_memory_region() Sean Christopherson
2024-08-05  8:41   ` Tao Su
2024-08-05 22:01     ` Sean Christopherson [this message]
2024-08-02 20:50 ` [PATCH 3/6] KVM: Add a dedicated API for setting KVM-internal memslots Sean Christopherson
2024-08-05  8:42   ` Tao Su
2024-08-02 20:50 ` [PATCH 4/6] KVM: x86: Drop double-underscores from __kvm_set_memory_region() Sean Christopherson
2024-08-02 20:50 ` [PATCH 5/6] KVM: Disallow all flags for KVM-internal memslots Sean Christopherson
2024-08-02 20:50 ` [PATCH 6/6] KVM: Move flags check for user memory regions to the ioctl() specific API Sean Christopherson
2024-08-08  7:41   ` Xiaoyao Li

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=ZrFL0g97IGDTDdWS@google.com \
    --to=seanjc@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=tao1.su@linux.intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox