From: Sean Christopherson <seanjc@google.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: flyingpenghao@gmail.com, kvm@vger.kernel.org,
Peng Hao <flyingpeng@tencent.com>
Subject: Re: [PATCH] KVM: x86/mmu: Conditionally call kvm_zap_obsolete_pages
Date: Tue, 30 Jul 2024 13:27:13 -0700 [thread overview]
Message-ID: <ZqlMob2o-97KsB8t@google.com> (raw)
In-Reply-To: <db00e68b-2b34-49e1-aa72-425a35534762@redhat.com>
On Tue, Jul 30, 2024, Paolo Bonzini wrote:
> On 7/30/24 07:32, flyingpenghao@gmail.com wrote:
> >
> > When tdp_mmu is enabled, invalid root calls kvm_tdp_mmu_zap_invalidated_roots
> > to implement it, and kvm_zap_obsolete_pages is not used.
> >
> > Signed-off-by: Peng Hao<flyingpeng@tencent.com>
> > ---
> > arch/x86/kvm/mmu/mmu.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
> > index 901be9e420a4..e91586c2ef87 100644
> > --- a/arch/x86/kvm/mmu/mmu.c
> > +++ b/arch/x86/kvm/mmu/mmu.c
> > @@ -6447,7 +6447,8 @@ static void kvm_mmu_zap_all_fast(struct kvm *kvm)
> > */
> > kvm_make_all_cpus_request(kvm, KVM_REQ_MMU_FREE_OBSOLETE_ROOTS);
> > - kvm_zap_obsolete_pages(kvm);
> > + if (!tdp_mmu_enabled)
> > + kvm_zap_obsolete_pages(kvm);
>
> Can't you have obsolete pages from the shadow MMU that's used for nested
> (nGPA->HPA) virtualization?
Yep. And kvm_zap_obsolete_pages() is a relatively cheap nop if there are no
pages on active_mmu_pages. E.g. we could check kvm_memslots_have_rmaps(), but I
don't see any point in doing so, as the existing code should be blazing fast
relative to the total cost of the zap.
next prev parent reply other threads:[~2024-07-30 20:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-30 5:32 [PATCH] KVM: x86/mmu: Conditionally call kvm_zap_obsolete_pages flyingpenghao
2024-07-30 9:16 ` Paolo Bonzini
2024-07-30 20:27 ` Sean Christopherson [this message]
2024-07-31 9:09 ` Hao Peng
2024-07-31 10:00 ` Paolo Bonzini
2024-07-31 11:19 ` Hao Peng
2024-07-31 15:00 ` Paolo Bonzini
2024-07-31 15:20 ` Sean Christopherson
2024-07-31 16:07 ` Paolo Bonzini
2024-08-01 4:33 ` Hao Peng
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=ZqlMob2o-97KsB8t@google.com \
--to=seanjc@google.com \
--cc=flyingpeng@tencent.com \
--cc=flyingpenghao@gmail.com \
--cc=kvm@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox