From: Yan Zhao <yan.y.zhao@intel.com>
To: pbonzini@redhat.com, seanjc@google.com
Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
Yan Zhao <yan.y.zhao@intel.com>
Subject: [PATCH v2 0/5] Small changes related to prefetch and spurious faults
Date: Tue, 18 Mar 2025 09:30:37 +0800 [thread overview]
Message-ID: <20250318013038.5628-1-yan.y.zhao@intel.com> (raw)
Hi
This is v2 of the series for some small changes related to
prefetch/prefault and spurious faults.
Patch 1: Checks if a shadow-present old SPTE is leaf to determine a
prefetch fault is spurious.
Patch 2: Merges the checks for prefetch and is_access_allowed() for
spurious faults into a common path.
Patch 3: Adds a warning when the PFN changes on a spurious fault in the TDP
MMU
Patch 4: Adds a warning when the PFN changes on a shadow-present SPTE in
the shadow MMU. This implementation differs from the v1
discussion. Upon reconsideration, I realized that WARN_ON_ONCE()
in mmu_spte_update() cannot warn when the PFN changes on a
shadow-present SPTE. Add the warning in mmu_set_spte() and have
the prefetch fault to leverage the warning.
Patch 5: Checks req and frees obsolete roots in each MMU reload.
With below scenario
1. add a memslot with size 4K
2. prefault GPA A in the memslot
3. delete the memslot
4. re-add the memslot with size 2M
5. prefault GPA A again.
Patch 1 is required if zap all quirk is disabled in step 3.
Patch 5 is required if zap all is performed in step 3 and if step 2/5 are
executed before any vcpu_run().
Change log:
v2:
- Check both fault->prefetch and is_access_allowed() in patch 2. (Sean)
- Split patch 3 in v1 into patches 3 and 4.
- Only warn on PFN changes in case of spurious fault in TDP MMU in patch 3.
(Sean).
- Add patch 4 to warn on PFN changes on shadow-present SPTE in shadow MMU.
- Move kvm_mmu_free_obsolete_roots() from kvm_arch_vcpu_pre_fault_memory()
to kvm_mmu_reload() in patch 5. (Sean)
Thanks
Yan
v1: https://lore.kernel.org/all/20250207030640.1585-1-yan.y.zhao@intel.com
Yan Zhao (5):
KVM: x86/mmu: Further check old SPTE is leaf for spurious prefetch
fault
KVM: x86/tdp_mmu: Merge prefetch and access checks for spurious faults
KVM: x86/tdp_mmu: WARN if PFN changes for spurious faults
KVM: x86/mmu: Warn if PFN changes on shadow-present SPTE in shadow MMU
KVM: x86/mmu: Check and free obsolete roots in kvm_mmu_reload()
arch/x86/kvm/mmu.h | 3 +++
arch/x86/kvm/mmu/mmu.c | 6 ++++--
arch/x86/kvm/mmu/tdp_mmu.c | 9 ++++-----
3 files changed, 11 insertions(+), 7 deletions(-)
base-commit: c9ea48bb6ee6b28bbc956c1e8af98044618fed5e
--
2.43.2
next reply other threads:[~2025-03-18 1:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-18 1:30 Yan Zhao [this message]
2025-03-18 1:31 ` [PATCH v2 1/5] KVM: x86/mmu: Further check old SPTE is leaf for spurious prefetch fault Yan Zhao
2025-03-18 1:32 ` [PATCH v2 2/5] KVM: x86/tdp_mmu: Merge prefetch and access checks for spurious faults Yan Zhao
2025-03-18 1:32 ` [PATCH v2 3/5] KVM: x86/tdp_mmu: WARN if PFN changes " Yan Zhao
2025-03-18 1:33 ` [PATCH v2 4/5] KVM: x86/mmu: Warn if PFN changes on shadow-present SPTE in shadow MMU Yan Zhao
2025-03-18 1:33 ` [PATCH v2 5/5] KVM: x86/mmu: Check and free obsolete roots in kvm_mmu_reload() Yan Zhao
2025-05-02 21:50 ` [PATCH v2 0/5] Small changes related to prefetch and spurious faults 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=20250318013038.5628-1-yan.y.zhao@intel.com \
--to=yan.y.zhao@intel.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=seanjc@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
all inboxes | Powered by JetHome®