From: Sean Christopherson <seanjc@google.com>
To: Hao Zhang <hao_zhang_kdev@163.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>, kvm@vger.kernel.org
Subject: Re: [RFC PATCH 1/1] KVM: x86: Skip empty TDP leaf page tables
Date: Fri, 14 Aug 2026 10:49:16 -0700 [thread overview]
Message-ID: <an9VHNUEx9CPzquP@google.com> (raw)
In-Reply-To: <an7J9Gh2DTrtP5vT@192.168.1.215>
On Fri, Aug 14, 2026, Hao Zhang wrote:
> From: Hao Zhang <zhanghao1@kylinos.cn>
>
> When KVM zaps only leaf SPTEs, the TDP page table hierarchy is
> intentionally retained so that subsequent faults can reuse it. However,
> a later zap of the same range still descends through retained 4K leaf
> page tables whose leaf SPTEs are all non-present.
>
> Track whether a retained 4K leaf page table contains any present leaf
> SPTEs. If a zap fully covers the corresponding 2MiB range and the page
> table is known to be empty, skip descending into it.
>
> Keep the page table hierarchy linked so that it can still be reused by
> future page faults. Installing a new leaf SPTE clears the empty hint.
> The hint checks are skipped for ranges smaller than a complete 2MiB leaf
> page table.
>
> The iterator restarts its walk from the root after yielding. Allow the
> restarted walk to mark an empty leaf page table again instead of
> permanently excluding the page table that contained the yield.
>
> Tested on a 4-vCPU, 1GB guest with five repetitions on the same host.
> The main improvement is seen for repeated same-range invalidation; rolling
> sweep workloads are mostly neutral.
>
> Signed-off-by: Hao Zhang <zhanghao1@kylinos.cn>
> ---
Does the generic iterator solution I provided a (long) while back work for your
use case? I would still strongly prefer a generic solution that doesn't rely on
storing metadata in the MMU page.
https://lore.kernel.org/all/ZxmGdhwr9BlhUQ_Y@google.com
prev parent reply other threads:[~2026-08-14 17:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-14 7:51 [RFC PATCH 0/1] KVM: x86: Skip empty TDP leaf page tables Hao Zhang
2026-08-14 7:55 ` [RFC PATCH 1/1] " Hao Zhang
2026-08-14 17:49 ` Sean Christopherson [this message]
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=an9VHNUEx9CPzquP@google.com \
--to=seanjc@google.com \
--cc=hao_zhang_kdev@163.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