[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250318013038.5628-1-yan.y.zhao@intel.com>
Date: Tue, 18 Mar 2025 09:30:37 +0800
From: Yan Zhao <yan.y.zhao@...el.com>
To: pbonzini@...hat.com,
seanjc@...gle.com
Cc: linux-kernel@...r.kernel.org,
kvm@...r.kernel.org,
Yan Zhao <yan.y.zhao@...el.com>
Subject: [PATCH v2 0/5] Small changes related to prefetch and spurious faults
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
Powered by blists - more mailing lists