The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Sean Christopherson <seanjc@google.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	Pattara Teerapong <pteerapong@google.com>,
	David Stevens <stevensd@google.com>,
	Yiwei Zhang <zzyiwei@google.com>, Paul Hsia <paulhsia@google.com>
Subject: Re: [PATCH 3/3] KVM: x86/mmu: Stop zapping invalidated TDP MMU roots asynchronously
Date: Thu, 21 Sep 2023 12:02:33 +0200	[thread overview]
Message-ID: <9ebf281f-7379-ba37-2867-8918da813c19@redhat.com> (raw)
In-Reply-To: <20230916003916.2545000-4-seanjc@google.com>

On 9/16/23 02:39, Sean Christopherson wrote:
> +		if (!root->tdp_mmu_scheduled_root_to_zap)
> +			continue;
> +
> +		root->tdp_mmu_scheduled_root_to_zap = false;

This is protected by slots_lock... tricky.

Worth squashing in a comment and also a small update to another comment:

diff --git a/arch/x86/kvm/mmu/mmu_internal.h b/arch/x86/kvm/mmu/mmu_internal.h
index 93b9d50c24ad..decc1f153669 100644
--- a/arch/x86/kvm/mmu/mmu_internal.h
+++ b/arch/x86/kvm/mmu/mmu_internal.h
@@ -60,6 +60,8 @@ struct kvm_mmu_page {
  	bool unsync;
  	union {
  		u8 mmu_valid_gen;
+
+		/* Only accessed under slots_lock.  */
  		bool tdp_mmu_scheduled_root_to_zap;
  	};
  
diff --git a/arch/x86/kvm/mmu/tdp_mmu.c b/arch/x86/kvm/mmu/tdp_mmu.c
index ca3304c2c00c..070ee5b2c271 100644
--- a/arch/x86/kvm/mmu/tdp_mmu.c
+++ b/arch/x86/kvm/mmu/tdp_mmu.c
@@ -246,7 +246,7 @@ hpa_t kvm_tdp_mmu_get_vcpu_root_hpa(struct kvm_vcpu *vcpu)
  	 * by a memslot update or by the destruction of the VM.  Initialize the
  	 * refcount to two; one reference for the vCPU, and one reference for
  	 * the TDP MMU itself, which is held until the root is invalidated and
-	 * is ultimately put by tdp_mmu_zap_root_work().
+	 * is ultimately put by kvm_tdp_mmu_zap_invalidated_roots().
  	 */
  	refcount_set(&root->tdp_mmu_root_count, 2);
  

Paolo

> +		KVM_BUG_ON(!root->role.invalid, kvm);


  reply	other threads:[~2023-09-21 20:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-16  0:39 [PATCH 0/3] KVM: x86/mmu: Drop async zapping of TDP MMU roots Sean Christopherson
2023-09-16  0:39 ` [PATCH 1/3] KVM: x86/mmu: Open code walking TDP MMU roots for mmu_notifier's zap SPTEs Sean Christopherson
2023-09-21 10:05   ` Paolo Bonzini
2023-09-16  0:39 ` [PATCH 2/3] KVM: x86/mmu: Take "shared" instead of "as_id" TDP MMU's yield-safe iterator Sean Christopherson
2023-09-21 10:52   ` Paolo Bonzini
2023-09-21 14:32     ` Sean Christopherson
2023-09-16  0:39 ` [PATCH 3/3] KVM: x86/mmu: Stop zapping invalidated TDP MMU roots asynchronously Sean Christopherson
2023-09-21 10:02   ` Paolo Bonzini [this message]
2023-09-22 20:40 ` [PATCH 0/3] KVM: x86/mmu: Drop async zapping of TDP MMU roots Paolo Bonzini

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=9ebf281f-7379-ba37-2867-8918da813c19@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulhsia@google.com \
    --cc=pteerapong@google.com \
    --cc=seanjc@google.com \
    --cc=stevensd@google.com \
    --cc=zzyiwei@google.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