All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Subject: Re: [PATCH 1/3] KVM: x86/mmu: remove unnecessary "bool shared" argument from functions
Date: Fri, 29 Sep 2023 09:11:25 -0700	[thread overview]
Message-ID: <ZRb3LX-tMKtycBjm@google.com> (raw)
In-Reply-To: <20230928162959.1514661-2-pbonzini@redhat.com>

On Thu, Sep 28, 2023, Paolo Bonzini wrote:
> Neither tdp_mmu_next_root nor kvm_tdp_mmu_put_root need to know
> if the lock is taken for read or write.  Either way, protection
> is achieved via RCU and tdp_mmu_pages_lock.  Remove the argument
> and just assert that the lock is taken.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> +void kvm_tdp_mmu_put_root(struct kvm *kvm, struct kvm_mmu_page *root)
>  {
> -	kvm_lockdep_assert_mmu_lock_held(kvm, shared);
> +	/*
> +	 * Either read or write is okay, but the lock is needed because
> +	 * writers might not take tdp_mmu_pages_lock.
> +	 */

Nit, I'd prefer to say mmu_lock instead of "the lock", and be very explicit about
writers not needing to take tdp_mmu_pages_lock, e.g.

	/*
	 * Either read or write is okay, but mmu_lock must be held as writers
	 * are not required to take tdp_mmu_pages_lock.
	 */


> +	lockdep_assert_held(&kvm->mmu_lock);
>  
>  	if (!refcount_dec_and_test(&root->tdp_mmu_root_count))
>  		return;

  parent reply	other threads:[~2023-09-29 16:11 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-28 16:29 [PATCH 0/3] KVM: x86/mmu: small locking cleanups Paolo Bonzini
2023-09-28 16:29 ` [PATCH 1/3] KVM: x86/mmu: remove unnecessary "bool shared" argument from functions Paolo Bonzini
2023-09-28 16:46   ` Maxim Levitsky
2023-09-29 16:11   ` Sean Christopherson [this message]
2023-09-28 16:29 ` [PATCH 2/3] KVM: x86/mmu: remove unnecessary "bool shared" argument from iterators Paolo Bonzini
2023-09-28 16:55   ` Maxim Levitsky
2023-09-29 16:14     ` Sean Christopherson
2023-09-28 16:29 ` [PATCH 3/3] KVM: x86/mmu: always take tdp_mmu_pages_lock Paolo Bonzini
2023-09-29  7:30   ` kernel test robot
2023-09-29 16:16     ` Sean Christopherson

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=ZRb3LX-tMKtycBjm@google.com \
    --to=seanjc@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.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.